Arduino openGLCD Library  Version v1.0rc3
 All Classes Functions Variables Enumerations Enumerator Groups Pages
Using Fonts

There is a free java application available (openGLCDFontCreator) that can convert PC fonts for use with this library.

Using openGLCDFontCreator

openGLCDFontCreator is modified version of GLCDFontCreator2 that can produce a header file suitable for directly using with the library.

Note
openGLCDFontCreator & GLCDFontCreator2 should not be confused with GLCD FontCreator 1.1 mikroElektronica Edition, which is an entirely different product/tool. GLCDFontCreator2 is a free open source Java based application while GLCD FontCreator 1.1 is a Windows based font tool for use with microElectronica s/w products. The mikroElektronica Edition s/w encodes the font data differently and the free version of the software does not allow saving a full character set.

Here is a link to a zip image for openGLCDFontCreator: openGLCDFontCreator Zip Image

To create a font click on [File]->[New Font] Type in the name of the font in the Name box that says "new Font". This will be the name you use for the SelectFont() api call.
DO NOT use spaces in the name.
Example:

openGLCDFontCreator-Newfont.png

If you do not wish to create an entire font yourself, you can import a font from one of the system fonts available by choosing a font from the [Import Font] drop down box. The size is a font size and not a height in pixels. Because of this you may have to play with the size a bit to get a font of the desired pixel height or one that is close to the size you want as not all pixel heights are possible.

Note
You can only specify the size of the font when you import it. So if you decide to change sizes, you must start over by creating a new font and re-importing the font.

When you are ready to create the .h file, simply click on [Export]->[Export Font] and type in the name of the .h file in the File Name box. For consistency it is highly recommended that you name the .h the same as the font name. DO NOT use spaces in the name.
Example:

myfont.h

The font header files must be placed in the fonts directory. For example, if you create a font named myfont in a header named myfont.h then copy myfont.h to the fonts directory.

The distribution contains a file named allFonts.h in the fonts directory that automatically includes all the distributed fonts to make them available for use by sketches.

In order to make newly created fonts "known" by the library and sketches, the header file not only not has to be copied to the fonts directory but there must also be an include for that header file placed the allFonts.h file.

Once this is done, sketches will be able to use the font by simply selecting it. Example:

GLCD.SelectFont(myfont);

If other font generation tools are used, the font header file may need to be modified to work with the library.
Have a look at other font header files to see the general format.
The font header file must contain a gaurd ifdef
The font header must not include any other header files.
The font header should use the GLCDFONTDECL() macro to declare the font.

Font definitions are stored in program memory and this can be significant for larger fonts. The 7 pixel high system font uses under 500 bytes, the supplied Arial14 font uses 1200 bytes of program memory.

Here are some links to additional free fonts that can be downloaded:

Pixel/Bitmap fonts: 1001 Free Fonts
Pixel/Bitmap fonts: FONTs2U
Pixel/Bitmap as well as Dingbat fonts: dafonts

A few tips to keep in mind is that not all the characters have to saved. You can save only a portion or range of the characters. This can be very useful to save memory space if all you need is numbers. Or in some cases fonts may contain characters that can be used as icons or tiny bitmaps. This is particularly true of many of the digbat fonts on the dafonts site.