1 /***************************************************************************/
5 /* Basic SFNT/TrueType type definitions and interface (specification */
8 /* Copyright 1996-2000 by */
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
17 /***************************************************************************/
24 #include <freetype/tttables.h>
27 /*************************************************************************/
28 /*************************************************************************/
29 /*************************************************************************/
32 /*** REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/
35 /*************************************************************************/
36 /*************************************************************************/
37 /*************************************************************************/
40 /*************************************************************************/
46 /* TrueType collection header. This table contains the offsets of */
47 /* the font headers of each distinct TrueType face in the file. */
50 /* tag :: Must be `ttc ' to indicate a TrueType collection. */
52 /* version :: The version number. */
54 /* count :: The number of faces in the collection. The */
55 /* specification says this should be an unsigned long, but */
56 /* we use a signed long since we need the value -1 for */
57 /* specific purposes. */
59 /* offsets :: The offsets of the font headers, one per face. */
61 typedef struct TTC_Header_
71 /*************************************************************************/
77 /* SFNT file format header. */
80 /* format_tag :: The font format tag. */
82 /* num_tables :: The number of tables in file. */
84 /* search_range :: Must be 16*(max power of 2 <= num_tables). */
86 /* entry_selector :: Must be log2 of search_range/16. */
88 /* range_shift :: Must be num_tables*16 - search_range. */
90 typedef struct SFNT_Header_
94 FT_UShort search_range
;
95 FT_UShort entry_selector
;
96 FT_UShort range_shift
;
101 /*************************************************************************/
107 /* This structure models a TrueType table directory. It is used to */
108 /* access the various tables of the font face. */
111 /* version :: The version number; starts with 0x00010000. */
113 /* numTables :: The number of tables. */
115 /* searchRange :: Unused. */
117 /* entrySelector :: Unused. */
119 /* rangeShift :: Unused. */
122 /* This structure is only used during font opening. */
124 typedef struct TT_TableDir_
126 FT_Fixed version
; /* should be 0x10000 */
127 FT_UShort numTables
; /* number of tables */
129 FT_UShort searchRange
; /* These parameters are only used */
130 FT_UShort entrySelector
; /* for a dichotomy search in the */
131 FT_UShort rangeShift
; /* directory. We ignore them. */
136 /*************************************************************************/
142 /* This structure describes a given table of a TrueType font. */
145 /* Tag :: A four-bytes tag describing the table. */
147 /* CheckSum :: The table checksum. This value can be ignored. */
149 /* Offset :: The offset of the table from the start of the TrueType */
150 /* font in its resource. */
152 /* Length :: The table length (in bytes). */
154 typedef struct TT_Table_
156 FT_ULong Tag
; /* table type */
157 FT_ULong CheckSum
; /* table checksum */
158 FT_ULong Offset
; /* table file offset */
159 FT_ULong Length
; /* table length */
164 /*************************************************************************/
170 /* This structure describes the directory of the `cmap' table, */
171 /* containing the font's character mappings table. */
174 /* tableVersionNumber :: The version number. */
176 /* numCMaps :: The number of charmaps in the font. */
179 /* This structure is only used during font loading. */
181 typedef struct TT_CMapDir_
183 FT_UShort tableVersionNumber
;
189 /*************************************************************************/
192 /* TT_CMapDirEntry */
195 /* This structure describes a charmap in a TrueType font. */
198 /* platformID :: An ID used to specify for which platform this */
199 /* charmap is defined (FreeType manages all platforms). */
201 /* encodingID :: A platform-specific ID used to indicate which source */
202 /* encoding is used in this charmap. */
204 /* offset :: The offset of the charmap relative to the start of */
205 /* the `cmap' table. */
208 /* This structure is only used during font loading. */
210 typedef struct TT_CMapDirEntry_
212 FT_UShort platformID
;
213 FT_UShort platformEncodingID
;
219 /*************************************************************************/
225 /* A structure modeling the long metrics of the `hmtx' and `vmtx' */
226 /* TrueType tables. The values are expressed in font units. */
229 /* advance :: The advance width or height for the glyph. */
231 /* bearing :: The left-side or top-side bearing for the glyph. */
233 typedef struct TT_LongMetrics_
241 /*************************************************************************/
243 /* <Type> TT_ShortMetrics */
246 /* A simple type to model the short metrics of the `hmtx' and `vmtx' */
249 typedef FT_Short TT_ShortMetrics
;
252 /*************************************************************************/
258 /* A structure modeling TrueType name records. Name records are used */
259 /* to store important strings like family name, style name, */
260 /* copyright, etc. in _localized_ versions (i.e., language, encoding, */
264 /* platformID :: The ID of the name's encoding platform. */
266 /* encodingID :: The platform-specific ID for the name's encoding. */
268 /* languageID :: The platform-specific ID for the name's language. */
270 /* nameID :: The ID specifying what kind of name this is. */
272 /* stringLength :: The length of the string in bytes. */
274 /* stringOffset :: The offset to the string in the `name' table. */
276 /* string :: A pointer to the string's bytes. Note that these */
277 /* are usually UTF-16 encoded characters. */
279 typedef struct TT_NameRec_
281 FT_UShort platformID
;
282 FT_UShort encodingID
;
283 FT_UShort languageID
;
285 FT_UShort stringLength
;
286 FT_UShort stringOffset
;
288 /* this last field is not defined in the spec */
289 /* but used by the FreeType engine */
296 /*************************************************************************/
302 /* A structure modeling the TrueType name table. */
305 /* format :: The format of the name table. */
307 /* numNameRecords :: The number of names in table. */
309 /* storageOffset :: The offset of the name table in the `name' */
310 /* TrueType table. */
312 /* names :: An array of name records. */
314 /* storage :: The names storage area. */
316 typedef struct TT_NameTable_
319 FT_UShort numNameRecords
;
320 FT_UShort storageOffset
;
327 /*************************************************************************/
328 /*************************************************************************/
329 /*************************************************************************/
332 /*** OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/
335 /*************************************************************************/
336 /*************************************************************************/
337 /*************************************************************************/
340 /*************************************************************************/
346 /* A tiny structure used to model a gasp range according to the */
347 /* TrueType specification. */
350 /* maxPPEM :: The maximum ppem value to which `gaspFlag' applies. */
352 /* gaspFlag :: A flag describing the grid-fitting and anti-aliasing */
353 /* modes to be used. */
355 typedef struct TT_GaspRange_
363 #define TT_GASP_GRIDFIT 0x01
364 #define TT_GASP_DOGRAY 0x02
367 /*************************************************************************/
373 /* A structure modeling the TrueType `gasp' table used to specify */
374 /* grid-fitting and anti-aliasing behaviour. */
377 /* version :: The version number. */
379 /* numRanges :: The number of gasp ranges in table. */
381 /* gaspRanges :: An array of gasp ranges. */
383 typedef struct TT_Gasp_
387 TT_GaspRange
* gaspRanges
;
392 /*************************************************************************/
398 /* A small structure used to model the pre-computed widths of a given */
399 /* size. They are found in the `hdmx' table. */
402 /* ppem :: The pixels per EM value at which these metrics apply. */
404 /* max_width :: The maximum advance width for this metric. */
406 /* widths :: An array of widths. Note: These are 8-bit bytes. */
408 typedef struct TT_HdmxRec_
417 /*************************************************************************/
423 /* A structure used to model the `hdmx' table, which contains */
424 /* pre-computed widths for a set of given sizes/dimensions. */
427 /* version :: The version number. */
429 /* num_records :: The number of hdmx records. */
431 /* records :: An array of hdmx records. */
433 typedef struct TT_Hdmx_
436 FT_Short num_records
;
442 /*************************************************************************/
448 /* A structure used to model a kerning pair for the kerning table */
449 /* format 0. The engine now loads this table if it finds one in the */
453 /* left :: The index of the left glyph in pair. */
455 /* right :: The index of the right glyph in pair. */
457 /* value :: The kerning distance. A positive value spaces the */
458 /* glyphs, a negative one makes them closer. */
460 typedef struct TT_Kern_0_Pair_
462 FT_UShort left
; /* index of left glyph in pair */
463 FT_UShort right
; /* index of right glyph in pair */
464 FT_FWord value
; /* kerning value */
469 /*************************************************************************/
470 /*************************************************************************/
471 /*************************************************************************/
474 /*** EMBEDDED BITMAPS SUPPORT ***/
477 /*************************************************************************/
478 /*************************************************************************/
479 /*************************************************************************/
482 /*************************************************************************/
485 /* TT_SBit_Metrics */
488 /* A structure used to hold the big metrics of a given glyph bitmap */
489 /* in a TrueType or OpenType font. These are usually found in the */
490 /* `EBDT' (Microsoft) or `bdat' (Apple) table. */
493 /* height :: The glyph height in pixels. */
495 /* width :: The glyph width in pixels. */
497 /* horiBearingX :: The horizontal left bearing. */
499 /* horiBearingY :: The horizontal top bearing. */
501 /* horiAdvance :: The horizontal advance. */
503 /* vertBearingX :: The vertical left bearing. */
505 /* vertBearingY :: The vertical top bearing. */
507 /* vertAdvance :: The vertical advance. */
509 typedef struct TT_SBit_Metrics_
514 FT_Char horiBearingX
;
515 FT_Char horiBearingY
;
518 FT_Char vertBearingX
;
519 FT_Char vertBearingY
;
525 /*************************************************************************/
528 /* TT_SBit_Small_Metrics */
531 /* A structure used to hold the small metrics of a given glyph bitmap */
532 /* in a TrueType or OpenType font. These are usually found in the */
533 /* `EBDT' (Microsoft) or the `bdat' (Apple) table. */
536 /* height :: The glyph height in pixels. */
538 /* width :: The glyph width in pixels. */
540 /* bearingX :: The left-side bearing. */
542 /* bearingY :: The top-side bearing. */
544 /* advance :: The advance width or height. */
546 typedef struct TT_SBit_Small_Metrics_
555 } TT_SBit_Small_Metrics
;
558 /*************************************************************************/
561 /* TT_SBit_Line_Metrics */
564 /* A structure used to describe the text line metrics of a given */
565 /* bitmap strike, for either a horizontal or vertical layout. */
568 /* ascender :: The ascender in pixels. */
570 /* descender :: The descender in pixels. */
572 /* max_width :: The maximum glyph width in pixels. */
574 /* caret_slope_enumerator :: Rise of the caret slope, typically set */
575 /* to 1 for non-italic fonts. */
577 /* caret_slope_denominator :: Rise of the caret slope, typically set */
578 /* to 0 for non-italic fonts. */
580 /* caret_offset :: Offset in pixels to move the caret for */
581 /* proper positioning. */
583 /* min_origin_SB :: Minimum of horiBearingX (resp. */
585 /* min_advance_SB :: Minimum of */
587 /* horizontal advance - */
588 /* ( horiBearingX + width ) */
592 /* vertical advance - */
593 /* ( vertBearingY + height ) */
595 /* max_before_BL :: Maximum of horiBearingY (resp. */
598 /* min_after_BL :: Minimum of */
600 /* horiBearingY - height */
604 /* vertBearingX - width */
606 /* pads :: Unused (to make the size of the record */
607 /* a multiple of 32 bits. */
609 typedef struct TT_SBit_Line_Metrics_
614 FT_Char caret_slope_numerator
;
615 FT_Char caret_slope_denominator
;
616 FT_Char caret_offset
;
617 FT_Char min_origin_SB
;
618 FT_Char min_advance_SB
;
619 FT_Char max_before_BL
;
620 FT_Char min_after_BL
;
623 } TT_SBit_Line_Metrics
;
626 /*************************************************************************/
632 /* A TrueType/OpenType subIndexTable as defined in the `EBLC' */
633 /* (Microsoft) or `bloc' (Apple) tables. */
636 /* first_glyph :: The first glyph index in the range. */
638 /* last_glyph :: The last glyph index in the range. */
640 /* index_format :: The format of index table. Valid values are 1 */
643 /* image_format :: The format of `EBDT' image data. */
645 /* image_offset :: The offset to image data in `EBDT'. */
647 /* image_size :: For index formats 2 and 5. This is the size in */
648 /* bytes of each glyph bitmap. */
650 /* big_metrics :: For index formats 2 and 5. This is the big */
651 /* metrics for each glyph bitmap. */
653 /* num_glyphs :: For index formats 4 and 5. This is the number of */
654 /* glyphs in the code array. */
656 /* glyph_offsets :: For index formats 1 and 3. */
658 /* glyph_codes :: For index formats 4 and 5. */
660 /* table_offset :: The offset of the index table in the `EBLC' */
661 /* table. Only used during strike loading. */
663 typedef struct TT_SBit_Range
665 FT_UShort first_glyph
;
666 FT_UShort last_glyph
;
668 FT_UShort index_format
;
669 FT_UShort image_format
;
670 FT_ULong image_offset
;
673 TT_SBit_Metrics metrics
;
676 FT_ULong
* glyph_offsets
;
677 FT_UShort
* glyph_codes
;
679 FT_ULong table_offset
;
684 /*************************************************************************/
690 /* A structure used describe a given bitmap strike in the `EBLC' */
691 /* (Microsoft) or `bloc' (Apple) tables. */
694 /* num_index_ranges :: The number of index ranges. */
696 /* index_ranges :: An array of glyph index ranges. */
698 /* color_ref :: Unused. A color reference? */
700 /* hori :: The line metrics for horizontal layouts. */
702 /* vert :: The line metrics for vertical layouts. */
704 /* start_glyph :: The lowest glyph index for this strike. */
706 /* end_glyph :: The highest glyph index for this strike. */
708 /* x_ppem :: The number of horizontal pixels per EM. */
710 /* y_ppem :: The number of vertical pixels per EM. */
712 /* bit_depth :: The bit depth. Valid values are 1, 2, 4, */
715 /* flags :: Is this a vertical or horizontal strike? */
717 typedef struct TT_SBit_Strike_
720 TT_SBit_Range
* sbit_ranges
;
721 FT_ULong ranges_offset
;
725 TT_SBit_Line_Metrics hori
;
726 TT_SBit_Line_Metrics vert
;
728 FT_UShort start_glyph
;
740 /*************************************************************************/
743 /* TT_SBit_Component */
746 /* A simple structure to describe a compound sbit element. */
749 /* glyph_code :: The element's glyph index. */
751 /* x_offset :: The element's left bearing. */
753 /* y_offset :: The element's top bearing. */
755 typedef struct TT_SBit_Component_
757 FT_UShort glyph_code
;
765 /*************************************************************************/
771 /* A structure used describe a given bitmap scaling table, as defined */
772 /* in the `EBSC' table. */
775 /* hori :: The horizontal line metrics. */
777 /* vert :: The vertical line metrics. */
779 /* x_ppem :: The number of horizontal pixels per EM. */
781 /* y_ppem :: The number of vertical pixels per EM. */
783 /* x_ppem_substitute :: Substitution x_ppem value. */
785 /* y_ppem_substitute :: Substitution y_ppem value. */
787 typedef struct TT_SBit_Scale_
789 TT_SBit_Line_Metrics hori
;
790 TT_SBit_Line_Metrics vert
;
795 FT_Byte x_ppem_substitute
;
796 FT_Byte y_ppem_substitute
;
801 /*************************************************************************/
802 /*************************************************************************/
803 /*************************************************************************/
806 /*** POSTSCRIPT GLYPH NAMES SUPPORT ***/
809 /*************************************************************************/
810 /*************************************************************************/
811 /*************************************************************************/
814 /*************************************************************************/
820 /* Postscript names sub-table, format 2.0. Stores the PS name of */
821 /* each glyph in the font face. */
824 /* num_glyphs :: The number of named glyphs in the table. */
826 /* num_names :: The number of PS names stored in the table. */
828 /* glyph_indices :: The indices of the glyphs in the names arrays. */
830 /* glyph_names :: The PS names not in Mac Encoding. */
832 typedef struct TT_Post_20_
834 FT_UShort num_glyphs
;
836 FT_UShort
* glyph_indices
;
837 FT_Char
** glyph_names
;
842 /*************************************************************************/
848 /* Postscript names sub-table, format 2.5. Stores the PS name of */
849 /* each glyph in the font face. */
852 /* num_glyphs :: The number of glyphs in the table. */
854 /* offsets :: An array of signed offsets in a normal Mac */
855 /* Postscript name encoding. */
857 typedef struct TT_Post_25_
859 FT_UShort num_glyphs
;
865 /*************************************************************************/
871 /* Postscript names table, either format 2.0 or 2.5. */
874 /* loaded :: A flag to indicate whether the PS names are loaded. */
876 /* format_20 :: The sub-table used for format 2.0. */
878 /* format_25 :: The sub-table used for format 2.5. */
880 typedef struct TT_Post_Names_
886 TT_Post_20 format_20
;
887 TT_Post_25 format_25
;
894 /*************************************************************************/
895 /*************************************************************************/
896 /*************************************************************************/
899 /*** TRUETYPE CHARMAPS SUPPORT ***/
902 /*************************************************************************/
903 /*************************************************************************/
904 /*************************************************************************/
909 typedef struct TT_CMap0_
911 FT_Byte
* glyphIdArray
;
918 typedef struct TT_CMap2SubHeader_
920 FT_UShort firstCode
; /* first valid low byte */
921 FT_UShort entryCount
; /* number of valid low bytes */
922 FT_Short idDelta
; /* delta value to glyphIndex */
923 FT_UShort idRangeOffset
; /* offset from here to 1st code */
928 typedef struct TT_CMap2_
930 FT_UShort
* subHeaderKeys
;
931 /* high byte mapping table */
932 /* value = subHeader index * 8 */
934 TT_CMap2SubHeader
* subHeaders
;
935 FT_UShort
* glyphIdArray
;
936 FT_UShort numGlyphId
; /* control value */
943 typedef struct TT_CMap4Segment_
946 FT_UShort startCount
;
948 FT_UShort idRangeOffset
;
953 typedef struct TT_CMap4_
955 FT_UShort segCountX2
; /* number of segments * 2 */
956 FT_UShort searchRange
; /* these parameters can be used */
957 FT_UShort entrySelector
; /* for a binary search */
958 FT_UShort rangeShift
;
960 TT_CMap4Segment
* segments
;
961 FT_UShort
* glyphIdArray
;
962 FT_UShort numGlyphId
; /* control value */
964 TT_CMap4Segment
* last_segment
; /* last used segment; this is a small */
965 /* cache to potentially increase speed */
971 typedef struct TT_CMap6_
973 FT_UShort firstCode
; /* first character code of subrange */
974 FT_UShort entryCount
; /* number of character codes in subrange */
976 FT_UShort
* glyphIdArray
;
981 typedef struct TT_CMapTable_ TT_CMapTable
;
985 FT_UInt (*TT_CharMap_Func
)( TT_CMapTable
* charmap
,
986 FT_ULong char_code
);
992 FT_UShort platformID
;
993 FT_UShort platformEncodingID
;
1009 TT_CharMap_Func get_index
;
1013 /*************************************************************************/
1019 /* The TrueType character map object type. */
1022 /* root :: The parent character map structure. */
1024 /* cmap :: The used character map. */
1026 typedef struct TT_CharMapRec_
1034 /*************************************************************************/
1035 /*************************************************************************/
1036 /*************************************************************************/
1039 /*** ORIGINAL TT_FACE CLASS DEFINITION ***/
1042 /*************************************************************************/
1043 /*************************************************************************/
1044 /*************************************************************************/
1047 /*************************************************************************/
1049 /* This structure/class is defined here because it is common to the */
1050 /* following formats: TTF, OpenType-TT, and OpenType-CFF. */
1052 /* Note, however, that the classes TT_Size, TT_GlyphSlot, and TT_CharMap */
1053 /* are not shared between font drivers, and are thus defined normally in */
1056 /*************************************************************************/
1059 /*************************************************************************/
1065 /* A handle to a TrueType face/font object. A TT_Face encapsulates */
1066 /* the resolution and scaling independent parts of a TrueType font */
1070 /* The TT_Face structure is also used as a `parent class' for the */
1071 /* OpenType-CFF class (T2_Face). */
1073 typedef struct TT_FaceRec_
* TT_Face
;
1076 /*************************************************************************/
1082 /* A handle to a TrueType character mapping object. */
1084 typedef struct TT_CharMapRec_
* TT_CharMap
;
1087 /* a function type used for the truetype bytecode interpreter hooks */
1088 typedef FT_Error (*TT_Interpreter
)( void* exec_context
);
1090 /* forward declaration */
1091 typedef struct TT_Loader_ TT_Loader
;
1094 /*************************************************************************/
1097 /* TT_Goto_Table_Func */
1100 /* Seeks a stream to the start of a given TrueType table. */
1103 /* face :: A handle to the target face object. */
1105 /* tag :: A 4-byte tag used to name the table. */
1107 /* stream :: The input stream. */
1110 /* length :: The length of the table in bytes. Set to 0 if not */
1114 /* FreeType error code. 0 means success. */
1117 /* The stream cursor must be at the font file's origin. */
1120 FT_Error (*TT_Goto_Table_Func
)( TT_Face face
,
1126 /*************************************************************************/
1129 /* TT_Access_Glyph_Frame_Func */
1132 /* Seeks a stream to the start of a given glyph element, and opens a */
1136 /* loader :: The current TrueType glyph loader object. */
1138 /* glyph index :: The index of the glyph to access. */
1140 /* offset :: The offset of the glyph according to the */
1141 /* `locations' table. */
1143 /* byte_count :: The size of the frame in bytes. */
1146 /* FreeType error code. 0 means success. */
1149 /* This function is normally equivalent to FILE_Seek(offset) */
1150 /* followed by ACCESS_Frame(byte_count) with the loader's stream, but */
1151 /* alternative formats (e.g. compressed ones) might use something */
1155 FT_Error (*TT_Access_Glyph_Frame_Func
)( TT_Loader
* loader
,
1156 FT_UInt glyph_index
,
1158 FT_UInt byte_count
);
1161 /*************************************************************************/
1164 /* TT_Load_Glyph_Element_Func */
1167 /* Reads one glyph element (its header, a simple glyph, or a */
1168 /* composite) from the loader's current stream frame. */
1171 /* loader :: The current TrueType glyph loader object. */
1174 /* FreeType error code. 0 means success. */
1177 FT_Error (*TT_Load_Glyph_Element_Func
)( TT_Loader
* loader
);
1180 /*************************************************************************/
1183 /* TT_Forget_Glyph_Frame_Func */
1186 /* Closes the current loader stream frame for the glyph. */
1189 /* loader :: The current TrueType glyph loader object. */
1192 void (*TT_Forget_Glyph_Frame_Func
)( TT_Loader
* loader
);
1196 /*************************************************************************/
1198 /* TrueType Face Type */
1204 /* The TrueType face class. These objects model the resolution and */
1205 /* point-size independent data found in a TrueType font file. */
1208 /* root :: The base FT_Face structure, managed by the */
1211 /* ttc_header :: The TrueType collection header, used when */
1212 /* the file is a `ttc' rather than a `ttf'. */
1213 /* For ordinary font files, the field */
1214 /* `ttc_header.count' is set to 0. */
1216 /* format_tag :: The font format tag. */
1218 /* num_tables :: The number of TrueType tables in this font */
1221 /* dir_tables :: The directory of TrueType tables for this */
1224 /* header :: The font's font header (`head' table). */
1225 /* Read on font opening. */
1227 /* horizontal :: The font's horizontal header (`hhea' */
1228 /* table). This field also contains the */
1229 /* associated horizontal metrics table */
1232 /* max_profile :: The font's maximum profile table. Read on */
1233 /* font opening. Note that some maximum */
1234 /* values cannot be taken directly from this */
1235 /* table. We thus define additional fields */
1236 /* below to hold the computed maxima. */
1238 /* max_components :: The maximum number of glyph components */
1239 /* required to load any composite glyph from */
1240 /* this font. Used to size the load stack. */
1242 /* vertical_info :: A boolean which is set when the font file */
1243 /* contains vertical metrics. If not, the */
1244 /* value of the `vertical' field is */
1247 /* vertical :: The font's vertical header (`vhea' table). */
1248 /* This field also contains the associated */
1249 /* vertical metrics table (`vmtx'), if found. */
1250 /* IMPORTANT: The contents of this field is */
1251 /* undefined if the `verticalInfo' field is */
1254 /* num_names :: The number of name records within this */
1255 /* TrueType font. */
1257 /* name_table :: The table of name records (`name'). */
1259 /* os2 :: The font's OS/2 table (`OS/2'). */
1261 /* postscript :: The font's PostScript table (`post' */
1262 /* table). The PostScript glyph names are */
1263 /* not loaded by the driver on face opening. */
1264 /* See the `ttpost' module for more details. */
1266 /* num_charmaps :: The number of character mappings in the */
1269 /* charmaps :: The array of charmap objects for this font */
1270 /* file. Note that this field is a typeless */
1271 /* pointer. The Reason is that the format of */
1272 /* charmaps varies with the underlying font */
1273 /* format and cannot be determined here. */
1275 /* goto_table :: A function called by each TrueType table */
1276 /* loader to position a stream's cursor to */
1277 /* the start of a given table according to */
1278 /* its tag. It defaults to TT_Goto_Face but */
1279 /* can be different for strange formats (e.g. */
1282 /* access_glyph_frame :: XXX */
1284 /* read_glyph_header :: XXX */
1286 /* read_simple_glyph :: XXX */
1288 /* read_composite_glyph :: XXX */
1290 /* forget_glyph_frame :: XXX */
1292 /* sfnt :: A pointer to the SFNT `driver' interface. */
1294 /* psnames :: A pointer to the `PSNames' module */
1297 /* hdmx :: The face's horizontal device metrics */
1298 /* (`hdmx' table). This table is optional in */
1299 /* TrueType/OpenType fonts. */
1301 /* gasp :: The grid-fitting and scaling properties */
1302 /* table (`gasp'). This table is optional in */
1303 /* TrueType/OpenType fonts. */
1307 /* num_sbit_strikes :: The number of sbit strikes, i.e., bitmap */
1308 /* sizes, embedded in this font. */
1310 /* sbit_strikes :: An array of sbit strikes embedded in this */
1311 /* font. This table is optional in a */
1312 /* TrueType/OpenType font. */
1314 /* num_sbit_scales :: The number of sbit scales for this font. */
1316 /* sbit_scales :: Array of sbit scales embedded in this */
1317 /* font. This table is optional in a */
1318 /* TrueType/OpenType font. */
1320 /* postscript_names :: A table used to store the Postscript names */
1321 /* of the glyphs for this font. See the */
1322 /* file `ttconfig.h' for comments on the */
1323 /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES option. */
1325 /* num_locations :: The number of glyph locations in this */
1326 /* TrueType file. This should be */
1327 /* identical to the number of glyphs. */
1328 /* Ignored for Type 2 fonts. */
1330 /* glyph_locations :: An array of longs. These are offsets to */
1331 /* glyph data within the `glyf' table. */
1332 /* Ignored for Type 2 font faces. */
1334 /* font_program_size :: Size in bytecodes of the face's font */
1335 /* program. 0 if none defined. Ignored for */
1338 /* font_program :: The face's font program (bytecode stream) */
1339 /* executed at load time, also used during */
1340 /* glyph rendering. Comes from the `fpgm' */
1341 /* table. Ignored for Type 2 font fonts. */
1343 /* cvt_program_size :: The size in bytecodes of the face's cvt */
1344 /* program. Ignored for Type 2 fonts. */
1346 /* cvt_program :: The face's cvt program (bytecode stream) */
1347 /* executed each time an instance/size is */
1348 /* changed/reset. Comes from the `prep' */
1349 /* table. Ignored for Type 2 fonts. */
1351 /* cvt_size :: Size of the control value table (in */
1352 /* entries). Ignored for Type 2 fonts. */
1354 /* cvt :: The face's original control value table. */
1355 /* Coordinates are expressed in unscaled font */
1356 /* units. Comes from the `cvt ' table. */
1357 /* Ignored for Type 2 fonts. */
1359 /* num_kern_pairs :: The number of kerning pairs present in the */
1360 /* font file. The engine only loads the */
1361 /* first horizontal format 0 kern table it */
1362 /* finds in the font file. You should use */
1363 /* the `ttxkern' structures if you want to */
1364 /* access other kerning tables. Ignored */
1365 /* for Type 2 fonts. */
1367 /* kern_table_index :: The index of the kerning table in the font */
1368 /* kerning directory. Only used by the */
1369 /* ttxkern extension to avoid data */
1370 /* duplication. Ignored for Type 2 fonts. */
1372 /* interpreter :: A pointer to the TrueType bytecode */
1373 /* interpreters field is also used to hook */
1374 /* the debugger in `ttdebug'. */
1378 typedef struct TT_FaceRec_
1382 TTC_Header ttc_header
;
1384 FT_ULong format_tag
;
1385 FT_UShort num_tables
;
1386 TT_Table
* dir_tables
;
1388 TT_Header header
; /* TrueType header table */
1389 TT_HoriHeader horizontal
; /* TrueType horizontal header */
1391 TT_MaxProfile max_profile
;
1392 FT_ULong max_components
;
1394 FT_Bool vertical_info
;
1395 TT_VertHeader vertical
; /* TT Vertical header, if present */
1397 FT_Int num_names
; /* number of name records */
1398 TT_NameTable name_table
; /* name table */
1400 TT_OS2 os2
; /* TrueType OS/2 table */
1401 TT_Postscript postscript
; /* TrueType Postscript table */
1403 FT_Int num_charmaps
;
1404 TT_CharMap charmaps
; /* array of TT_CharMapRec */
1406 TT_Goto_Table_Func goto_table
;
1408 TT_Access_Glyph_Frame_Func access_glyph_frame
;
1409 TT_Load_Glyph_Element_Func read_glyph_header
;
1410 TT_Load_Glyph_Element_Func read_simple_glyph
;
1411 TT_Load_Glyph_Element_Func read_composite_glyph
;
1412 TT_Forget_Glyph_Frame_Func forget_glyph_frame
;
1414 /* a typeless pointer to the SFNT_Interface table used to load */
1415 /* the basic TrueType tables in the face object */
1418 /* a typeless pointer to the PSNames_Interface table used to */
1419 /* handle glyph names <-> unicode & Mac values */
1422 /***********************************************************************/
1424 /* Optional TrueType/OpenType tables */
1426 /***********************************************************************/
1428 /* horizontal device metrics */
1431 /* grid-fitting and scaling table */
1432 TT_Gasp gasp
; /* the `gasp' table */
1437 /* embedded bitmaps support */
1438 FT_Int num_sbit_strikes
;
1439 TT_SBit_Strike
* sbit_strikes
;
1441 FT_Int num_sbit_scales
;
1442 TT_SBit_Scale
* sbit_scales
;
1444 /* postscript names table */
1445 TT_Post_Names postscript_names
;
1448 /***********************************************************************/
1450 /* TrueType-specific fields (ignored by the OTF-Type2 driver) */
1452 /***********************************************************************/
1454 /* the glyph locations */
1455 FT_UShort num_locations
;
1456 FT_Long
* glyph_locations
;
1458 /* the font program, if any */
1459 FT_ULong font_program_size
;
1460 FT_Byte
* font_program
;
1462 /* the cvt program, if any */
1463 FT_ULong cvt_program_size
;
1464 FT_Byte
* cvt_program
;
1466 /* the original, unscaled, control value table */
1470 /* the format 0 kerning table, if any */
1471 FT_Int num_kern_pairs
;
1472 FT_Int kern_table_index
;
1473 TT_Kern_0_Pair
* kern_pairs
;
1475 /* A pointer to the bytecode interpreter to use. This is also */
1476 /* used to hook the debugger for the `ttdebug' utility. */
1477 TT_Interpreter interpreter
;
1480 /***********************************************************************/
1482 /* Other tables or fields. This is used by derivative formats like */
1485 /***********************************************************************/
1492 /*************************************************************************/
1498 /* A glyph zone is used to load, scale and hint glyph outline */
1502 /* memory :: A handle to the memory manager. */
1504 /* max_points :: The maximal size in points of the zone. */
1506 /* max_contours :: Max size in links contours of thez one. */
1508 /* n_points :: The current number of points in the zone. */
1510 /* n_contours :: The current number of contours in the zone. */
1512 /* org :: The original glyph coordinates (font */
1513 /* units/scaled). */
1515 /* cur :: The current glyph coordinates (scaled/hinted). */
1517 /* tags :: The point control tags. */
1519 /* contours :: The contours end points. */
1521 typedef struct TT_GlyphZone_
1524 FT_UShort max_points
;
1525 FT_UShort max_contours
;
1526 FT_UShort n_points
; /* number of points in zone */
1527 FT_Short n_contours
; /* number of contours */
1529 FT_Vector
* org
; /* original point coordinates */
1530 FT_Vector
* cur
; /* current point coordinates */
1532 FT_Byte
* tags
; /* current touch flags */
1533 FT_UShort
* contours
; /* contour end points */
1538 /* handle to execution context */
1539 typedef struct TT_ExecContextRec_
* TT_ExecContext
;
1541 /* glyph loader structure */
1547 FT_GlyphLoader
* gloader
;
1549 FT_ULong load_flags
;
1550 FT_UInt glyph_index
;
1555 FT_Short n_contours
;
1557 FT_Int left_bearing
;
1559 FT_Bool preserve_pps
;
1563 FT_ULong glyf_offset
;
1565 /* the zone where we load our glyphs */
1569 TT_ExecContext exec
;
1570 FT_Byte
* instructions
;
1573 /* for possible extensibility in other formats */
1579 #endif /* TTTYPES_H */