]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /*************************************************************************** |
2 | * | |
73c04bcf | 3 | * Copyright (C) 1998-2005, International Business Machines |
b75a7d8f A |
4 | * Corporation and others. All Rights Reserved. |
5 | * | |
6 | ************************************************************************/ | |
7 | ||
8 | #ifndef __SFNT_H | |
9 | #define __SFNT_H | |
10 | ||
11 | #include "LETypes.h" | |
12 | ||
13 | ||
14 | #ifndef ANY_NUMBER | |
15 | #define ANY_NUMBER 1 | |
16 | #endif | |
17 | ||
18 | struct DirectoryEntry | |
19 | { | |
20 | le_uint32 tag; | |
21 | le_uint32 checksum; | |
22 | le_uint32 offset; | |
23 | le_uint32 length; | |
24 | }; | |
25 | ||
26 | struct SFNTDirectory | |
27 | { | |
28 | le_uint32 scalerType; | |
29 | le_uint16 numTables; | |
30 | le_uint16 searchRange; | |
31 | le_uint16 entrySelector; | |
32 | le_uint16 rangeShift; | |
33 | DirectoryEntry tableDirectory[ANY_NUMBER]; | |
34 | }; | |
35 | ||
36 | ||
37 | struct CMAPEncodingSubtableHeader | |
38 | { | |
39 | le_uint16 platformID; | |
40 | le_uint16 platformSpecificID; | |
41 | le_uint32 encodingOffset; | |
42 | }; | |
43 | ||
44 | struct CMAPTable | |
45 | { | |
46 | le_uint16 version; | |
47 | le_uint16 numberSubtables; | |
48 | CMAPEncodingSubtableHeader encodingSubtableHeaders[ANY_NUMBER]; | |
49 | }; | |
50 | ||
51 | struct CMAPEncodingSubtable | |
52 | { | |
53 | le_uint16 format; | |
54 | le_uint16 length; | |
55 | le_uint16 language; | |
56 | }; | |
57 | ||
58 | struct CMAPFormat0Encoding : CMAPEncodingSubtable | |
59 | { | |
60 | le_uint8 glyphIndexArray[256]; | |
61 | }; | |
62 | ||
63 | struct CMAPFormat2Subheader | |
64 | { | |
65 | le_uint16 firstCode; | |
66 | le_uint16 entryCount; | |
67 | le_int16 idDelta; | |
68 | le_uint16 idRangeOffset; | |
69 | }; | |
70 | ||
71 | struct CMAPFormat2Encoding : CMAPEncodingSubtable | |
72 | { | |
73 | le_uint16 subHeadKeys[256]; | |
74 | CMAPFormat2Subheader subheaders[ANY_NUMBER]; | |
75 | }; | |
76 | ||
77 | struct CMAPFormat4Encoding : CMAPEncodingSubtable | |
78 | { | |
79 | le_uint16 segCountX2; | |
80 | le_uint16 searchRange; | |
81 | le_uint16 entrySelector; | |
82 | le_uint16 rangeShift; | |
83 | le_uint16 endCodes[ANY_NUMBER]; | |
84 | // le_uint16 reservedPad; | |
85 | // le_uint16 startCodes[ANY_NUMBER]; | |
86 | // le_uint16 idDelta[ANY_NUMBER]; | |
87 | // le_uint16 idRangeOffset[ANY_NUMBER]; | |
88 | // le_uint16 glyphIndexArray[ANY_NUMBER]; | |
89 | }; | |
90 | ||
91 | struct CMAPFormat6Encoding : CMAPEncodingSubtable | |
92 | { | |
93 | le_uint16 firstCode; | |
94 | le_uint16 entryCount; | |
95 | le_uint16 glyphIndexArray[ANY_NUMBER]; | |
96 | }; | |
97 | ||
98 | struct CMAPEncodingSubtable32 | |
99 | { | |
100 | le_uint32 format; | |
101 | le_uint32 length; | |
102 | le_uint32 language; | |
103 | }; | |
104 | ||
105 | struct CMAPGroup | |
106 | { | |
107 | le_uint32 startCharCode; | |
108 | le_uint32 endCharCode; | |
109 | le_uint32 startGlyphCode; | |
110 | }; | |
111 | ||
112 | struct CMAPFormat8Encoding : CMAPEncodingSubtable32 | |
113 | { | |
114 | le_uint32 is32[65536/32]; | |
115 | le_uint32 nGroups; | |
116 | CMAPGroup groups[ANY_NUMBER]; | |
117 | }; | |
118 | ||
119 | struct CMAPFormat10Encoding : CMAPEncodingSubtable32 | |
120 | { | |
121 | le_uint32 startCharCode; | |
122 | le_uint32 numCharCodes; | |
123 | le_uint16 glyphs[ANY_NUMBER]; | |
124 | }; | |
125 | ||
126 | struct CMAPFormat12Encoding : CMAPEncodingSubtable32 | |
127 | { | |
128 | le_uint32 nGroups; | |
129 | CMAPGroup groups[ANY_NUMBER]; | |
130 | }; | |
131 | ||
132 | typedef le_int32 fixed; | |
133 | ||
134 | struct BigDate | |
135 | { | |
136 | le_uint32 bc; | |
137 | le_uint32 ad; | |
138 | }; | |
139 | ||
140 | struct HEADTable | |
141 | { | |
142 | fixed version; | |
143 | fixed fontRevision; | |
144 | le_uint32 checksumAdjustment; | |
145 | le_uint32 magicNumber; | |
146 | le_uint16 flags; | |
147 | le_uint16 unitsPerEm; | |
148 | BigDate created; | |
149 | BigDate modified; | |
150 | le_int16 xMin; | |
151 | le_int16 yMin; | |
152 | le_int16 xMax; | |
153 | le_int16 yMax; | |
154 | le_int16 lowestRecPPEM; | |
155 | le_int16 fontDirectionHint; | |
156 | le_int16 indexToLocFormat; | |
157 | le_int16 glyphDataFormat; | |
158 | }; | |
159 | ||
160 | struct MAXPTable | |
161 | { | |
162 | fixed version; | |
163 | le_uint16 numGlyphs; | |
164 | le_uint16 maxPoints; | |
165 | le_uint16 maxContours; | |
166 | le_uint16 maxComponentPoints; | |
167 | le_uint16 maxComponentContours; | |
168 | le_uint16 maxZones; | |
169 | le_uint16 maxTwilightPoints; | |
170 | le_uint16 maxStorage; | |
171 | le_uint16 maxFunctionDefs; | |
172 | le_uint16 maxInstructionDefs; | |
173 | le_uint16 maxStackElements; | |
174 | le_uint16 maxSizeOfInstructions; | |
175 | le_uint16 maxComponentElements; | |
176 | le_uint16 maxComponentDepth; | |
177 | }; | |
178 | ||
179 | struct HHEATable | |
180 | { | |
181 | fixed version; | |
182 | le_int16 ascent; | |
183 | le_int16 descent; | |
184 | le_int16 lineGap; | |
185 | le_uint16 advanceWidthMax; | |
186 | le_int16 minLeftSideBearing; | |
187 | le_int16 minRightSideBearing; | |
188 | le_int16 xMaxExtent; | |
189 | le_int16 caretSlopeRise; | |
190 | le_int16 caretSlopeRun; | |
191 | le_int16 caretOffset; | |
192 | le_int16 reserved1; | |
193 | le_int16 reserved2; | |
194 | le_int16 reserved3; | |
195 | le_int16 reserved4; | |
196 | le_int16 metricDataFormat; | |
197 | le_uint16 numOfLongHorMetrics; | |
198 | }; | |
199 | ||
200 | struct LongHorMetric | |
201 | { | |
202 | le_uint16 advanceWidth; | |
203 | le_int16 leftSideBearing; | |
204 | }; | |
205 | ||
206 | struct HMTXTable | |
207 | { | |
208 | LongHorMetric hMetrics[ANY_NUMBER]; // ANY_NUMBER = numOfLongHorMetrics from hhea table | |
209 | // le_int16 leftSideBearing[ANY_NUMBER]; // ANY_NUMBER = numGlyphs - numOfLongHorMetrics | |
210 | }; | |
211 | ||
73c04bcf A |
212 | enum PlatformID |
213 | { | |
214 | PLATFORM_UNICODE = 0, | |
215 | PLATFORM_MACINTOSH = 1, | |
216 | PLATFORM_ISO = 2, | |
217 | PLATFORM_MICROSOFT = 3, | |
218 | PLATFORM_CUSTOM = 4 | |
219 | }; | |
220 | ||
221 | enum MacintoshEncodingID | |
222 | { | |
223 | MACINTOSH_ROMAN = 0 | |
224 | }; | |
225 | ||
226 | enum MacintoshLanguageID | |
227 | { | |
228 | MACINTOSH_ENGLISH = 0 | |
229 | }; | |
230 | ||
231 | enum NameID | |
232 | { | |
233 | NAME_COPYRIGHT_NOTICE = 0, | |
234 | NAME_FONT_FAMILY = 1, | |
235 | NAME_FONT_SUB_FAMILY = 2, | |
236 | NAME_UNIQUE_FONT_ID = 3, | |
237 | NAME_FULL_FONT_NAME = 4, | |
238 | NAME_VERSION_STRING = 5, | |
239 | NAME_POSTSCRIPT_NAME = 6, | |
240 | NAME_TRADEMARK = 7, | |
241 | NAME_MANUFACTURER = 8, | |
242 | NAME_DESIGNER = 9, | |
243 | NAME_DESCRIPTION = 10, | |
244 | NAME_VENDOR_URL = 11, | |
245 | NAME_DESIGNER_URL = 12, | |
246 | NAME_LICENSE_DESCRIPTION = 13, | |
247 | NAME_LICENSE_URL = 14, | |
248 | NAME_RESERVED = 15, | |
249 | NAME_PREFERRED_FAMILY = 16, | |
250 | NAME_PREFERRED_SUB_FAMILY = 17, | |
251 | NAME_COMPATIBLE_FULL = 18, | |
252 | NAME_SAMPLE_TEXT = 19, | |
253 | NAME_POSTSCRIPT_CID = 20 | |
254 | }; | |
255 | ||
256 | struct NameRecord | |
257 | { | |
258 | le_uint16 platformID; | |
259 | le_uint16 encodingID; | |
260 | le_uint16 languageID; | |
261 | le_uint16 nameID; | |
262 | le_uint16 length; | |
263 | le_uint16 offset; | |
264 | }; | |
265 | ||
266 | struct NAMETable | |
267 | { | |
268 | le_uint16 version; | |
269 | le_uint16 count; | |
270 | le_uint16 stringOffset; | |
271 | NameRecord nameRecords[ANY_NUMBER]; | |
272 | }; | |
273 | ||
b75a7d8f A |
274 | #endif |
275 |