summaryrefslogtreecommitdiff
path: root/lib/glfont.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/glfont.cc')
-rw-r--r--lib/glfont.cc48
1 files changed, 38 insertions, 10 deletions
diff --git a/lib/glfont.cc b/lib/glfont.cc
index 833d18d..e58feaf 100644
--- a/lib/glfont.cc
+++ b/lib/glfont.cc
@@ -11,24 +11,55 @@ font file format
off|siz|description
---+---+-------------------------------
- 0 | 2 | Number of entries
+ 0 | 2 | Number of entries = nbentries
2 | 1 | Flags
3 | 1 | maxX (maximum width)
4 | 1 | maxY (maximum height)
5 | X | char entries
5+X| Y | char map
+X = (maxX * maxY + 1) * nbentries
+Y = nbentries * 4
+
+
Flags:
------
+=====
0000000R
R = RGBA (=1) or Alpha (=0)
-ABGR in 1232 format:
+RGBA in 1232 format:
ABBGGGRR
-variables comments
+
+Each entries:
+============
+
+off|siz|description
+---+---+-------------------------------
+ 0 | 1 | True size of the entry
+ 1 | Z | Datas
+
+Z = maxX * maxY
+
+
+Char map:
+========
+
+nbentries entries, each entry = 4 bytes = 2 uint16
+
+off|siz|description
+---+---+-------------------------------
+ 0 | 2 | Unicode (?)
+ 2 | 2 | Corresponding char entry
+
+I'm not sure about Unicode. I write this only to say it's an attempt to
+make the fonts "internationals". If the "unicode" is < 255, then it should
+match only one byte in the string. Otherwise, it should match two bytes.
+
+
+Variables comments
==================
nbcU = number of chars on X by texture
@@ -94,14 +125,11 @@ mogltk::font::font(const String & file) {
}
}
}
- curU += maxX;
- if (curU >= 256) {
+ if ((curU += maxX) >= 256) {
curU = 0;
- curV += maxY;
- if (curV >= 256) {
+ if ((curV += maxY) >= 256) {
curV = 0;
- curT++;
- curtex = (Uint8 *) fonttex[curT]->GetSurface()->pixels;
+ curtex = (Uint8 *) fonttex[++curT]->GetSurface()->pixels;
}
}
}