Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FontCreator

Turns a character set exported as segment bytes into the packed hex tables the Wordclock firmware uses for its fonts (FontCourierNew7x9, FontTahoma10x10, FontLucidaSans9x10, FontSprite5x8).

How it is used

There are no command line arguments and no file input or output. The font lives in the source, and the result goes to standard output — so the workflow is paste, compile, run, copy:

  1. Paste a character set into the Font[][] table in main.cpp. Fonts/ holds the ones used so far as templates.

  2. Adjust the constants at the top of main.cpp to that set:

    Constant Meaning
    NUMBER_OF_CHARS how many characters the table holds (96 for ASCII, 224 with Latin-1)
    NUMBER_OF_COLUMNS entries per table row: one width byte plus two segment bytes per pixel column
    FONT_WIDTH, FONT_HEIGHT size of a glyph in pixels
  3. Build and run, redirecting the output into a file.

g++ -std=c++11 -o fontcreator main.cpp
./fontcreator > font.txt
  1. Copy the hex words into the Font*.cpp of the firmware.

The two switches worth knowing

DECODE at the top of main.cpp decides what is printed. With STD_ON it prints the packed hex words that go into the firmware. With STD_OFF it prints each glyph as ASCII art instead, which is the quick way to check that a pasted font was decoded correctly before generating anything.

setVertical() against setHorizontal() in main() decides how the bitmap is packed: setVertical() packs each pixel column into one word, setHorizontal() each row. Which one a font needs depends on the class that declares it in the firmware — FontCharVertical or FontCharHorizontal — and both are in use, so this has to be picked per font rather than once. Getting it wrong yields transposed glyphs rather than garbage, which makes it easy to miss. The file names under Fonts/ say which of the two a template was made for.

About

Generates packed bitmap font tables from exported character sets

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages