diff options
Diffstat (limited to 'lib/glfont.cc')
-rw-r--r-- | lib/glfont.cc | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/lib/glfont.cc b/lib/glfont.cc index 82058c8..833d18d 100644 --- a/lib/glfont.cc +++ b/lib/glfont.cc @@ -4,13 +4,45 @@ Uint8 prescale2[4] = { 0, 85, 170, 255 }, prescale3[8] = { 0, 36, 72, 109, 145, 182, 218, 255 }; +/* + +font file format +================ + +off|siz|description +---+---+------------------------------- + 0 | 2 | Number of entries + 2 | 1 | Flags + 3 | 1 | maxX (maximum width) + 4 | 1 | maxY (maximum height) + 5 | X | char entries +5+X| Y | char map + +Flags: +----- + +0000000R + +R = RGBA (=1) or Alpha (=0) + +ABGR in 1232 format: +ABBGGGRR + +variables comments +================== + +nbcU = number of chars on X by texture +nbcV = number of chars on Y by texture +nbcT = number of char by texture +nbT = number of textures + +*/ + mogltk::font::font(const String & file) { Input ffont(file); int i; -#ifdef HAVE_ZLIB ffont.SetZ(); -#endif ffont.read(&nbentries, 2); ffont.read(&flags, 1); @@ -44,7 +76,7 @@ mogltk::font::font(const String & file) { for (int u = 0; u < maxX; u++) { Uint8 f; ffont.read(&f, 1); - if (flags) { + if (flags & 1) { Uint8 r, g, b, a; r = f & 3; g = (f >> 2) & 7; |