more fiddling with edgestyles
[swftools.git] / lib / ttf.h
index a22c87e..e5462e9 100644 (file)
--- a/lib/ttf.h
+++ b/lib/ttf.h
@@ -54,7 +54,6 @@ typedef struct _table_os2 {
     S16 xAvgCharWidth;
     U16 usWeightClass;
     U16 usWidthClass;
-    U16 fsType;
     U16 ySubscriptXSize;
     U16 ySubscriptYSize;
     U16 ySubscriptXOffset;
@@ -77,7 +76,6 @@ typedef struct _table_os2 {
     U8 panose_Midline;
     U8 panose_XHeight;
     U32 ulCharRange[4];
-    U8 achVendID[4];
 
     U16 fsSelection;
     U16 fsFirstCharIndex;
@@ -103,9 +101,6 @@ typedef struct _table_os2 {
 
 typedef struct _table_hea
 {
-    S16 ascent;
-    S16 descent;
-    S16 lineGap;
     U16 advanceWidthMax;
     S16 minLeftSideBearing;
     S16 minRightSideBearing;
@@ -118,13 +113,16 @@ typedef struct _table_hea
 #define GLYPH_ON_CURVE 0x01
 #define GLYPH_CONTOUR_START 0x40
 #define GLYPH_CONTOUR_END 0x80
+
+typedef U32 unicode_t;
+
 typedef struct _ttfpoint {
     int x,y;
     U8 flags;
 } ttfpoint_t;
 typedef struct _ttfglyph {
     U16 advance;
-    U16 bearing;
+    S16 bearing;
     S16 xmin,ymin,xmax,ymax;
     int code_size;
     U8*code;
@@ -141,24 +139,75 @@ typedef struct _table_head {
     S16 dir_hint;
 } table_head_t;
 
+typedef struct _table_post {
+    U16 italic_angle;
+    U16 underline_position;
+    U16 underline_thickness;
+} table_post_t;
+
+typedef struct _table_cvt {
+    S16*values;
+    int num;
+} table_cvt_t;
+
+typedef struct _table_gasp {
+    int num;
+    struct {
+       U16 size;
+       U16 behaviour;
+    } *records;
+} table_gasp_t;
+
+typedef struct _table_code {
+    U8*code;
+    int size;
+} table_code_t;
+
 typedef struct _ttf {
+    char*family_name;     /* nameId 1 */
+    char*subfamily_name;  /* nameId 2 */
+    char*font_uid;        /* nameId 3 */
+    char*full_name;       /* nameId 4 */
+    char*version_string;  /* nameId 5 */
+    char*postscript_name; /* nameId 6 */
+
     ttf_table_t*tables;
 
     table_head_t*head;
     table_maxp_t*maxp;
     table_os2_t*os2;
     table_hea_t*hea;
+    table_post_t*post;
+    table_cvt_t*cvt;
+    table_gasp_t*gasp;
+    table_code_t*prep;
+    table_code_t*fpgm;
 
     U16 flags;
     char is_vertical;
+
+    S16 ascent;
+    S16 descent; // ymin, *not* negative ymin
+    S16 lineGap;
+
     int num_glyphs;
     ttfglyph_t*glyphs;
+    
+    int unicode_size;
+    unicode_t*unicode;
 
     U32 version;
 } ttf_t;
 
 
-ttf_t*load_ttf(void*data, int length);
+ttf_t*ttf_new();
+void ttf_reduce(ttf_t*ttf);
+ttf_t*ttf_load(void*data, int length);
 ttf_table_t*ttf_addtable(ttf_t*ttf, U32 tag);
+void ttf_create_truetype_tables(ttf_t*ttf);
+void ttf_dump(ttf_t*ttf);
+void ttf_destroy(ttf_t*ttf);
+void ttf_save(ttf_t*ttf, const char*filename);
+void ttf_save_eot(ttf_t*ttf, const char*filename);
 
 #endif