Workflow for making a CHDK built-in font
Import (Freetype) ->
[select unicode monospace font] ->
<Open>
adjust '
points', enable
create unicode font, enable
use custom set of characters (paste char code list in edit box)
<Import!>
review generated bitmaps, verify width and height (a CHDK built-in font has to fit in 8x16 pixels)
if wrong size -> back to "
Freetype import" tab, adjust settings,
<Import!>
if too ugly -> adjust size,
<Import!> -> some vector fonts are just too ugly when rasterized at 1 bit bitdepth
if monospace font has few wider and/or missing glyphs -> adjust them (
Character Editor tab)
a _single glyph_ can be copied to clipboard and later pasted to replace one or more selected chars (
Font table tab ->
Font settings tab ->
Operation on selected chars -> ...)
if there were wider glyphs, font needs fixing:
Font table tab ->
Font settings tab ->
Font width limit (😎 ->
Font operation ->
Make fixed width font
followed by
Font table tab ->
Font settings tab ->
Font operation ->
Optimize storage if possible
if font is higher than 16 pixels:
Font table tab ->
Font settings tab ->
Font operation ->
Decrease height by 1 (only do this if Font table tab -> Font properties shows unused row(s) at bottom)
Font table tab ->
Font properties should now show
font height 16, char length 16 bytes
File ->
Save as -> new8x16unicode.rbf in this example
[tt]rbf2chdkfont[/tt] [tt]new8x16unicode.rbf out.txt[/tt]
out.txt can be used to replace the old content of [tt]orig_font_data[][/tt] array in [tt]font_8x16_uni.h[/tt]
"char code list" is comprised of the content of tables in [tt]lib/font/codepages.h[/tt] ([tt]cp_common, cp_win_1250, cp_win_1251, cp_win_1252, cp_win_1253, cp_win_1254, cp_win_1257[/tt])
its format is: decimal or hexadecimal numbers separated by whitespace and/or newline chars
Attached is:
- chdkallchars.txt: the content of this file can be used as the "custom set" mentioned above
- chdkfont2rbf.7z: rbf2chdkfont.c and chdkfont2rbf.c command line utilities
chdkfont2rbf.c also needs lib/font/font_8x16_uni.h
compilation:
gcc -o rbf2chdkfont.exe rbf2chdkfont.c
gcc -o chdkfont2rbf.exe chdkfont2rbf.c
I'm not including executables as the potential user has to be able to compile CHDK too.