ref: b5f3fef71fe1500540787b1757213bd204b73c0a
parent: 7e2cbd92a40518a78cdbf60d1767131a21795ae3
author: Ali Gholami Rudi <ali@rudi.ir>
date: Fri Aug 29 08:34:59 EDT 2014
font: store font->gl[] indices inside font->ch_g[]
--- a/font.c
+++ b/font.c
@@ -11,7 +11,7 @@
int gl_n; /* number of glyphs in gl[] */
/* charset mapping; ch[i] is mapped to glyph ch_g[i] */
char ch[NGLYPHS][GNLEN];
- struct glyph *ch_g[NGLYPHS];
+ int ch_g[NGLYPHS];
int ch_n; /* number of characters in ch[] */
/* glyph table; lists per glyph identifier starting character */
int ghead[256]; /* glyph list head */
@@ -26,7 +26,7 @@
int i = fn->chead[(unsigned char) name[0]];
while (i >= 0) {
if (!strcmp(name, fn->ch[i]))
- return fn->ch_g[i];
+ return fn->gl + fn->ch_g[i];
i = fn->cnext[i];
}
return NULL;
@@ -96,10 +96,10 @@
glyph->pos = 0;
}
} else {
- glyph = fn->ch_g[fn->ch_n - 1];
+ glyph = fn->gl + fn->ch_g[fn->ch_n - 1];
}
strcpy(fn->ch[fn->ch_n], name);
- fn->ch_g[fn->ch_n] = glyph;
+ fn->ch_g[fn->ch_n] = glyph - fn->gl;
fn->cnext[fn->ch_n] = fn->chead[(unsigned char) name[0]];
fn->chead[(unsigned char) name[0]] = fn->ch_n;
fn->ch_n++;