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