]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /* |
2 | ****************************************************************************** * | |
3 | * | |
4 | * Copyright (C) 1999-2001, International Business Machines | |
5 | * Corporation and others. All Rights Reserved. | |
6 | * | |
7 | ****************************************************************************** * | |
8 | * file name: sfnt.h | |
9 | * | |
10 | * created on: ??/??/2001 | |
11 | * created by: Eric R. Mader | |
12 | */ | |
13 | ||
14 | #ifndef __SFNT_H | |
15 | #define __SFNT_H | |
16 | ||
17 | #include "LETypes.h" | |
18 | ||
19 | ||
20 | #ifndef ANY_NUMBER | |
21 | #define ANY_NUMBER 1 | |
22 | #endif | |
23 | ||
24 | struct DirectoryEntry | |
25 | { | |
26 | le_uint32 tag; | |
27 | le_uint32 checksum; | |
28 | le_uint32 offset; | |
29 | le_uint32 length; | |
30 | }; | |
31 | ||
32 | struct SFNTDirectory | |
33 | { | |
34 | le_uint32 scalerType; | |
35 | le_uint16 numTables; | |
36 | le_uint16 searchRange; | |
37 | le_uint16 entrySelector; | |
38 | le_uint16 rangeShift; | |
39 | DirectoryEntry tableDirectory[ANY_NUMBER]; | |
40 | }; | |
41 | ||
42 | ||
43 | struct CMAPEncodingSubtableHeader | |
44 | { | |
45 | le_uint16 platformID; | |
46 | le_uint16 platformSpecificID; | |
47 | le_uint32 encodingOffset; | |
48 | }; | |
49 | ||
50 | struct CMAPTable | |
51 | { | |
52 | le_uint16 version; | |
53 | le_uint16 numberSubtables; | |
54 | CMAPEncodingSubtableHeader encodingSubtableHeaders[ANY_NUMBER]; | |
55 | }; | |
56 | ||
57 | struct CMAPEncodingSubtable | |
58 | { | |
59 | le_uint16 format; | |
60 | le_uint16 length; | |
61 | le_uint16 language; | |
62 | }; | |
63 | ||
64 | struct CMAPFormat0Encoding : CMAPEncodingSubtable | |
65 | { | |
66 | le_uint8 glyphIndexArray[256]; | |
67 | }; | |
68 | ||
69 | struct CMAPFormat2Subheader | |
70 | { | |
71 | le_uint16 firstCode; | |
72 | le_uint16 entryCount; | |
73 | le_int16 idDelta; | |
74 | le_uint16 idRangeOffset; | |
75 | }; | |
76 | ||
77 | struct CMAPFormat2Encoding : CMAPEncodingSubtable | |
78 | { | |
79 | le_uint16 subHeadKeys[256]; | |
80 | CMAPFormat2Subheader subheaders[ANY_NUMBER]; | |
81 | }; | |
82 | ||
83 | struct CMAPFormat4Encoding : CMAPEncodingSubtable | |
84 | { | |
85 | le_uint16 segCountX2; | |
86 | le_uint16 searchRange; | |
87 | le_uint16 entrySelector; | |
88 | le_uint16 rangeShift; | |
89 | le_uint16 endCodes[ANY_NUMBER]; | |
90 | // le_uint16 reservedPad; | |
91 | // le_uint16 startCodes[ANY_NUMBER]; | |
92 | // le_uint16 idDelta[ANY_NUMBER]; | |
93 | // le_uint16 idRangeOffset[ANY_NUMBER]; | |
94 | // le_uint16 glyphIndexArray[ANY_NUMBER]; | |
95 | }; | |
96 | ||
97 | struct CMAPFormat6Encoding : CMAPEncodingSubtable | |
98 | { | |
99 | le_uint16 firstCode; | |
100 | le_uint16 entryCount; | |
101 | le_uint16 glyphIndexArray[ANY_NUMBER]; | |
102 | }; | |
103 | ||
104 | struct CMAPEncodingSubtable32 | |
105 | { | |
106 | le_uint32 format; | |
107 | le_uint32 length; | |
108 | le_uint32 language; | |
109 | }; | |
110 | ||
111 | struct CMAPGroup | |
112 | { | |
113 | le_uint32 startCharCode; | |
114 | le_uint32 endCharCode; | |
115 | le_uint32 startGlyphCode; | |
116 | }; | |
117 | ||
118 | struct CMAPFormat8Encoding : CMAPEncodingSubtable32 | |
119 | { | |
120 | le_uint32 is32[65536/32]; | |
121 | le_uint32 nGroups; | |
122 | CMAPGroup groups[ANY_NUMBER]; | |
123 | }; | |
124 | ||
125 | struct CMAPFormat10Encoding : CMAPEncodingSubtable32 | |
126 | { | |
127 | le_uint32 startCharCode; | |
128 | le_uint32 numCharCodes; | |
129 | le_uint16 glyphs[ANY_NUMBER]; | |
130 | }; | |
131 | ||
132 | struct CMAPFormat12Encoding : CMAPEncodingSubtable32 | |
133 | { | |
134 | le_uint32 nGroups; | |
135 | CMAPGroup groups[ANY_NUMBER]; | |
136 | }; | |
137 | ||
138 | typedef le_int32 fixed; | |
139 | ||
140 | struct BigDate | |
141 | { | |
142 | le_uint32 bc; | |
143 | le_uint32 ad; | |
144 | }; | |
145 | ||
146 | struct HEADTable | |
147 | { | |
148 | fixed version; | |
149 | fixed fontRevision; | |
150 | le_uint32 checksumAdjustment; | |
151 | le_uint32 magicNumber; | |
152 | le_uint16 flags; | |
153 | le_uint16 unitsPerEm; | |
154 | BigDate created; | |
155 | BigDate modified; | |
156 | le_int16 xMin; | |
157 | le_int16 yMin; | |
158 | le_int16 xMax; | |
159 | le_int16 yMax; | |
160 | le_int16 lowestRecPPEM; | |
161 | le_int16 fontDirectionHint; | |
162 | le_int16 indexToLocFormat; | |
163 | le_int16 glyphDataFormat; | |
164 | }; | |
165 | ||
166 | struct MAXPTable | |
167 | { | |
168 | fixed version; | |
169 | le_uint16 numGlyphs; | |
170 | le_uint16 maxPoints; | |
171 | le_uint16 maxContours; | |
172 | le_uint16 maxComponentPoints; | |
173 | le_uint16 maxComponentContours; | |
174 | le_uint16 maxZones; | |
175 | le_uint16 maxTwilightPoints; | |
176 | le_uint16 maxStorage; | |
177 | le_uint16 maxFunctionDefs; | |
178 | le_uint16 maxInstructionDefs; | |
179 | le_uint16 maxStackElements; | |
180 | le_uint16 maxSizeOfInstructions; | |
181 | le_uint16 maxComponentElements; | |
182 | le_uint16 maxComponentDepth; | |
183 | }; | |
184 | ||
185 | struct HHEATable | |
186 | { | |
187 | fixed version; | |
188 | le_int16 ascent; | |
189 | le_int16 descent; | |
190 | le_int16 lineGap; | |
191 | le_uint16 advanceWidthMax; | |
192 | le_int16 minLeftSideBearing; | |
193 | le_int16 minRightSideBearing; | |
194 | le_int16 xMaxExtent; | |
195 | le_int16 caretSlopeRise; | |
196 | le_int16 caretSlopeRun; | |
197 | le_int16 caretOffset; | |
198 | le_int16 reserved1; | |
199 | le_int16 reserved2; | |
200 | le_int16 reserved3; | |
201 | le_int16 reserved4; | |
202 | le_int16 metricDataFormat; | |
203 | le_uint16 numOfLongHorMetrics; | |
204 | }; | |
205 | ||
206 | struct LongHorMetric | |
207 | { | |
208 | le_uint16 advanceWidth; | |
209 | le_int16 leftSideBearing; | |
210 | }; | |
211 | ||
212 | struct HMTXTable | |
213 | { | |
214 | LongHorMetric hMetrics[ANY_NUMBER]; // ANY_NUMBER = numOfLongHorMetrics from hhea table | |
215 | // le_int16 leftSideBearing[ANY_NUMBER]; // ANY_NUMBER = numGlyphs - numOfLongHorMetrics | |
216 | }; | |
217 | ||
218 | #endif | |
219 |