minor ttf bug fixes
authorMatthias Kramm <kramm@quiss.org>
Sun, 9 May 2010 18:17:07 +0000 (11:17 -0700)
committerMatthias Kramm <kramm@quiss.org>
Sun, 9 May 2010 18:17:07 +0000 (11:17 -0700)
lib/ttf.c

index 0e442d1..601aa74 100644 (file)
--- a/lib/ttf.c
+++ b/lib/ttf.c
@@ -638,6 +638,7 @@ static table_maxp_t*maxp_new(ttf_t*ttf)
        maxp->maxComponentPoints = 0;
        maxp->maxComponentContours = 0;
     }
+    maxp->maxZones = 2; // we don't use the Z0 zone
     return maxp;
 }
 static table_maxp_t* maxp_parse(ttf_t*ttf, memreader_t*r)
@@ -1719,13 +1720,25 @@ void gasp_parse(memreader_t*r, ttf_t*ttf)
        gasp->records[t].behaviour = readU16(r);
     }
 }
+
+#define GASP_SYMMETRIC_GRIDFIT 0x0008
+#define GASP_SYMMETRIC_SMOOTHING 0x0004
+#define GASP_DOGRAY 0x0002
+#define GASP_GRIDFIT 0x0001
+
 void gasp_write(ttf_t*ttf, ttf_table_t*table)
 {
     table_gasp_t*gasp = ttf->gasp;
-    writeU16(table, 0);
-    writeU16(table, gasp->num);
+    int version = 0;
     int t;
     for(t=0;t<gasp->num;t++) {
+       if(gasp->records[t].behaviour & ~(GASP_GRIDFIT | GASP_DOGRAY)) {
+           version = 1;
+       }
+    }
+    writeU16(table, version);
+    writeU16(table, gasp->num);
+    for(t=0;t<gasp->num;t++) {
        writeU16(table, gasp->records[t].size);
        writeU16(table, gasp->records[t].behaviour);
     }