Go Down

Topic: Download and Install Font (Read 1 time) previous topic - next topic

vagulus

My textbook
"Boxall, J. (2013)  Arduino Workshop. San Francisco (CA) USA: No Starch Press."
has a project on page 155 which has the following include:
#include "fonts/SystemFont5x7.h"

I have found several webpages like
https://github.com/ninjablocks/arduino/blob/master/DMD/SystemFont5x7.h
which have the code.  I was expecting a ZIP file to install like a library file.


Where do I find this font and how do I install it? 
"Answers are easy;
               it's asking the right questions
                                                      which is hard."
 The Doctor (Dr Who: The Face of Evil (1977))

pert

In fact the file at that link is part of the DMD library but it's part of a repository that contains a whole pile of libraries, rather than just one as you might expect. You can download a zip of the entire repository, just as you do with any other GitHub repository by navigating to the root page of the repository, clicking the "Clone or download" button, then "Download ZIP". However, due to the DMD library not being in the root of the repository, you will not be able to use Sketch > Include Library > Add .ZIP Library to install it. Instead you would need to do a manual installation of the DMD library, following these instructions:
https://www.arduino.cc/en/Guide/Libraries#toc5

But first, note that file is not in a fonts subfolder as the include statement expects. This makes it seem likely this isn't the library the sketch in your book was written for. Maybe it can be made to work but it would be good to investigate further before resorting to shoehorning this file into the project.

Please post the full sketch from your book.

vagulus

... note that file is not in a fonts subfolder as the include statement expects. This makes it seem likely this isn't the library the sketch in your book was written for. Maybe it can be made to work but it would be good to investigate further before resorting to shoehorning this file into the project.
I'll go looking

Please post the full sketch from your book.
Code: [Select]

#include <glcd.h>
#include "fonts/SystemFont5x7.h"

void setup()
{
GLCD.Init(NON_INVERTED);
GLCD.ClearScreen();
GLCD.SelectFont(Systems5x7);
}

void loop()
{
GLCD.ClearScreen();
GLCD.CursorTo(1, 1);
GLCD.Puts("Hello, world.");
GLCD.CursorTo(1, 2);
GLCD.Puts("I hope you are");
GLCD.CursorTo(1, 3);
GLCD.Puts("enjoying this");
GLCD.CursorTo(1. 4);
GLCD.Puts("book. ");
GLCD.CursorTo(1, 5);
GLCD.Puts("This is from ");
GLCD.CursorTo(1, 6);
GLCD.Puts("chapter ");
GLCD.PrintNumber(j);
GLCD.Puts(".");
do {} while (1);
}
"Answers are easy;
               it's asking the right questions
                                                      which is hard."
 The Doctor (Dr Who: The Face of Evil (1977))

vagulus

... the file at that link is part of the DMD library but it's part of a repository that contains a whole pile of libraries, rather than just one as you might expect. You can download a zip of the entire repository, just as you do with any other GitHub repository by navigating to the root page of the repository, clicking the "Clone or download" button, then "Download ZIP".
Neither
https://github.com/esp8266/Basic/blob/master/libraries/FTOLED/fonts/SystemFont5x7.h
nor
https://github.com/geekammo/MicroView-Arduino-Library/blob/master/font5x7.h
has any Clone or download button I can see.
"Answers are easy;
               it's asking the right questions
                                                      which is hard."
 The Doctor (Dr Who: The Face of Evil (1977))

pert

Code: [Select]

#include <glcd.h>

Here's the essential clue. In order to include a file in the subfolder (fonts in this case) of a library you must first include a file in the primary source folder, otherwise the Arduino IDE will not find the file in the subfolder. So now we know that the library contains a file named glcd.h, a subfolder named fonts that contains a file named SystemFont5x7.h.

A search finds quite a few of these libraries but the parent of all of then is this one:
https://code.google.com/archive/p/glcd-arduino
There are a couple downloads available and I really don't know which is which.

There is also a Playground page for the library:
https://playground.arduino.cc/Code/GLCDks0108

Now you will notice that it's stated on both those pages:
Quote
This library is no longer being maintained by the authors and has not been updated since December 2011. This library does not work with newer Arduino IDEs like the latest 1.0.x releases as well as 1.6.0 IDE and beyond since the newer IDEs use updated AVR gcc tools and GLCDv3 library uses code which is not compatible with the newer AVR gcc tools.

If you are ok with a GPL 3.0 licensed library (your project is open source) openGLCD is an alternative which is compatible with GLCDv3 and is being maintained.

https://bitbucket.org/bperrybap/openglcd/
That library does contain a fonts folder with the SystemFont5x7.h. I notice in the wiki is mentioned that library can be configured for GLCDv3 library compatibility mode so it may be quite simple to use your code with the newer library.

This is the problem with books. The just can't keep up with the rapidly changing world of technology. If the book doesn't at least give a URL where you can find the glcd library that's not a good sign of quality work.

Neither
https://github.com/esp8266/Basic/blob/master/libraries/FTOLED/fonts/SystemFont5x7.h
nor
https://github.com/geekammo/MicroView-Arduino-Library/blob/master/font5x7.h
has any Clone or download button I can see.
I already explained this to you. You won't see the button when you're in a subpage of the repository. You need to navigate up to the root page of the repository. The easiest way to do that is to click the repository (not user) name in the top left corner of the screen. For example in the first of your links you would click on "Basic". Then voila, you have a "Clone or download" button.

vagulus

I have downloaded openGLCD-v1.0rc3 from https://bitbucket.org/bperrybap/openglcd/.  It contains a folder openGLCD which has a subfolder Fonts which contains the header SystemFont5x7.h.

Do I simply go through the Sketch -->Include Library --> Add .zip Library process in the Arduino IDE and use
#include <openGLCD.h>
#include "fonts/SystemFont5x7.h"

in my code?
"Answers are easy;
               it's asking the right questions
                                                      which is hard."
 The Doctor (Dr Who: The Face of Evil (1977))

pert

#6
Jan 17, 2018, 08:16 am Last Edit: Jan 17, 2018, 08:16 am by pert
Do I simply go through the Sketch -->Include Library --> Add .zip Library process in the Arduino IDE
Correct.

#include <openGLCD.h>
#include "fonts/SystemFont5x7.h"

in my code?
I don't know. I've never used the library. You might want to look into this compatibility mode mentioned in the wiki:
https://bitbucket.org/bperrybap/openglcd/wiki/
You could also just use the documentation and the example sketches that come with the library to start from scratch.

and use
 MicroView-Arduino-Library-master.zip
67.53 KB
downloaded 0 times
What's that for?

vagulus

You could also just use the documentation and the example sketches that come with the library to start from scratch.
;D  I really admire your optimism.   ::)

That's a little like expecting my four-year-old granddaughter to understand the WA Occupational Safety and Health Act 1982 - and I've worked with that for years and still don't claim to understand it!  :smiley-roll-blue:

That's why people like me, thrashing around trying to get to grips with microprocessors and all the goes with them, come to this forum.  We are hoping that you folk who do understand such things will help us along the painful road towards understanding.  We can only hope that it is not too much of a pain for you folks - and I am sure that I am not the only one who appreciates your patience.
"Answers are easy;
               it's asking the right questions
                                                      which is hard."
 The Doctor (Dr Who: The Face of Evil (1977))

Popol974

#8
Oct 24, 2018, 03:55 pm Last Edit: Oct 24, 2018, 03:56 pm by Popol974
I have downloaded openGLCD-v1.0rc3 from https://bitbucket.org/bperrybap/openglcd/.  It contains a folder openGLCD which has a subfolder Fonts which contains the header SystemFont5x7.h.

Do I simply go through the Sketch -->Include Library --> Add .zip Library process in the Arduino IDE and use
#include <openGLCD.h>
#include "fonts/SystemFont5x7.h"

in my code?
Hello Vagulus,

i have the same issue,

but just simply fix it by modify the #define like this

#include "C:\Users\***your computer***\Documents\Arduino\libraries\fonts\SystemFont5x7.h"

and it works!

Because my SystemFont5x7.h have already been customise and i dont want to use an another one, even if he has the same name :)

I wish it will help others!
Beginer in Arduino but 30 years of electronic love :)

Go Up