OLD | NEW |
| (Empty) |
1 /***************************************************************************/ | |
2 /* */ | |
3 /* tttypes.h */ | |
4 /* */ | |
5 /* Basic SFNT/TrueType type definitions and interface (specification */ | |
6 /* only). */ | |
7 /* */ | |
8 /* Copyright 1996-2002, 2004-2008, 2012-2013 by */ | |
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | |
10 /* */ | |
11 /* This file is part of the FreeType project, and may only be used, */ | |
12 /* modified, and distributed under the terms of the FreeType project */ | |
13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | |
14 /* this file you indicate that you have read the license and */ | |
15 /* understand and accept it fully. */ | |
16 /* */ | |
17 /***************************************************************************/ | |
18 | |
19 | |
20 #ifndef __TTTYPES_H__ | |
21 #define __TTTYPES_H__ | |
22 | |
23 | |
24 #include <ft2build.h> | |
25 #include FT_TRUETYPE_TABLES_H | |
26 #include FT_INTERNAL_OBJECTS_H | |
27 | |
28 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT | |
29 #include FT_MULTIPLE_MASTERS_H | |
30 #endif | |
31 | |
32 | |
33 FT_BEGIN_HEADER | |
34 | |
35 | |
36 /*************************************************************************/ | |
37 /*************************************************************************/ | |
38 /*************************************************************************/ | |
39 /*** ***/ | |
40 /*** ***/ | |
41 /*** REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/ | |
42 /*** ***/ | |
43 /*** ***/ | |
44 /*************************************************************************/ | |
45 /*************************************************************************/ | |
46 /*************************************************************************/ | |
47 | |
48 | |
49 /*************************************************************************/ | |
50 /* */ | |
51 /* <Struct> */ | |
52 /* TTC_HeaderRec */ | |
53 /* */ | |
54 /* <Description> */ | |
55 /* TrueType collection header. This table contains the offsets of */ | |
56 /* the font headers of each distinct TrueType face in the file. */ | |
57 /* */ | |
58 /* <Fields> */ | |
59 /* tag :: Must be `ttc ' to indicate a TrueType collection. */ | |
60 /* */ | |
61 /* version :: The version number. */ | |
62 /* */ | |
63 /* count :: The number of faces in the collection. The */ | |
64 /* specification says this should be an unsigned long, but */ | |
65 /* we use a signed long since we need the value -1 for */ | |
66 /* specific purposes. */ | |
67 /* */ | |
68 /* offsets :: The offsets of the font headers, one per face. */ | |
69 /* */ | |
70 typedef struct TTC_HeaderRec_ | |
71 { | |
72 FT_ULong tag; | |
73 FT_Fixed version; | |
74 FT_Long count; | |
75 FT_ULong* offsets; | |
76 | |
77 } TTC_HeaderRec; | |
78 | |
79 | |
80 /*************************************************************************/ | |
81 /* */ | |
82 /* <Struct> */ | |
83 /* SFNT_HeaderRec */ | |
84 /* */ | |
85 /* <Description> */ | |
86 /* SFNT file format header. */ | |
87 /* */ | |
88 /* <Fields> */ | |
89 /* format_tag :: The font format tag. */ | |
90 /* */ | |
91 /* num_tables :: The number of tables in file. */ | |
92 /* */ | |
93 /* search_range :: Must be `16 * (max power of 2 <= num_tables)'. */ | |
94 /* */ | |
95 /* entry_selector :: Must be log2 of `search_range / 16'. */ | |
96 /* */ | |
97 /* range_shift :: Must be `num_tables * 16 - search_range'. */ | |
98 /* */ | |
99 typedef struct SFNT_HeaderRec_ | |
100 { | |
101 FT_ULong format_tag; | |
102 FT_UShort num_tables; | |
103 FT_UShort search_range; | |
104 FT_UShort entry_selector; | |
105 FT_UShort range_shift; | |
106 | |
107 FT_ULong offset; /* not in file */ | |
108 | |
109 } SFNT_HeaderRec, *SFNT_Header; | |
110 | |
111 | |
112 /*************************************************************************/ | |
113 /* */ | |
114 /* <Struct> */ | |
115 /* TT_TableRec */ | |
116 /* */ | |
117 /* <Description> */ | |
118 /* This structure describes a given table of a TrueType font. */ | |
119 /* */ | |
120 /* <Fields> */ | |
121 /* Tag :: A four-bytes tag describing the table. */ | |
122 /* */ | |
123 /* CheckSum :: The table checksum. This value can be ignored. */ | |
124 /* */ | |
125 /* Offset :: The offset of the table from the start of the TrueType */ | |
126 /* font in its resource. */ | |
127 /* */ | |
128 /* Length :: The table length (in bytes). */ | |
129 /* */ | |
130 typedef struct TT_TableRec_ | |
131 { | |
132 FT_ULong Tag; /* table type */ | |
133 FT_ULong CheckSum; /* table checksum */ | |
134 FT_ULong Offset; /* table file offset */ | |
135 FT_ULong Length; /* table length */ | |
136 | |
137 } TT_TableRec, *TT_Table; | |
138 | |
139 | |
140 /*************************************************************************/ | |
141 /* */ | |
142 /* <Struct> */ | |
143 /* WOFF_HeaderRec */ | |
144 /* */ | |
145 /* <Description> */ | |
146 /* WOFF file format header. */ | |
147 /* */ | |
148 /* <Fields> */ | |
149 /* See */ | |
150 /* */ | |
151 /* http://www.w3.org/TR/WOFF/#WOFFHeader */ | |
152 /* */ | |
153 typedef struct WOFF_HeaderRec_ | |
154 { | |
155 FT_ULong signature; | |
156 FT_ULong flavor; | |
157 FT_ULong length; | |
158 FT_UShort num_tables; | |
159 FT_UShort reserved; | |
160 FT_ULong totalSfntSize; | |
161 FT_UShort majorVersion; | |
162 FT_UShort minorVersion; | |
163 FT_ULong metaOffset; | |
164 FT_ULong metaLength; | |
165 FT_ULong metaOrigLength; | |
166 FT_ULong privOffset; | |
167 FT_ULong privLength; | |
168 | |
169 } WOFF_HeaderRec, *WOFF_Header; | |
170 | |
171 | |
172 /*************************************************************************/ | |
173 /* */ | |
174 /* <Struct> */ | |
175 /* WOFF_TableRec */ | |
176 /* */ | |
177 /* <Description> */ | |
178 /* This structure describes a given table of a WOFF font. */ | |
179 /* */ | |
180 /* <Fields> */ | |
181 /* Tag :: A four-bytes tag describing the table. */ | |
182 /* */ | |
183 /* Offset :: The offset of the table from the start of the WOFF */ | |
184 /* font in its resource. */ | |
185 /* */ | |
186 /* CompLength :: Compressed table length (in bytes). */ | |
187 /* */ | |
188 /* OrigLength :: Unompressed table length (in bytes). */ | |
189 /* */ | |
190 /* CheckSum :: The table checksum. This value can be ignored. */ | |
191 /* */ | |
192 /* OrigOffset :: The uncompressed table file offset. This value gets */ | |
193 /* computed while constructing the (uncompressed) SFNT */ | |
194 /* header. It is not contained in the WOFF file. */ | |
195 /* */ | |
196 typedef struct WOFF_TableRec_ | |
197 { | |
198 FT_ULong Tag; /* table ID */ | |
199 FT_ULong Offset; /* table file offset */ | |
200 FT_ULong CompLength; /* compressed table length */ | |
201 FT_ULong OrigLength; /* uncompressed table length */ | |
202 FT_ULong CheckSum; /* uncompressed checksum */ | |
203 | |
204 FT_ULong OrigOffset; /* uncompressed table file offset */ | |
205 /* (not in the WOFF file) */ | |
206 } WOFF_TableRec, *WOFF_Table; | |
207 | |
208 | |
209 /*************************************************************************/ | |
210 /* */ | |
211 /* <Struct> */ | |
212 /* TT_LongMetricsRec */ | |
213 /* */ | |
214 /* <Description> */ | |
215 /* A structure modeling the long metrics of the `hmtx' and `vmtx' */ | |
216 /* TrueType tables. The values are expressed in font units. */ | |
217 /* */ | |
218 /* <Fields> */ | |
219 /* advance :: The advance width or height for the glyph. */ | |
220 /* */ | |
221 /* bearing :: The left-side or top-side bearing for the glyph. */ | |
222 /* */ | |
223 typedef struct TT_LongMetricsRec_ | |
224 { | |
225 FT_UShort advance; | |
226 FT_Short bearing; | |
227 | |
228 } TT_LongMetricsRec, *TT_LongMetrics; | |
229 | |
230 | |
231 /*************************************************************************/ | |
232 /* */ | |
233 /* <Type> */ | |
234 /* TT_ShortMetrics */ | |
235 /* */ | |
236 /* <Description> */ | |
237 /* A simple type to model the short metrics of the `hmtx' and `vmtx' */ | |
238 /* tables. */ | |
239 /* */ | |
240 typedef FT_Short TT_ShortMetrics; | |
241 | |
242 | |
243 /*************************************************************************/ | |
244 /* */ | |
245 /* <Struct> */ | |
246 /* TT_NameEntryRec */ | |
247 /* */ | |
248 /* <Description> */ | |
249 /* A structure modeling TrueType name records. Name records are used */ | |
250 /* to store important strings like family name, style name, */ | |
251 /* copyright, etc. in _localized_ versions (i.e., language, encoding, */ | |
252 /* etc). */ | |
253 /* */ | |
254 /* <Fields> */ | |
255 /* platformID :: The ID of the name's encoding platform. */ | |
256 /* */ | |
257 /* encodingID :: The platform-specific ID for the name's encoding. */ | |
258 /* */ | |
259 /* languageID :: The platform-specific ID for the name's language. */ | |
260 /* */ | |
261 /* nameID :: The ID specifying what kind of name this is. */ | |
262 /* */ | |
263 /* stringLength :: The length of the string in bytes. */ | |
264 /* */ | |
265 /* stringOffset :: The offset to the string in the `name' table. */ | |
266 /* */ | |
267 /* string :: A pointer to the string's bytes. Note that these */ | |
268 /* are usually UTF-16 encoded characters. */ | |
269 /* */ | |
270 typedef struct TT_NameEntryRec_ | |
271 { | |
272 FT_UShort platformID; | |
273 FT_UShort encodingID; | |
274 FT_UShort languageID; | |
275 FT_UShort nameID; | |
276 FT_UShort stringLength; | |
277 FT_ULong stringOffset; | |
278 | |
279 /* this last field is not defined in the spec */ | |
280 /* but used by the FreeType engine */ | |
281 | |
282 FT_Byte* string; | |
283 | |
284 } TT_NameEntryRec, *TT_NameEntry; | |
285 | |
286 | |
287 /*************************************************************************/ | |
288 /* */ | |
289 /* <Struct> */ | |
290 /* TT_NameTableRec */ | |
291 /* */ | |
292 /* <Description> */ | |
293 /* A structure modeling the TrueType name table. */ | |
294 /* */ | |
295 /* <Fields> */ | |
296 /* format :: The format of the name table. */ | |
297 /* */ | |
298 /* numNameRecords :: The number of names in table. */ | |
299 /* */ | |
300 /* storageOffset :: The offset of the name table in the `name' */ | |
301 /* TrueType table. */ | |
302 /* */ | |
303 /* names :: An array of name records. */ | |
304 /* */ | |
305 /* stream :: the file's input stream. */ | |
306 /* */ | |
307 typedef struct TT_NameTableRec_ | |
308 { | |
309 FT_UShort format; | |
310 FT_UInt numNameRecords; | |
311 FT_UInt storageOffset; | |
312 TT_NameEntryRec* names; | |
313 FT_Stream stream; | |
314 | |
315 } TT_NameTableRec, *TT_NameTable; | |
316 | |
317 | |
318 /*************************************************************************/ | |
319 /*************************************************************************/ | |
320 /*************************************************************************/ | |
321 /*** ***/ | |
322 /*** ***/ | |
323 /*** OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/ | |
324 /*** ***/ | |
325 /*** ***/ | |
326 /*************************************************************************/ | |
327 /*************************************************************************/ | |
328 /*************************************************************************/ | |
329 | |
330 | |
331 /*************************************************************************/ | |
332 /* */ | |
333 /* <Struct> */ | |
334 /* TT_GaspRangeRec */ | |
335 /* */ | |
336 /* <Description> */ | |
337 /* A tiny structure used to model a gasp range according to the */ | |
338 /* TrueType specification. */ | |
339 /* */ | |
340 /* <Fields> */ | |
341 /* maxPPEM :: The maximum ppem value to which `gaspFlag' applies. */ | |
342 /* */ | |
343 /* gaspFlag :: A flag describing the grid-fitting and anti-aliasing */ | |
344 /* modes to be used. */ | |
345 /* */ | |
346 typedef struct TT_GaspRangeRec_ | |
347 { | |
348 FT_UShort maxPPEM; | |
349 FT_UShort gaspFlag; | |
350 | |
351 } TT_GaspRangeRec, *TT_GaspRange; | |
352 | |
353 | |
354 #define TT_GASP_GRIDFIT 0x01 | |
355 #define TT_GASP_DOGRAY 0x02 | |
356 | |
357 | |
358 /*************************************************************************/ | |
359 /* */ | |
360 /* <Struct> */ | |
361 /* TT_GaspRec */ | |
362 /* */ | |
363 /* <Description> */ | |
364 /* A structure modeling the TrueType `gasp' table used to specify */ | |
365 /* grid-fitting and anti-aliasing behaviour. */ | |
366 /* */ | |
367 /* <Fields> */ | |
368 /* version :: The version number. */ | |
369 /* */ | |
370 /* numRanges :: The number of gasp ranges in table. */ | |
371 /* */ | |
372 /* gaspRanges :: An array of gasp ranges. */ | |
373 /* */ | |
374 typedef struct TT_Gasp_ | |
375 { | |
376 FT_UShort version; | |
377 FT_UShort numRanges; | |
378 TT_GaspRange gaspRanges; | |
379 | |
380 } TT_GaspRec; | |
381 | |
382 | |
383 /*************************************************************************/ | |
384 /*************************************************************************/ | |
385 /*************************************************************************/ | |
386 /*** ***/ | |
387 /*** ***/ | |
388 /*** EMBEDDED BITMAPS SUPPORT ***/ | |
389 /*** ***/ | |
390 /*** ***/ | |
391 /*************************************************************************/ | |
392 /*************************************************************************/ | |
393 /*************************************************************************/ | |
394 | |
395 | |
396 /*************************************************************************/ | |
397 /* */ | |
398 /* <Struct> */ | |
399 /* TT_SBit_MetricsRec */ | |
400 /* */ | |
401 /* <Description> */ | |
402 /* A structure used to hold the big metrics of a given glyph bitmap */ | |
403 /* in a TrueType or OpenType font. These are usually found in the */ | |
404 /* `EBDT' (Microsoft) or `bloc' (Apple) table. */ | |
405 /* */ | |
406 /* <Fields> */ | |
407 /* height :: The glyph height in pixels. */ | |
408 /* */ | |
409 /* width :: The glyph width in pixels. */ | |
410 /* */ | |
411 /* horiBearingX :: The horizontal left bearing. */ | |
412 /* */ | |
413 /* horiBearingY :: The horizontal top bearing. */ | |
414 /* */ | |
415 /* horiAdvance :: The horizontal advance. */ | |
416 /* */ | |
417 /* vertBearingX :: The vertical left bearing. */ | |
418 /* */ | |
419 /* vertBearingY :: The vertical top bearing. */ | |
420 /* */ | |
421 /* vertAdvance :: The vertical advance. */ | |
422 /* */ | |
423 typedef struct TT_SBit_MetricsRec_ | |
424 { | |
425 FT_UShort height; | |
426 FT_UShort width; | |
427 | |
428 FT_Short horiBearingX; | |
429 FT_Short horiBearingY; | |
430 FT_UShort horiAdvance; | |
431 | |
432 FT_Short vertBearingX; | |
433 FT_Short vertBearingY; | |
434 FT_UShort vertAdvance; | |
435 | |
436 } TT_SBit_MetricsRec, *TT_SBit_Metrics; | |
437 | |
438 | |
439 /*************************************************************************/ | |
440 /* */ | |
441 /* <Struct> */ | |
442 /* TT_SBit_SmallMetricsRec */ | |
443 /* */ | |
444 /* <Description> */ | |
445 /* A structure used to hold the small metrics of a given glyph bitmap */ | |
446 /* in a TrueType or OpenType font. These are usually found in the */ | |
447 /* `EBDT' (Microsoft) or the `bdat' (Apple) table. */ | |
448 /* */ | |
449 /* <Fields> */ | |
450 /* height :: The glyph height in pixels. */ | |
451 /* */ | |
452 /* width :: The glyph width in pixels. */ | |
453 /* */ | |
454 /* bearingX :: The left-side bearing. */ | |
455 /* */ | |
456 /* bearingY :: The top-side bearing. */ | |
457 /* */ | |
458 /* advance :: The advance width or height. */ | |
459 /* */ | |
460 typedef struct TT_SBit_Small_Metrics_ | |
461 { | |
462 FT_Byte height; | |
463 FT_Byte width; | |
464 | |
465 FT_Char bearingX; | |
466 FT_Char bearingY; | |
467 FT_Byte advance; | |
468 | |
469 } TT_SBit_SmallMetricsRec, *TT_SBit_SmallMetrics; | |
470 | |
471 | |
472 /*************************************************************************/ | |
473 /* */ | |
474 /* <Struct> */ | |
475 /* TT_SBit_LineMetricsRec */ | |
476 /* */ | |
477 /* <Description> */ | |
478 /* A structure used to describe the text line metrics of a given */ | |
479 /* bitmap strike, for either a horizontal or vertical layout. */ | |
480 /* */ | |
481 /* <Fields> */ | |
482 /* ascender :: The ascender in pixels. */ | |
483 /* */ | |
484 /* descender :: The descender in pixels. */ | |
485 /* */ | |
486 /* max_width :: The maximum glyph width in pixels. */ | |
487 /* */ | |
488 /* caret_slope_enumerator :: Rise of the caret slope, typically set */ | |
489 /* to 1 for non-italic fonts. */ | |
490 /* */ | |
491 /* caret_slope_denominator :: Rise of the caret slope, typically set */ | |
492 /* to 0 for non-italic fonts. */ | |
493 /* */ | |
494 /* caret_offset :: Offset in pixels to move the caret for */ | |
495 /* proper positioning. */ | |
496 /* */ | |
497 /* min_origin_SB :: Minimum of horiBearingX (resp. */ | |
498 /* vertBearingY). */ | |
499 /* min_advance_SB :: Minimum of */ | |
500 /* */ | |
501 /* horizontal advance - */ | |
502 /* ( horiBearingX + width ) */ | |
503 /* */ | |
504 /* resp. */ | |
505 /* */ | |
506 /* vertical advance - */ | |
507 /* ( vertBearingY + height ) */ | |
508 /* */ | |
509 /* max_before_BL :: Maximum of horiBearingY (resp. */ | |
510 /* vertBearingY). */ | |
511 /* */ | |
512 /* min_after_BL :: Minimum of */ | |
513 /* */ | |
514 /* horiBearingY - height */ | |
515 /* */ | |
516 /* resp. */ | |
517 /* */ | |
518 /* vertBearingX - width */ | |
519 /* */ | |
520 /* pads :: Unused (to make the size of the record */ | |
521 /* a multiple of 32 bits. */ | |
522 /* */ | |
523 typedef struct TT_SBit_LineMetricsRec_ | |
524 { | |
525 FT_Char ascender; | |
526 FT_Char descender; | |
527 FT_Byte max_width; | |
528 FT_Char caret_slope_numerator; | |
529 FT_Char caret_slope_denominator; | |
530 FT_Char caret_offset; | |
531 FT_Char min_origin_SB; | |
532 FT_Char min_advance_SB; | |
533 FT_Char max_before_BL; | |
534 FT_Char min_after_BL; | |
535 FT_Char pads[2]; | |
536 | |
537 } TT_SBit_LineMetricsRec, *TT_SBit_LineMetrics; | |
538 | |
539 | |
540 /*************************************************************************/ | |
541 /* */ | |
542 /* <Struct> */ | |
543 /* TT_SBit_RangeRec */ | |
544 /* */ | |
545 /* <Description> */ | |
546 /* A TrueType/OpenType subIndexTable as defined in the `EBLC' */ | |
547 /* (Microsoft) or `bloc' (Apple) tables. */ | |
548 /* */ | |
549 /* <Fields> */ | |
550 /* first_glyph :: The first glyph index in the range. */ | |
551 /* */ | |
552 /* last_glyph :: The last glyph index in the range. */ | |
553 /* */ | |
554 /* index_format :: The format of index table. Valid values are 1 */ | |
555 /* to 5. */ | |
556 /* */ | |
557 /* image_format :: The format of `EBDT' image data. */ | |
558 /* */ | |
559 /* image_offset :: The offset to image data in `EBDT'. */ | |
560 /* */ | |
561 /* image_size :: For index formats 2 and 5. This is the size in */ | |
562 /* bytes of each glyph bitmap. */ | |
563 /* */ | |
564 /* big_metrics :: For index formats 2 and 5. This is the big */ | |
565 /* metrics for each glyph bitmap. */ | |
566 /* */ | |
567 /* num_glyphs :: For index formats 4 and 5. This is the number of */ | |
568 /* glyphs in the code array. */ | |
569 /* */ | |
570 /* glyph_offsets :: For index formats 1 and 3. */ | |
571 /* */ | |
572 /* glyph_codes :: For index formats 4 and 5. */ | |
573 /* */ | |
574 /* table_offset :: The offset of the index table in the `EBLC' */ | |
575 /* table. Only used during strike loading. */ | |
576 /* */ | |
577 typedef struct TT_SBit_RangeRec_ | |
578 { | |
579 FT_UShort first_glyph; | |
580 FT_UShort last_glyph; | |
581 | |
582 FT_UShort index_format; | |
583 FT_UShort image_format; | |
584 FT_ULong image_offset; | |
585 | |
586 FT_ULong image_size; | |
587 TT_SBit_MetricsRec metrics; | |
588 FT_ULong num_glyphs; | |
589 | |
590 FT_ULong* glyph_offsets; | |
591 FT_UShort* glyph_codes; | |
592 | |
593 FT_ULong table_offset; | |
594 | |
595 } TT_SBit_RangeRec, *TT_SBit_Range; | |
596 | |
597 | |
598 /*************************************************************************/ | |
599 /* */ | |
600 /* <Struct> */ | |
601 /* TT_SBit_StrikeRec */ | |
602 /* */ | |
603 /* <Description> */ | |
604 /* A structure used describe a given bitmap strike in the `EBLC' */ | |
605 /* (Microsoft) or `bloc' (Apple) tables. */ | |
606 /* */ | |
607 /* <Fields> */ | |
608 /* num_index_ranges :: The number of index ranges. */ | |
609 /* */ | |
610 /* index_ranges :: An array of glyph index ranges. */ | |
611 /* */ | |
612 /* color_ref :: Unused. `color_ref' is put in for future */ | |
613 /* enhancements, but these fields are already */ | |
614 /* in use by other platforms (e.g. Newton). */ | |
615 /* For details, please see */ | |
616 /* */ | |
617 /* http://fonts.apple.com/ */ | |
618 /* TTRefMan/RM06/Chap6bloc.html */ | |
619 /* */ | |
620 /* hori :: The line metrics for horizontal layouts. */ | |
621 /* */ | |
622 /* vert :: The line metrics for vertical layouts. */ | |
623 /* */ | |
624 /* start_glyph :: The lowest glyph index for this strike. */ | |
625 /* */ | |
626 /* end_glyph :: The highest glyph index for this strike. */ | |
627 /* */ | |
628 /* x_ppem :: The number of horizontal pixels per EM. */ | |
629 /* */ | |
630 /* y_ppem :: The number of vertical pixels per EM. */ | |
631 /* */ | |
632 /* bit_depth :: The bit depth. Valid values are 1, 2, 4, */ | |
633 /* and 8. */ | |
634 /* */ | |
635 /* flags :: Is this a vertical or horizontal strike? For */ | |
636 /* details, please see */ | |
637 /* */ | |
638 /* http://fonts.apple.com/ */ | |
639 /* TTRefMan/RM06/Chap6bloc.html */ | |
640 /* */ | |
641 typedef struct TT_SBit_StrikeRec_ | |
642 { | |
643 FT_Int num_ranges; | |
644 TT_SBit_Range sbit_ranges; | |
645 FT_ULong ranges_offset; | |
646 | |
647 FT_ULong color_ref; | |
648 | |
649 TT_SBit_LineMetricsRec hori; | |
650 TT_SBit_LineMetricsRec vert; | |
651 | |
652 FT_UShort start_glyph; | |
653 FT_UShort end_glyph; | |
654 | |
655 FT_Byte x_ppem; | |
656 FT_Byte y_ppem; | |
657 | |
658 FT_Byte bit_depth; | |
659 FT_Char flags; | |
660 | |
661 } TT_SBit_StrikeRec, *TT_SBit_Strike; | |
662 | |
663 | |
664 /*************************************************************************/ | |
665 /* */ | |
666 /* <Struct> */ | |
667 /* TT_SBit_ComponentRec */ | |
668 /* */ | |
669 /* <Description> */ | |
670 /* A simple structure to describe a compound sbit element. */ | |
671 /* */ | |
672 /* <Fields> */ | |
673 /* glyph_code :: The element's glyph index. */ | |
674 /* */ | |
675 /* x_offset :: The element's left bearing. */ | |
676 /* */ | |
677 /* y_offset :: The element's top bearing. */ | |
678 /* */ | |
679 typedef struct TT_SBit_ComponentRec_ | |
680 { | |
681 FT_UShort glyph_code; | |
682 FT_Char x_offset; | |
683 FT_Char y_offset; | |
684 | |
685 } TT_SBit_ComponentRec, *TT_SBit_Component; | |
686 | |
687 | |
688 /*************************************************************************/ | |
689 /* */ | |
690 /* <Struct> */ | |
691 /* TT_SBit_ScaleRec */ | |
692 /* */ | |
693 /* <Description> */ | |
694 /* A structure used describe a given bitmap scaling table, as defined */ | |
695 /* in the `EBSC' table. */ | |
696 /* */ | |
697 /* <Fields> */ | |
698 /* hori :: The horizontal line metrics. */ | |
699 /* */ | |
700 /* vert :: The vertical line metrics. */ | |
701 /* */ | |
702 /* x_ppem :: The number of horizontal pixels per EM. */ | |
703 /* */ | |
704 /* y_ppem :: The number of vertical pixels per EM. */ | |
705 /* */ | |
706 /* x_ppem_substitute :: Substitution x_ppem value. */ | |
707 /* */ | |
708 /* y_ppem_substitute :: Substitution y_ppem value. */ | |
709 /* */ | |
710 typedef struct TT_SBit_ScaleRec_ | |
711 { | |
712 TT_SBit_LineMetricsRec hori; | |
713 TT_SBit_LineMetricsRec vert; | |
714 | |
715 FT_Byte x_ppem; | |
716 FT_Byte y_ppem; | |
717 | |
718 FT_Byte x_ppem_substitute; | |
719 FT_Byte y_ppem_substitute; | |
720 | |
721 } TT_SBit_ScaleRec, *TT_SBit_Scale; | |
722 | |
723 | |
724 /*************************************************************************/ | |
725 /*************************************************************************/ | |
726 /*************************************************************************/ | |
727 /*** ***/ | |
728 /*** ***/ | |
729 /*** POSTSCRIPT GLYPH NAMES SUPPORT ***/ | |
730 /*** ***/ | |
731 /*** ***/ | |
732 /*************************************************************************/ | |
733 /*************************************************************************/ | |
734 /*************************************************************************/ | |
735 | |
736 | |
737 /*************************************************************************/ | |
738 /* */ | |
739 /* <Struct> */ | |
740 /* TT_Post_20Rec */ | |
741 /* */ | |
742 /* <Description> */ | |
743 /* Postscript names sub-table, format 2.0. Stores the PS name of */ | |
744 /* each glyph in the font face. */ | |
745 /* */ | |
746 /* <Fields> */ | |
747 /* num_glyphs :: The number of named glyphs in the table. */ | |
748 /* */ | |
749 /* num_names :: The number of PS names stored in the table. */ | |
750 /* */ | |
751 /* glyph_indices :: The indices of the glyphs in the names arrays. */ | |
752 /* */ | |
753 /* glyph_names :: The PS names not in Mac Encoding. */ | |
754 /* */ | |
755 typedef struct TT_Post_20Rec_ | |
756 { | |
757 FT_UShort num_glyphs; | |
758 FT_UShort num_names; | |
759 FT_UShort* glyph_indices; | |
760 FT_Char** glyph_names; | |
761 | |
762 } TT_Post_20Rec, *TT_Post_20; | |
763 | |
764 | |
765 /*************************************************************************/ | |
766 /* */ | |
767 /* <Struct> */ | |
768 /* TT_Post_25Rec */ | |
769 /* */ | |
770 /* <Description> */ | |
771 /* Postscript names sub-table, format 2.5. Stores the PS name of */ | |
772 /* each glyph in the font face. */ | |
773 /* */ | |
774 /* <Fields> */ | |
775 /* num_glyphs :: The number of glyphs in the table. */ | |
776 /* */ | |
777 /* offsets :: An array of signed offsets in a normal Mac */ | |
778 /* Postscript name encoding. */ | |
779 /* */ | |
780 typedef struct TT_Post_25_ | |
781 { | |
782 FT_UShort num_glyphs; | |
783 FT_Char* offsets; | |
784 | |
785 } TT_Post_25Rec, *TT_Post_25; | |
786 | |
787 | |
788 /*************************************************************************/ | |
789 /* */ | |
790 /* <Struct> */ | |
791 /* TT_Post_NamesRec */ | |
792 /* */ | |
793 /* <Description> */ | |
794 /* Postscript names table, either format 2.0 or 2.5. */ | |
795 /* */ | |
796 /* <Fields> */ | |
797 /* loaded :: A flag to indicate whether the PS names are loaded. */ | |
798 /* */ | |
799 /* format_20 :: The sub-table used for format 2.0. */ | |
800 /* */ | |
801 /* format_25 :: The sub-table used for format 2.5. */ | |
802 /* */ | |
803 typedef struct TT_Post_NamesRec_ | |
804 { | |
805 FT_Bool loaded; | |
806 | |
807 union | |
808 { | |
809 TT_Post_20Rec format_20; | |
810 TT_Post_25Rec format_25; | |
811 | |
812 } names; | |
813 | |
814 } TT_Post_NamesRec, *TT_Post_Names; | |
815 | |
816 | |
817 /*************************************************************************/ | |
818 /*************************************************************************/ | |
819 /*************************************************************************/ | |
820 /*** ***/ | |
821 /*** ***/ | |
822 /*** GX VARIATION TABLE SUPPORT ***/ | |
823 /*** ***/ | |
824 /*** ***/ | |
825 /*************************************************************************/ | |
826 /*************************************************************************/ | |
827 /*************************************************************************/ | |
828 | |
829 | |
830 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT | |
831 typedef struct GX_BlendRec_ *GX_Blend; | |
832 #endif | |
833 | |
834 /*************************************************************************/ | |
835 /*************************************************************************/ | |
836 /*************************************************************************/ | |
837 /*** ***/ | |
838 /*** ***/ | |
839 /*** EMBEDDED BDF PROPERTIES TABLE SUPPORT ***/ | |
840 /*** ***/ | |
841 /*** ***/ | |
842 /*************************************************************************/ | |
843 /*************************************************************************/ | |
844 /*************************************************************************/ | |
845 | |
846 /* | |
847 * These types are used to support a `BDF ' table that isn't part of the | |
848 * official TrueType specification. It is mainly used in SFNT-based | |
849 * bitmap fonts that were generated from a set of BDF fonts. | |
850 * | |
851 * The format of the table is as follows. | |
852 * | |
853 * USHORT version `BDF ' table version number, should be 0x0001. | |
854 * USHORT strikeCount Number of strikes (bitmap sizes) in this table. | |
855 * ULONG stringTable Offset (from start of BDF table) to string | |
856 * table. | |
857 * | |
858 * This is followed by an array of `strikeCount' descriptors, having the | |
859 * following format. | |
860 * | |
861 * USHORT ppem Vertical pixels per EM for this strike. | |
862 * USHORT numItems Number of items for this strike (properties and | |
863 * atoms). Maximum is 255. | |
864 * | |
865 * This array in turn is followed by `strikeCount' value sets. Each | |
866 * `value set' is an array of `numItems' items with the following format. | |
867 * | |
868 * ULONG item_name Offset in string table to item name. | |
869 * USHORT item_type The item type. Possible values are | |
870 * 0 => string (e.g., COMMENT) | |
871 * 1 => atom (e.g., FONT or even SIZE) | |
872 * 2 => int32 | |
873 * 3 => uint32 | |
874 * 0x10 => A flag to indicate a properties. This | |
875 * is ORed with the above values. | |
876 * ULONG item_value For strings => Offset into string table without | |
877 * the corresponding double quotes. | |
878 * For atoms => Offset into string table. | |
879 * For integers => Direct value. | |
880 * | |
881 * All strings in the string table consist of bytes and are | |
882 * zero-terminated. | |
883 * | |
884 */ | |
885 | |
886 #ifdef TT_CONFIG_OPTION_BDF | |
887 | |
888 typedef struct TT_BDFRec_ | |
889 { | |
890 FT_Byte* table; | |
891 FT_Byte* table_end; | |
892 FT_Byte* strings; | |
893 FT_ULong strings_size; | |
894 FT_UInt num_strikes; | |
895 FT_Bool loaded; | |
896 | |
897 } TT_BDFRec, *TT_BDF; | |
898 | |
899 #endif /* TT_CONFIG_OPTION_BDF */ | |
900 | |
901 /*************************************************************************/ | |
902 /*************************************************************************/ | |
903 /*************************************************************************/ | |
904 /*** ***/ | |
905 /*** ***/ | |
906 /*** ORIGINAL TT_FACE CLASS DEFINITION ***/ | |
907 /*** ***/ | |
908 /*** ***/ | |
909 /*************************************************************************/ | |
910 /*************************************************************************/ | |
911 /*************************************************************************/ | |
912 | |
913 | |
914 /*************************************************************************/ | |
915 /* */ | |
916 /* This structure/class is defined here because it is common to the */ | |
917 /* following formats: TTF, OpenType-TT, and OpenType-CFF. */ | |
918 /* */ | |
919 /* Note, however, that the classes TT_Size and TT_GlyphSlot are not */ | |
920 /* shared between font drivers, and are thus defined in `ttobjs.h'. */ | |
921 /* */ | |
922 /*************************************************************************/ | |
923 | |
924 | |
925 /*************************************************************************/ | |
926 /* */ | |
927 /* <Type> */ | |
928 /* TT_Face */ | |
929 /* */ | |
930 /* <Description> */ | |
931 /* A handle to a TrueType face/font object. A TT_Face encapsulates */ | |
932 /* the resolution and scaling independent parts of a TrueType font */ | |
933 /* resource. */ | |
934 /* */ | |
935 /* <Note> */ | |
936 /* The TT_Face structure is also used as a `parent class' for the */ | |
937 /* OpenType-CFF class (T2_Face). */ | |
938 /* */ | |
939 typedef struct TT_FaceRec_* TT_Face; | |
940 | |
941 | |
942 /* a function type used for the truetype bytecode interpreter hooks */ | |
943 typedef FT_Error | |
944 (*TT_Interpreter)( void* exec_context ); | |
945 | |
946 /* forward declaration */ | |
947 typedef struct TT_LoaderRec_* TT_Loader; | |
948 | |
949 | |
950 /*************************************************************************/ | |
951 /* */ | |
952 /* <FuncType> */ | |
953 /* TT_Loader_GotoTableFunc */ | |
954 /* */ | |
955 /* <Description> */ | |
956 /* Seeks a stream to the start of a given TrueType table. */ | |
957 /* */ | |
958 /* <Input> */ | |
959 /* face :: A handle to the target face object. */ | |
960 /* */ | |
961 /* tag :: A 4-byte tag used to name the table. */ | |
962 /* */ | |
963 /* stream :: The input stream. */ | |
964 /* */ | |
965 /* <Output> */ | |
966 /* length :: The length of the table in bytes. Set to 0 if not */ | |
967 /* needed. */ | |
968 /* */ | |
969 /* <Return> */ | |
970 /* FreeType error code. 0 means success. */ | |
971 /* */ | |
972 /* <Note> */ | |
973 /* The stream cursor must be at the font file's origin. */ | |
974 /* */ | |
975 typedef FT_Error | |
976 (*TT_Loader_GotoTableFunc)( TT_Face face, | |
977 FT_ULong tag, | |
978 FT_Stream stream, | |
979 FT_ULong* length ); | |
980 | |
981 | |
982 /*************************************************************************/ | |
983 /* */ | |
984 /* <FuncType> */ | |
985 /* TT_Loader_StartGlyphFunc */ | |
986 /* */ | |
987 /* <Description> */ | |
988 /* Seeks a stream to the start of a given glyph element, and opens a */ | |
989 /* frame for it. */ | |
990 /* */ | |
991 /* <Input> */ | |
992 /* loader :: The current TrueType glyph loader object. */ | |
993 /* */ | |
994 /* glyph index :: The index of the glyph to access. */ | |
995 /* */ | |
996 /* offset :: The offset of the glyph according to the */ | |
997 /* `locations' table. */ | |
998 /* */ | |
999 /* byte_count :: The size of the frame in bytes. */ | |
1000 /* */ | |
1001 /* <Return> */ | |
1002 /* FreeType error code. 0 means success. */ | |
1003 /* */ | |
1004 /* <Note> */ | |
1005 /* This function is normally equivalent to FT_STREAM_SEEK(offset) */ | |
1006 /* followed by FT_FRAME_ENTER(byte_count) with the loader's stream, */ | |
1007 /* but alternative formats (e.g. compressed ones) might use something */ | |
1008 /* different. */ | |
1009 /* */ | |
1010 typedef FT_Error | |
1011 (*TT_Loader_StartGlyphFunc)( TT_Loader loader, | |
1012 FT_UInt glyph_index, | |
1013 FT_ULong offset, | |
1014 FT_UInt byte_count ); | |
1015 | |
1016 | |
1017 /*************************************************************************/ | |
1018 /* */ | |
1019 /* <FuncType> */ | |
1020 /* TT_Loader_ReadGlyphFunc */ | |
1021 /* */ | |
1022 /* <Description> */ | |
1023 /* Reads one glyph element (its header, a simple glyph, or a */ | |
1024 /* composite) from the loader's current stream frame. */ | |
1025 /* */ | |
1026 /* <Input> */ | |
1027 /* loader :: The current TrueType glyph loader object. */ | |
1028 /* */ | |
1029 /* <Return> */ | |
1030 /* FreeType error code. 0 means success. */ | |
1031 /* */ | |
1032 typedef FT_Error | |
1033 (*TT_Loader_ReadGlyphFunc)( TT_Loader loader ); | |
1034 | |
1035 | |
1036 /*************************************************************************/ | |
1037 /* */ | |
1038 /* <FuncType> */ | |
1039 /* TT_Loader_EndGlyphFunc */ | |
1040 /* */ | |
1041 /* <Description> */ | |
1042 /* Closes the current loader stream frame for the glyph. */ | |
1043 /* */ | |
1044 /* <Input> */ | |
1045 /* loader :: The current TrueType glyph loader object. */ | |
1046 /* */ | |
1047 typedef void | |
1048 (*TT_Loader_EndGlyphFunc)( TT_Loader loader ); | |
1049 | |
1050 | |
1051 typedef enum TT_SbitTableType_ | |
1052 { | |
1053 TT_SBIT_TABLE_TYPE_NONE = 0, | |
1054 TT_SBIT_TABLE_TYPE_EBLC, /* `EBLC' (Microsoft), */ | |
1055 /* `bloc' (Apple) */ | |
1056 TT_SBIT_TABLE_TYPE_CBLC, /* `CBLC' (Google) */ | |
1057 TT_SBIT_TABLE_TYPE_SBIX, /* `sbix' (Apple) */ | |
1058 | |
1059 /* do not remove */ | |
1060 TT_SBIT_TABLE_TYPE_MAX | |
1061 | |
1062 } TT_SbitTableType; | |
1063 | |
1064 | |
1065 /*************************************************************************/ | |
1066 /* */ | |
1067 /* TrueType Face Type */ | |
1068 /* */ | |
1069 /* <Struct> */ | |
1070 /* TT_Face */ | |
1071 /* */ | |
1072 /* <Description> */ | |
1073 /* The TrueType face class. These objects model the resolution and */ | |
1074 /* point-size independent data found in a TrueType font file. */ | |
1075 /* */ | |
1076 /* <Fields> */ | |
1077 /* root :: The base FT_Face structure, managed by the */ | |
1078 /* base layer. */ | |
1079 /* */ | |
1080 /* ttc_header :: The TrueType collection header, used when */ | |
1081 /* the file is a `ttc' rather than a `ttf'. */ | |
1082 /* For ordinary font files, the field */ | |
1083 /* `ttc_header.count' is set to 0. */ | |
1084 /* */ | |
1085 /* format_tag :: The font format tag. */ | |
1086 /* */ | |
1087 /* num_tables :: The number of TrueType tables in this font */ | |
1088 /* file. */ | |
1089 /* */ | |
1090 /* dir_tables :: The directory of TrueType tables for this */ | |
1091 /* font file. */ | |
1092 /* */ | |
1093 /* header :: The font's font header (`head' table). */ | |
1094 /* Read on font opening. */ | |
1095 /* */ | |
1096 /* horizontal :: The font's horizontal header (`hhea' */ | |
1097 /* table). This field also contains the */ | |
1098 /* associated horizontal metrics table */ | |
1099 /* (`hmtx'). */ | |
1100 /* */ | |
1101 /* max_profile :: The font's maximum profile table. Read on */ | |
1102 /* font opening. Note that some maximum */ | |
1103 /* values cannot be taken directly from this */ | |
1104 /* table. We thus define additional fields */ | |
1105 /* below to hold the computed maxima. */ | |
1106 /* */ | |
1107 /* vertical_info :: A boolean which is set when the font file */ | |
1108 /* contains vertical metrics. If not, the */ | |
1109 /* value of the `vertical' field is */ | |
1110 /* undefined. */ | |
1111 /* */ | |
1112 /* vertical :: The font's vertical header (`vhea' table). */ | |
1113 /* This field also contains the associated */ | |
1114 /* vertical metrics table (`vmtx'), if found. */ | |
1115 /* IMPORTANT: The contents of this field is */ | |
1116 /* undefined if the `verticalInfo' field is */ | |
1117 /* unset. */ | |
1118 /* */ | |
1119 /* num_names :: The number of name records within this */ | |
1120 /* TrueType font. */ | |
1121 /* */ | |
1122 /* name_table :: The table of name records (`name'). */ | |
1123 /* */ | |
1124 /* os2 :: The font's OS/2 table (`OS/2'). */ | |
1125 /* */ | |
1126 /* postscript :: The font's PostScript table (`post' */ | |
1127 /* table). The PostScript glyph names are */ | |
1128 /* not loaded by the driver on face opening. */ | |
1129 /* See the `ttpost' module for more details. */ | |
1130 /* */ | |
1131 /* cmap_table :: Address of the face's `cmap' SFNT table */ | |
1132 /* in memory (it's an extracted frame). */ | |
1133 /* */ | |
1134 /* cmap_size :: The size in bytes of the `cmap_table' */ | |
1135 /* described above. */ | |
1136 /* */ | |
1137 /* goto_table :: A function called by each TrueType table */ | |
1138 /* loader to position a stream's cursor to */ | |
1139 /* the start of a given table according to */ | |
1140 /* its tag. It defaults to TT_Goto_Face but */ | |
1141 /* can be different for strange formats (e.g. */ | |
1142 /* Type 42). */ | |
1143 /* */ | |
1144 /* access_glyph_frame :: A function used to access the frame of a */ | |
1145 /* given glyph within the face's font file. */ | |
1146 /* */ | |
1147 /* forget_glyph_frame :: A function used to forget the frame of a */ | |
1148 /* given glyph when all data has been loaded. */ | |
1149 /* */ | |
1150 /* read_glyph_header :: A function used to read a glyph header. */ | |
1151 /* It must be called between an `access' and */ | |
1152 /* `forget'. */ | |
1153 /* */ | |
1154 /* read_simple_glyph :: A function used to read a simple glyph. */ | |
1155 /* It must be called after the header was */ | |
1156 /* read, and before the `forget'. */ | |
1157 /* */ | |
1158 /* read_composite_glyph :: A function used to read a composite glyph. */ | |
1159 /* It must be called after the header was */ | |
1160 /* read, and before the `forget'. */ | |
1161 /* */ | |
1162 /* sfnt :: A pointer to the SFNT service. */ | |
1163 /* */ | |
1164 /* psnames :: A pointer to the PostScript names service. */ | |
1165 /* */ | |
1166 /* hdmx :: The face's horizontal device metrics */ | |
1167 /* (`hdmx' table). This table is optional in */ | |
1168 /* TrueType/OpenType fonts. */ | |
1169 /* */ | |
1170 /* gasp :: The grid-fitting and scaling properties */ | |
1171 /* table (`gasp'). This table is optional in */ | |
1172 /* TrueType/OpenType fonts. */ | |
1173 /* */ | |
1174 /* pclt :: The `pclt' SFNT table. */ | |
1175 /* */ | |
1176 /* num_sbit_scales :: The number of sbit scales for this font. */ | |
1177 /* */ | |
1178 /* sbit_scales :: Array of sbit scales embedded in this */ | |
1179 /* font. This table is optional in a */ | |
1180 /* TrueType/OpenType font. */ | |
1181 /* */ | |
1182 /* postscript_names :: A table used to store the Postscript names */ | |
1183 /* of the glyphs for this font. See the */ | |
1184 /* file `ttconfig.h' for comments on the */ | |
1185 /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES option. */ | |
1186 /* */ | |
1187 /* num_locations :: The number of glyph locations in this */ | |
1188 /* TrueType file. This should be */ | |
1189 /* identical to the number of glyphs. */ | |
1190 /* Ignored for Type 2 fonts. */ | |
1191 /* */ | |
1192 /* glyph_locations :: An array of longs. These are offsets to */ | |
1193 /* glyph data within the `glyf' table. */ | |
1194 /* Ignored for Type 2 font faces. */ | |
1195 /* */ | |
1196 /* glyf_len :: The length of the `glyf' table. Needed */ | |
1197 /* for malformed `loca' tables. */ | |
1198 /* */ | |
1199 /* font_program_size :: Size in bytecodes of the face's font */ | |
1200 /* program. 0 if none defined. Ignored for */ | |
1201 /* Type 2 fonts. */ | |
1202 /* */ | |
1203 /* font_program :: The face's font program (bytecode stream) */ | |
1204 /* executed at load time, also used during */ | |
1205 /* glyph rendering. Comes from the `fpgm' */ | |
1206 /* table. Ignored for Type 2 font fonts. */ | |
1207 /* */ | |
1208 /* cvt_program_size :: The size in bytecodes of the face's cvt */ | |
1209 /* program. Ignored for Type 2 fonts. */ | |
1210 /* */ | |
1211 /* cvt_program :: The face's cvt program (bytecode stream) */ | |
1212 /* executed each time an instance/size is */ | |
1213 /* changed/reset. Comes from the `prep' */ | |
1214 /* table. Ignored for Type 2 fonts. */ | |
1215 /* */ | |
1216 /* cvt_size :: Size of the control value table (in */ | |
1217 /* entries). Ignored for Type 2 fonts. */ | |
1218 /* */ | |
1219 /* cvt :: The face's original control value table. */ | |
1220 /* Coordinates are expressed in unscaled font */ | |
1221 /* units. Comes from the `cvt ' table. */ | |
1222 /* Ignored for Type 2 fonts. */ | |
1223 /* */ | |
1224 /* num_kern_pairs :: The number of kerning pairs present in the */ | |
1225 /* font file. The engine only loads the */ | |
1226 /* first horizontal format 0 kern table it */ | |
1227 /* finds in the font file. Ignored for */ | |
1228 /* Type 2 fonts. */ | |
1229 /* */ | |
1230 /* kern_table_index :: The index of the kerning table in the font */ | |
1231 /* kerning directory. Ignored for Type 2 */ | |
1232 /* fonts. */ | |
1233 /* */ | |
1234 /* interpreter :: A pointer to the TrueType bytecode */ | |
1235 /* interpreters field is also used to hook */ | |
1236 /* the debugger in `ttdebug'. */ | |
1237 /* */ | |
1238 /* unpatented_hinting :: If true, use only unpatented methods in */ | |
1239 /* the bytecode interpreter. */ | |
1240 /* */ | |
1241 /* doblend :: A boolean which is set if the font should */ | |
1242 /* be blended (this is for GX var). */ | |
1243 /* */ | |
1244 /* blend :: Contains the data needed to control GX */ | |
1245 /* variation tables (rather like Multiple */ | |
1246 /* Master data). */ | |
1247 /* */ | |
1248 /* extra :: Reserved for third-party font drivers. */ | |
1249 /* */ | |
1250 /* postscript_name :: The PS name of the font. Used by the */ | |
1251 /* postscript name service. */ | |
1252 /* */ | |
1253 typedef struct TT_FaceRec_ | |
1254 { | |
1255 FT_FaceRec root; | |
1256 | |
1257 TTC_HeaderRec ttc_header; | |
1258 | |
1259 FT_ULong format_tag; | |
1260 FT_UShort num_tables; | |
1261 TT_Table dir_tables; | |
1262 | |
1263 TT_Header header; /* TrueType header table */ | |
1264 TT_HoriHeader horizontal; /* TrueType horizontal header */ | |
1265 | |
1266 TT_MaxProfile max_profile; | |
1267 | |
1268 FT_Bool vertical_info; | |
1269 TT_VertHeader vertical; /* TT Vertical header, if present */ | |
1270 | |
1271 FT_UShort num_names; /* number of name records */ | |
1272 TT_NameTableRec name_table; /* name table */ | |
1273 | |
1274 TT_OS2 os2; /* TrueType OS/2 table */ | |
1275 TT_Postscript postscript; /* TrueType Postscript table */ | |
1276 | |
1277 FT_Byte* cmap_table; /* extracted `cmap' table */ | |
1278 FT_ULong cmap_size; | |
1279 | |
1280 TT_Loader_GotoTableFunc goto_table; | |
1281 | |
1282 TT_Loader_StartGlyphFunc access_glyph_frame; | |
1283 TT_Loader_EndGlyphFunc forget_glyph_frame; | |
1284 TT_Loader_ReadGlyphFunc read_glyph_header; | |
1285 TT_Loader_ReadGlyphFunc read_simple_glyph; | |
1286 TT_Loader_ReadGlyphFunc read_composite_glyph; | |
1287 | |
1288 /* a typeless pointer to the SFNT_Interface table used to load */ | |
1289 /* the basic TrueType tables in the face object */ | |
1290 void* sfnt; | |
1291 | |
1292 /* a typeless pointer to the FT_Service_PsCMapsRec table used to */ | |
1293 /* handle glyph names <-> unicode & Mac values */ | |
1294 void* psnames; | |
1295 | |
1296 | |
1297 /***********************************************************************/ | |
1298 /* */ | |
1299 /* Optional TrueType/OpenType tables */ | |
1300 /* */ | |
1301 /***********************************************************************/ | |
1302 | |
1303 /* grid-fitting and scaling table */ | |
1304 TT_GaspRec gasp; /* the `gasp' table */ | |
1305 | |
1306 /* PCL 5 table */ | |
1307 TT_PCLT pclt; | |
1308 | |
1309 /* embedded bitmaps support */ | |
1310 FT_ULong num_sbit_scales; | |
1311 TT_SBit_Scale sbit_scales; | |
1312 | |
1313 /* postscript names table */ | |
1314 TT_Post_NamesRec postscript_names; | |
1315 | |
1316 | |
1317 /***********************************************************************/ | |
1318 /* */ | |
1319 /* TrueType-specific fields (ignored by the OTF-Type2 driver) */ | |
1320 /* */ | |
1321 /***********************************************************************/ | |
1322 | |
1323 /* the font program, if any */ | |
1324 FT_ULong font_program_size; | |
1325 FT_Byte* font_program; | |
1326 | |
1327 /* the cvt program, if any */ | |
1328 FT_ULong cvt_program_size; | |
1329 FT_Byte* cvt_program; | |
1330 | |
1331 /* the original, unscaled, control value table */ | |
1332 FT_ULong cvt_size; | |
1333 FT_Short* cvt; | |
1334 | |
1335 /* A pointer to the bytecode interpreter to use. This is also */ | |
1336 /* used to hook the debugger for the `ttdebug' utility. */ | |
1337 TT_Interpreter interpreter; | |
1338 | |
1339 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING | |
1340 /* Use unpatented hinting only. */ | |
1341 FT_Bool unpatented_hinting; | |
1342 #endif | |
1343 | |
1344 /***********************************************************************/ | |
1345 /* */ | |
1346 /* Other tables or fields. This is used by derivative formats like */ | |
1347 /* OpenType. */ | |
1348 /* */ | |
1349 /***********************************************************************/ | |
1350 | |
1351 FT_Generic extra; | |
1352 | |
1353 const char* postscript_name; | |
1354 | |
1355 FT_ULong glyf_len; | |
1356 | |
1357 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT | |
1358 FT_Bool doblend; | |
1359 GX_Blend blend; | |
1360 #endif | |
1361 | |
1362 /* since version 2.2 */ | |
1363 | |
1364 FT_Byte* horz_metrics; | |
1365 FT_ULong horz_metrics_size; | |
1366 | |
1367 FT_Byte* vert_metrics; | |
1368 FT_ULong vert_metrics_size; | |
1369 | |
1370 FT_ULong num_locations; /* in broken TTF, gid > 0xFFFF */ | |
1371 FT_Byte* glyph_locations; | |
1372 | |
1373 FT_Byte* hdmx_table; | |
1374 FT_ULong hdmx_table_size; | |
1375 FT_UInt hdmx_record_count; | |
1376 FT_ULong hdmx_record_size; | |
1377 FT_Byte* hdmx_record_sizes; | |
1378 | |
1379 FT_Byte* sbit_table; | |
1380 FT_ULong sbit_table_size; | |
1381 TT_SbitTableType sbit_table_type; | |
1382 FT_UInt sbit_num_strikes; | |
1383 | |
1384 FT_Byte* kern_table; | |
1385 FT_ULong kern_table_size; | |
1386 FT_UInt num_kern_tables; | |
1387 FT_UInt32 kern_avail_bits; | |
1388 FT_UInt32 kern_order_bits; | |
1389 | |
1390 #ifdef TT_CONFIG_OPTION_BDF | |
1391 TT_BDFRec bdf; | |
1392 #endif /* TT_CONFIG_OPTION_BDF */ | |
1393 | |
1394 /* since 2.3.0 */ | |
1395 FT_ULong horz_metrics_offset; | |
1396 FT_ULong vert_metrics_offset; | |
1397 | |
1398 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING | |
1399 /* since 2.4.12 */ | |
1400 FT_ULong sph_found_func_flags; /* special functions found */ | |
1401 /* for this face */ | |
1402 FT_Bool sph_compatibility_mode; | |
1403 #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ | |
1404 | |
1405 } TT_FaceRec; | |
1406 | |
1407 | |
1408 /*************************************************************************/ | |
1409 /* */ | |
1410 /* <Struct> */ | |
1411 /* TT_GlyphZoneRec */ | |
1412 /* */ | |
1413 /* <Description> */ | |
1414 /* A glyph zone is used to load, scale and hint glyph outline */ | |
1415 /* coordinates. */ | |
1416 /* */ | |
1417 /* <Fields> */ | |
1418 /* memory :: A handle to the memory manager. */ | |
1419 /* */ | |
1420 /* max_points :: The maximum size in points of the zone. */ | |
1421 /* */ | |
1422 /* max_contours :: Max size in links contours of the zone. */ | |
1423 /* */ | |
1424 /* n_points :: The current number of points in the zone. */ | |
1425 /* */ | |
1426 /* n_contours :: The current number of contours in the zone. */ | |
1427 /* */ | |
1428 /* org :: The original glyph coordinates (font */ | |
1429 /* units/scaled). */ | |
1430 /* */ | |
1431 /* cur :: The current glyph coordinates (scaled/hinted). */ | |
1432 /* */ | |
1433 /* tags :: The point control tags. */ | |
1434 /* */ | |
1435 /* contours :: The contours end points. */ | |
1436 /* */ | |
1437 /* first_point :: Offset of the current subglyph's first point. */ | |
1438 /* */ | |
1439 typedef struct TT_GlyphZoneRec_ | |
1440 { | |
1441 FT_Memory memory; | |
1442 FT_UShort max_points; | |
1443 FT_UShort max_contours; | |
1444 FT_UShort n_points; /* number of points in zone */ | |
1445 FT_Short n_contours; /* number of contours */ | |
1446 | |
1447 FT_Vector* org; /* original point coordinates */ | |
1448 FT_Vector* cur; /* current point coordinates */ | |
1449 FT_Vector* orus; /* original (unscaled) point coordinates */ | |
1450 | |
1451 FT_Byte* tags; /* current touch flags */ | |
1452 FT_UShort* contours; /* contour end points */ | |
1453 | |
1454 FT_UShort first_point; /* offset of first (#0) point */ | |
1455 | |
1456 } TT_GlyphZoneRec, *TT_GlyphZone; | |
1457 | |
1458 | |
1459 /* handle to execution context */ | |
1460 typedef struct TT_ExecContextRec_* TT_ExecContext; | |
1461 | |
1462 /* glyph loader structure */ | |
1463 typedef struct TT_LoaderRec_ | |
1464 { | |
1465 FT_Face face; | |
1466 FT_Size size; | |
1467 FT_GlyphSlot glyph; | |
1468 FT_GlyphLoader gloader; | |
1469 | |
1470 FT_ULong load_flags; | |
1471 FT_UInt glyph_index; | |
1472 | |
1473 FT_Stream stream; | |
1474 FT_Int byte_len; | |
1475 | |
1476 FT_Short n_contours; | |
1477 FT_BBox bbox; | |
1478 FT_Int left_bearing; | |
1479 FT_Int advance; | |
1480 FT_Int linear; | |
1481 FT_Bool linear_def; | |
1482 FT_Vector pp1; | |
1483 FT_Vector pp2; | |
1484 | |
1485 FT_ULong glyf_offset; | |
1486 | |
1487 /* the zone where we load our glyphs */ | |
1488 TT_GlyphZoneRec base; | |
1489 TT_GlyphZoneRec zone; | |
1490 | |
1491 TT_ExecContext exec; | |
1492 FT_Byte* instructions; | |
1493 FT_ULong ins_pos; | |
1494 | |
1495 /* for possible extensibility in other formats */ | |
1496 void* other; | |
1497 | |
1498 /* since version 2.1.8 */ | |
1499 FT_Int top_bearing; | |
1500 FT_Int vadvance; | |
1501 FT_Vector pp3; | |
1502 FT_Vector pp4; | |
1503 | |
1504 /* since version 2.2.1 */ | |
1505 FT_Byte* cursor; | |
1506 FT_Byte* limit; | |
1507 | |
1508 } TT_LoaderRec; | |
1509 | |
1510 | |
1511 FT_END_HEADER | |
1512 | |
1513 #endif /* __TTTYPES_H__ */ | |
1514 | |
1515 | |
1516 /* END */ | |
OLD | NEW |