From 4fde43181e0c726a1e0de1e26ffe1983774d1ed0 Mon Sep 17 00:00:00 2001 From: pixel Date: Sun, 8 Dec 2002 20:00:50 +0000 Subject: Commit of the day --- lib/glfont.cc | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'lib/glfont.cc') 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; -- cgit v1.2.3