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