resolved conflict with MingW's FIXED type.
[swftools.git] / pdf2swf / ttf2pt1 / ttf.h
1 /*
2  * see COPYRIGHT
3  */
4
5 /*      these definitions are mostly taken from Microsoft's True Type
6         documentation.
7 */
8
9 #define BYTE unsigned char
10 #define CHAR signed char
11 #define USHORT unsigned short
12 #define SHORT signed short
13 #define ULONG unsigned int
14 #define LONG signed int
15 #define FWORD SHORT
16 #define UFWORD USHORT
17
18 #define ONOROFF 0x01
19 #define XSHORT  0x02
20 #define YSHORT  0x04
21 #define REPEAT  0x08
22 #define XSAME   0x10
23 #define YSAME   0x20
24
25 #define ARG_1_AND_2_ARE_WORDS           0x0001
26 #define ARGS_ARE_XY_VALUES                      0x0002
27 #define XY_BOUND_TO_GRID                        0x0004
28 #define WE_HAVE_A_SCALE                         0x0008
29 #define MORE_COMPONENTS                         0x0020
30 #define WE_HAVE_AN_X_AND_Y_SCALE        0x0040
31 #define WE_HAVE_A_TWO_BY_TWO            0x0080
32 #define WE_HAVE_INSTRUCTIONS            0x0100
33 #define USE_MY_METRICS                          0x0200
34
35 typedef struct short_2 {
36         SHORT   upper;
37         USHORT  lower;
38 } TTF2PT1_FIXED ;
39
40 typedef struct longhormetric {
41         UFWORD  advanceWidth;
42         FWORD   lsb;
43 } LONGHORMETRIC;
44
45 typedef struct ttf_hhea {
46         BYTE    version[4];
47         SHORT   ascender, descender, lineGap;
48         USHORT  advnaceWidthMax;
49         SHORT   minLSB, minRSB, xMaxExtent;
50         SHORT   caretSlopeRise, caretSlopeRun;
51         SHORT   reserved[5];
52         SHORT   metricDataFormat;
53         USHORT  numberOfHMetrics;
54 } TTF_HHEA;
55
56 typedef struct ttf_dir_entry {
57         char    tag[4];
58         ULONG   checksum;
59         ULONG   offset;
60         ULONG   length;
61 } TTF_DIR_ENTRY ;
62
63 typedef struct ttf_directory {
64         ULONG                   sfntVersion;
65         USHORT                  numTables;
66         USHORT                  searchRange;
67         USHORT                  entrySelector;
68         USHORT                  rangeShift;
69         TTF_DIR_ENTRY   list;
70 } TTF_DIRECTORY ;
71
72 typedef struct ttf_name_rec {
73         USHORT  platformID;
74         USHORT  encodingID;
75         USHORT  languageID;
76         USHORT  nameID;
77         USHORT  stringLength;
78         USHORT  stringOffset;
79 } TTF_NAME_REC;
80
81 typedef struct ttf_name {
82         USHORT                  format;
83         USHORT                  numberOfNameRecords;
84         USHORT                  offset;
85         TTF_NAME_REC    nameRecords;
86 } TTF_NAME ;
87
88 typedef struct ttf_head {
89         ULONG   version;
90         ULONG   fontRevision;
91         ULONG   checksumAdjust;
92         ULONG   magicNo;
93         USHORT  flags;
94         USHORT  unitsPerEm;
95         BYTE    created[8];
96         BYTE    modified[8];
97         FWORD   xMin, yMin, xMax, yMax;
98         USHORT  macStyle, lowestRecPPEM;
99         SHORT   fontDirection, indexToLocFormat, glyphDataFormat;
100 } TTF_HEAD ;
101
102 typedef struct ttf_kern {
103         USHORT  version, nTables;
104 } TTF_KERN ;
105
106 typedef struct ttf_kern_sub {
107         USHORT version, length, coverage;
108         USHORT nPairs, searchRange, entrySelector, rangeShift;
109 } TTF_KERN_SUB;
110
111 typedef struct ttf_kern_entry {
112         USHORT  left, right;
113         FWORD   value;
114 } TTF_KERN_ENTRY;
115
116 typedef struct ttf_cmap_fmt0 {
117         USHORT  format;
118         USHORT  length;
119         USHORT  version;
120         BYTE    glyphIdArray[256];
121 } TTF_CMAP_FMT0;
122
123 typedef struct ttf_cmap_fmt4 {
124         USHORT  format;
125         USHORT  length;
126         USHORT  version;
127         USHORT  segCountX2;
128         USHORT  searchRange;
129         USHORT  entrySelector;
130         USHORT  rangeShift;
131 } TTF_CMAP_FMT4;
132
133 typedef struct ttf_cmap_entry {
134         USHORT  platformID;
135         USHORT  encodingID;
136         ULONG   offset;
137 } TTF_CMAP_ENTRY;
138
139 typedef struct ttf_cmap {
140         USHORT                  version;
141         USHORT                  numberOfEncodingTables;
142         TTF_CMAP_ENTRY  encodingTable[1];
143 } TTF_CMAP ;
144
145 typedef struct ttf_glyf {
146         SHORT   numberOfContours;
147         FWORD   xMin, yMin, xMax, yMax;
148 } TTF_GLYF ;
149
150 typedef struct ttf_maxp {
151         ULONG   version;
152         USHORT  numGlyphs, maxPoints, maxContours;
153         USHORT  maxCompositePoints, maxCompositeContours;
154         USHORT  maxZones, maxTwilightPoints, maxStorage;
155         USHORT  maxFunctionDefs, maxInstructionsDefs;
156         USHORT  maxSizeOfInstructions, maxComponentElements;
157         USHORT  maxComponentDepth;
158 } TTF_MAXP ;
159
160 typedef struct ttf_post_head {
161         ULONG   formatType;
162         TTF2PT1_FIXED   italicAngle;
163         FWORD   underlinePosition;
164         FWORD   underlineThickness;
165         ULONG   isFixedPitch;
166         ULONG   minMemType42;
167         ULONG   maxMemType42;
168         ULONG   minMemType1;
169         ULONG   maxMemType1;
170         USHORT  numGlyphs;
171         USHORT  glyphNameIndex;
172 } TTF_POST_HEAD ;