[Supertux-Devel] suggestion for unicode font support
qMax
qmax at academ.org
Sat Aug 9 06:51:32 PDT 2008
Hello.
I'm still working on support for non-latin fonts.
I would like to receive any comments if my implementation wil be applicable.
Intended possibilities are:
- adding new fonts w/out recompiling code,
just via putting new image files in fontpath and describing what
glyphs drawn there
- placing glyphs in random order (in order more convenient for drawing)
- leaving empty spaces on images for future update (skipping glyphs)
At bug tracker grumbel suggested to have lisp-config for describing
encodings.
I think it is wise if such config describe all avaliable fonts and
loaded only once.
It also can be used for loading fonts by names, rather by filenames
(because there will be several files for the same font)
I suggest following syntax:
(supertux-fontconfig
(fonts ; default latin fonts
(subdir "*.png")
(encoding
(range 0x0020 0x007F)
(range 0x00A0 0x017F)
))
(fonts ; basic cyrilic with 'yo' and spaces left for unused chars
(subdir "cyr/*.png")
(encoding
(skip 1) 0x0401 (skip 14)
(range 0x0410 0x044F)
(skip 1) 0x0451
))
(fonts ; adding more letters, not included in basic cyrillic
(subdir "cyr/*-ukr.png")
(encoding
0x0405 0x0406 0x04A5 0x04A6
))
)
Interface of class Font should slightly change into something like this:
FontConfig::FontConfig(const string filepath); // to initializes mapping
of fontname-filename and filename-encoding
Font::Font(FontConfig config, string fontname, string shadowfontname,
int char_width, int char_height, int shadowsize);
when called with fontname "blue",
it will load "$fontpath/blue.png", "$fontpath/cyr/blue.png" and
"$fontpath/cyr/blue-ukr.png"
with proper encodings.
Will it be ok this way ?
--
qMax,
ever.
More information about the Supertux-Devel
mailing list