The BIG graph update
[rrdtool.git] / libraries / freetype-2.0.5 / include / 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 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
29 FT_BEGIN_HEADER
30
31
32   /*************************************************************************/
33   /*************************************************************************/
34   /*************************************************************************/
35   /***                                                                   ***/
36   /***                                                                   ***/
37   /***             REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS         ***/
38   /***                                                                   ***/
39   /***                                                                   ***/
40   /*************************************************************************/
41   /*************************************************************************/
42   /*************************************************************************/
43
44
45   /*************************************************************************/
46   /*                                                                       */
47   /* <Struct>                                                              */
48   /*    TTC_Header                                                         */
49   /*                                                                       */
50   /* <Description>                                                         */
51   /*    TrueType collection header.  This table contains the offsets of    */
52   /*    the font headers of each distinct TrueType face in the file.       */
53   /*                                                                       */
54   /* <Fields>                                                              */
55   /*    tag     :: Must be `ttc ' to indicate a TrueType collection.       */
56   /*                                                                       */
57   /*    version :: The version number.                                     */
58   /*                                                                       */
59   /*    count   :: The number of faces in the collection.  The             */
60   /*               specification says this should be an unsigned long, but */
61   /*               we use a signed long since we need the value -1 for     */
62   /*               specific purposes.                                      */
63   /*                                                                       */
64   /*    offsets :: The offsets of the font headers, one per face.          */
65   /*                                                                       */
66   typedef struct  TTC_Header_
67   {
68     FT_ULong   tag;
69     FT_Fixed   version;
70     FT_Long    count;
71     FT_ULong*  offsets;
72
73   } TTC_Header;
74
75
76   /*************************************************************************/
77   /*                                                                       */
78   /* <Struct>                                                              */
79   /*    SFNT_Header                                                        */
80   /*                                                                       */
81   /* <Description>                                                         */
82   /*    SFNT file format header.                                           */
83   /*                                                                       */
84   /* <Fields>                                                              */
85   /*    format_tag     :: The font format tag.                             */
86   /*                                                                       */
87   /*    num_tables     :: The number of tables in file.                    */
88   /*                                                                       */
89   /*    search_range   :: Must be 16*(max power of 2 <= num_tables).       */
90   /*                                                                       */
91   /*    entry_selector :: Must be log2 of search_range/16.                 */
92   /*                                                                       */
93   /*    range_shift    :: Must be num_tables*16 - search_range.            */
94   /*                                                                       */
95   typedef struct  SFNT_Header_
96   {
97     FT_ULong   format_tag;
98     FT_UShort  num_tables;
99     FT_UShort  search_range;
100     FT_UShort  entry_selector;
101     FT_UShort  range_shift;
102
103   } SFNT_Header;
104
105
106   /*************************************************************************/
107   /*                                                                       */
108   /* <Struct>                                                              */
109   /*    TT_TableDir                                                        */
110   /*                                                                       */
111   /* <Description>                                                         */
112   /*    This structure models a TrueType table directory.  It is used to   */
113   /*    access the various tables of the font face.                        */
114   /*                                                                       */
115   /* <Fields>                                                              */
116   /*    version       :: The version number; starts with 0x00010000.       */
117   /*                                                                       */
118   /*    numTables     :: The number of tables.                             */
119   /*                                                                       */
120   /*    searchRange   :: Unused.                                           */
121   /*                                                                       */
122   /*    entrySelector :: Unused.                                           */
123   /*                                                                       */
124   /*    rangeShift    :: Unused.                                           */
125   /*                                                                       */
126   /* <Note>                                                                */
127   /*    This structure is only used during font opening.                   */
128   /*                                                                       */
129   typedef struct  TT_TableDir_
130   {
131     FT_Fixed   version;        /* should be 0x10000 */
132     FT_UShort  numTables;      /* number of tables  */
133
134     FT_UShort  searchRange;    /* These parameters are only used  */
135     FT_UShort  entrySelector;  /* for a dichotomy search in the   */
136     FT_UShort  rangeShift;     /* directory.  We ignore them.     */
137
138   } TT_TableDir;
139
140
141   /*************************************************************************/
142   /*                                                                       */
143   /* <Struct>                                                              */
144   /*    TT_Table                                                           */
145   /*                                                                       */
146   /* <Description>                                                         */
147   /*    This structure describes a given table of a TrueType font.         */
148   /*                                                                       */
149   /* <Fields>                                                              */
150   /*    Tag      :: A four-bytes tag describing the table.                 */
151   /*                                                                       */
152   /*    CheckSum :: The table checksum.  This value can be ignored.        */
153   /*                                                                       */
154   /*    Offset   :: The offset of the table from the start of the TrueType */
155   /*                font in its resource.                                  */
156   /*                                                                       */
157   /*    Length   :: The table length (in bytes).                           */
158   /*                                                                       */
159   typedef struct  TT_Table_
160   {
161     FT_ULong  Tag;        /*        table type */
162     FT_ULong  CheckSum;   /*    table checksum */
163     FT_ULong  Offset;     /* table file offset */
164     FT_ULong  Length;     /*      table length */
165
166   } TT_Table;
167
168
169   /*************************************************************************/
170   /*                                                                       */
171   /* <Struct>                                                              */
172   /*    TT_CMapDir                                                         */
173   /*                                                                       */
174   /* <Description>                                                         */
175   /*    This structure describes the directory of the `cmap' table,        */
176   /*    containing the font's character mappings table.                    */
177   /*                                                                       */
178   /* <Fields>                                                              */
179   /*    tableVersionNumber :: The version number.                          */
180   /*                                                                       */
181   /*    numCMaps           :: The number of charmaps in the font.          */
182   /*                                                                       */
183   /* <Note>                                                                */
184   /*    This structure is only used during font loading.                   */
185   /*                                                                       */
186   typedef struct  TT_CMapDir_
187   {
188     FT_UShort  tableVersionNumber;
189     FT_UShort  numCMaps;
190
191   } TT_CMapDir;
192
193
194   /*************************************************************************/
195   /*                                                                       */
196   /* <Struct>                                                              */
197   /*    TT_CMapDirEntry                                                    */
198   /*                                                                       */
199   /* <Description>                                                         */
200   /*    This structure describes a charmap in a TrueType font.             */
201   /*                                                                       */
202   /* <Fields>                                                              */
203   /*    platformID :: An ID used to specify for which platform this        */
204   /*                  charmap is defined (FreeType manages all platforms). */
205   /*                                                                       */
206   /*    encodingID :: A platform-specific ID used to indicate which source */
207   /*                  encoding is used in this charmap.                    */
208   /*                                                                       */
209   /*    offset     :: The offset of the charmap relative to the start of   */
210   /*                  the `cmap' table.                                    */
211   /*                                                                       */
212   /* <Note>                                                                */
213   /*    This structure is only used during font loading.                   */
214   /*                                                                       */
215   typedef struct  TT_CMapDirEntry_
216   {
217     FT_UShort  platformID;
218     FT_UShort  platformEncodingID;
219     FT_Long    offset;
220
221   } TT_CMapDirEntry;
222
223
224   /*************************************************************************/
225   /*                                                                       */
226   /* <Struct>                                                              */
227   /*    TT_LongMetrics                                                     */
228   /*                                                                       */
229   /* <Description>                                                         */
230   /*    A structure modeling the long metrics of the `hmtx' and `vmtx'     */
231   /*    TrueType tables.  The values are expressed in font units.          */
232   /*                                                                       */
233   /* <Fields>                                                              */
234   /*    advance :: The advance width or height for the glyph.              */
235   /*                                                                       */
236   /*    bearing :: The left-side or top-side bearing for the glyph.        */
237   /*                                                                       */
238   typedef struct  TT_LongMetrics_
239   {
240     FT_UShort  advance;
241     FT_Short   bearing;
242
243   } TT_LongMetrics;
244
245
246   /*************************************************************************/
247   /*                                                                       */
248   /* <Type> TT_ShortMetrics                                                */
249   /*                                                                       */
250   /* <Description>                                                         */
251   /*    A simple type to model the short metrics of the `hmtx' and `vmtx'  */
252   /*    tables.                                                            */
253   /*                                                                       */
254   typedef FT_Short  TT_ShortMetrics;
255
256
257   /*************************************************************************/
258   /*                                                                       */
259   /* <Struct>                                                              */
260   /*    TT_NameRec                                                         */
261   /*                                                                       */
262   /* <Description>                                                         */
263   /*    A structure modeling TrueType name records.  Name records are used */
264   /*    to store important strings like family name, style name,           */
265   /*    copyright, etc. in _localized_ versions (i.e., language, encoding, */
266   /*    etc).                                                              */
267   /*                                                                       */
268   /* <Fields>                                                              */
269   /*    platformID   :: The ID of the name's encoding platform.            */
270   /*                                                                       */
271   /*    encodingID   :: The platform-specific ID for the name's encoding.  */
272   /*                                                                       */
273   /*    languageID   :: The platform-specific ID for the name's language.  */
274   /*                                                                       */
275   /*    nameID       :: The ID specifying what kind of name this is.       */
276   /*                                                                       */
277   /*    stringLength :: The length of the string in bytes.                 */
278   /*                                                                       */
279   /*    stringOffset :: The offset to the string in the `name' table.      */
280   /*                                                                       */
281   /*    string       :: A pointer to the string's bytes.  Note that these  */
282   /*                    are usually UTF-16 encoded characters.             */
283   /*                                                                       */
284   typedef struct  TT_NameRec_
285   {
286     FT_UShort  platformID;
287     FT_UShort  encodingID;
288     FT_UShort  languageID;
289     FT_UShort  nameID;
290     FT_UShort  stringLength;
291     FT_UShort  stringOffset;
292
293     /* this last field is not defined in the spec */
294     /* but used by the FreeType engine            */
295
296     FT_Byte*   string;
297
298   } TT_NameRec;
299
300
301   /*************************************************************************/
302   /*                                                                       */
303   /* <Struct>                                                              */
304   /*    TT_NameTable                                                       */
305   /*                                                                       */
306   /* <Description>                                                         */
307   /*    A structure modeling the TrueType name table.                      */
308   /*                                                                       */
309   /* <Fields>                                                              */
310   /*    format         :: The format of the name table.                    */
311   /*                                                                       */
312   /*    numNameRecords :: The number of names in table.                    */
313   /*                                                                       */
314   /*    storageOffset  :: The offset of the name table in the `name'       */
315   /*                      TrueType table.                                  */
316   /*                                                                       */
317   /*    names          :: An array of name records.                        */
318   /*                                                                       */
319   /*    storage        :: The names storage area.                          */
320   /*                                                                       */
321   typedef struct  TT_NameTable_
322   {
323     FT_UShort    format;
324     FT_UShort    numNameRecords;
325     FT_UShort    storageOffset;
326     TT_NameRec*  names;
327     FT_Byte*     storage;
328
329   } TT_NameTable;
330
331
332   /*************************************************************************/
333   /*************************************************************************/
334   /*************************************************************************/
335   /***                                                                   ***/
336   /***                                                                   ***/
337   /***             OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS         ***/
338   /***                                                                   ***/
339   /***                                                                   ***/
340   /*************************************************************************/
341   /*************************************************************************/
342   /*************************************************************************/
343
344
345   /*************************************************************************/
346   /*                                                                       */
347   /* <Struct>                                                              */
348   /*    TT_GaspRange                                                       */
349   /*                                                                       */
350   /* <Description>                                                         */
351   /*    A tiny structure used to model a gasp range according to the       */
352   /*    TrueType specification.                                            */
353   /*                                                                       */
354   /* <Fields>                                                              */
355   /*    maxPPEM  :: The maximum ppem value to which `gaspFlag' applies.    */
356   /*                                                                       */
357   /*    gaspFlag :: A flag describing the grid-fitting and anti-aliasing   */
358   /*                modes to be used.                                      */
359   /*                                                                       */
360   typedef struct  TT_GaspRange_
361   {
362     FT_UShort  maxPPEM;
363     FT_UShort  gaspFlag;
364
365   } TT_GaspRange;
366
367
368 #define TT_GASP_GRIDFIT  0x01
369 #define TT_GASP_DOGRAY   0x02
370
371
372   /*************************************************************************/
373   /*                                                                       */
374   /* <Struct>                                                              */
375   /*    TT_Gasp                                                            */
376   /*                                                                       */
377   /* <Description>                                                         */
378   /*    A structure modeling the TrueType `gasp' table used to specify     */
379   /*    grid-fitting and anti-aliasing behaviour.                          */
380   /*                                                                       */
381   /* <Fields>                                                              */
382   /*    version    :: The version number.                                  */
383   /*                                                                       */
384   /*    numRanges  :: The number of gasp ranges in table.                  */
385   /*                                                                       */
386   /*    gaspRanges :: An array of gasp ranges.                             */
387   /*                                                                       */
388   typedef struct  TT_Gasp_
389   {
390     FT_UShort      version;
391     FT_UShort      numRanges;
392     TT_GaspRange*  gaspRanges;
393
394   } TT_Gasp;
395
396
397   /*************************************************************************/
398   /*                                                                       */
399   /* <Struct>                                                              */
400   /*    TT_HdmxRec                                                         */
401   /*                                                                       */
402   /* <Description>                                                         */
403   /*    A small structure used to model the pre-computed widths of a given */
404   /*    size.  They are found in the `hdmx' table.                         */
405   /*                                                                       */
406   /* <Fields>                                                              */
407   /*    ppem      :: The pixels per EM value at which these metrics apply. */
408   /*                                                                       */
409   /*    max_width :: The maximum advance width for this metric.            */
410   /*                                                                       */
411   /*    widths    :: An array of widths.  Note: These are 8-bit bytes.     */
412   /*                                                                       */
413   typedef struct  TT_HdmxRec_
414   {
415     FT_Byte   ppem;
416     FT_Byte   max_width;
417     FT_Byte*  widths;
418
419   } TT_HdmxRec;
420
421
422   /*************************************************************************/
423   /*                                                                       */
424   /* <Struct>                                                              */
425   /*    TT_Hdmx                                                            */
426   /*                                                                       */
427   /* <Description>                                                         */
428   /*    A structure used to model the `hdmx' table, which contains         */
429   /*    pre-computed widths for a set of given sizes/dimensions.           */
430   /*                                                                       */
431   /* <Fields>                                                              */
432   /*    version     :: The version number.                                 */
433   /*                                                                       */
434   /*    num_records :: The number of hdmx records.                         */
435   /*                                                                       */
436   /*    records     :: An array of hdmx records.                           */
437   /*                                                                       */
438   typedef struct  TT_Hdmx_
439   {
440     FT_UShort    version;
441     FT_Short     num_records;
442     TT_HdmxRec*  records;
443
444   } TT_Hdmx;
445
446
447   /*************************************************************************/
448   /*                                                                       */
449   /* <Struct>                                                              */
450   /*    TT_Kern_0_Pair                                                     */
451   /*                                                                       */
452   /* <Description>                                                         */
453   /*    A structure used to model a kerning pair for the kerning table     */
454   /*    format 0.  The engine now loads this table if it finds one in the  */
455   /*    font file.                                                         */
456   /*                                                                       */
457   /* <Fields>                                                              */
458   /*    left  :: The index of the left glyph in pair.                      */
459   /*                                                                       */
460   /*    right :: The index of the right glyph in pair.                     */
461   /*                                                                       */
462   /*    value :: The kerning distance.  A positive value spaces the        */
463   /*             glyphs, a negative one makes them closer.                 */
464   /*                                                                       */
465   typedef struct  TT_Kern_0_Pair_
466   {
467     FT_UShort  left;   /* index of left  glyph in pair */
468     FT_UShort  right;  /* index of right glyph in pair */
469     FT_FWord   value;  /* kerning value                */
470
471   } TT_Kern_0_Pair;
472
473
474   /*************************************************************************/
475   /*************************************************************************/
476   /*************************************************************************/
477   /***                                                                   ***/
478   /***                                                                   ***/
479   /***                    EMBEDDED BITMAPS SUPPORT                       ***/
480   /***                                                                   ***/
481   /***                                                                   ***/
482   /*************************************************************************/
483   /*************************************************************************/
484   /*************************************************************************/
485
486
487   /*************************************************************************/
488   /*                                                                       */
489   /* <Struct>                                                              */
490   /*    TT_SBit_Metrics                                                    */
491   /*                                                                       */
492   /* <Description>                                                         */
493   /*    A structure used to hold the big metrics of a given glyph bitmap   */
494   /*    in a TrueType or OpenType font.  These are usually found in the    */
495   /*    `EBDT' (Microsoft) or `bloc' (Apple) table.                        */
496   /*                                                                       */
497   /* <Fields>                                                              */
498   /*    height       :: The glyph height in pixels.                        */
499   /*                                                                       */
500   /*    width        :: The glyph width in pixels.                         */
501   /*                                                                       */
502   /*    horiBearingX :: The horizontal left bearing.                       */
503   /*                                                                       */
504   /*    horiBearingY :: The horizontal top bearing.                        */
505   /*                                                                       */
506   /*    horiAdvance  :: The horizontal advance.                            */
507   /*                                                                       */
508   /*    vertBearingX :: The vertical left bearing.                         */
509   /*                                                                       */
510   /*    vertBearingY :: The vertical top bearing.                          */
511   /*                                                                       */
512   /*    vertAdvance  :: The vertical advance.                              */
513   /*                                                                       */
514   typedef struct  TT_SBit_Metrics_
515   {
516     FT_Byte  height;
517     FT_Byte  width;
518
519     FT_Char  horiBearingX;
520     FT_Char  horiBearingY;
521     FT_Byte  horiAdvance;
522
523     FT_Char  vertBearingX;
524     FT_Char  vertBearingY;
525     FT_Byte  vertAdvance;
526
527   } TT_SBit_Metrics;
528
529
530   /*************************************************************************/
531   /*                                                                       */
532   /* <Struct>                                                              */
533   /*    TT_SBit_Small_Metrics                                              */
534   /*                                                                       */
535   /* <Description>                                                         */
536   /*    A structure used to hold the small metrics of a given glyph bitmap */
537   /*    in a TrueType or OpenType font.  These are usually found in the    */
538   /*    `EBDT' (Microsoft) or the `bdat' (Apple) table.                    */
539   /*                                                                       */
540   /* <Fields>                                                              */
541   /*    height   :: The glyph height in pixels.                            */
542   /*                                                                       */
543   /*    width    :: The glyph width in pixels.                             */
544   /*                                                                       */
545   /*    bearingX :: The left-side bearing.                                 */
546   /*                                                                       */
547   /*    bearingY :: The top-side bearing.                                  */
548   /*                                                                       */
549   /*    advance  :: The advance width or height.                           */
550   /*                                                                       */
551   typedef struct  TT_SBit_Small_Metrics_
552   {
553     FT_Byte  height;
554     FT_Byte  width;
555
556     FT_Char  bearingX;
557     FT_Char  bearingY;
558     FT_Byte  advance;
559
560   } TT_SBit_Small_Metrics;
561
562
563   /*************************************************************************/
564   /*                                                                       */
565   /* <Struct>                                                              */
566   /*    TT_SBit_Line_Metrics                                               */
567   /*                                                                       */
568   /* <Description>                                                         */
569   /*    A structure used to describe the text line metrics of a given      */
570   /*    bitmap strike, for either a horizontal or vertical layout.         */
571   /*                                                                       */
572   /* <Fields>                                                              */
573   /*    ascender                :: The ascender in pixels.                 */
574   /*                                                                       */
575   /*    descender               :: The descender in pixels.                */
576   /*                                                                       */
577   /*    max_width               :: The maximum glyph width in pixels.      */
578   /*                                                                       */
579   /*    caret_slope_enumerator  :: Rise of the caret slope, typically set  */
580   /*                               to 1 for non-italic fonts.              */
581   /*                                                                       */
582   /*    caret_slope_denominator :: Rise of the caret slope, typically set  */
583   /*                               to 0 for non-italic fonts.              */
584   /*                                                                       */
585   /*    caret_offset            :: Offset in pixels to move the caret for  */
586   /*                               proper positioning.                     */
587   /*                                                                       */
588   /*    min_origin_SB           :: Minimum of horiBearingX (resp.          */
589   /*                               vertBearingY).                          */
590   /*    min_advance_SB          :: Minimum of                              */
591   /*                                                                       */
592   /*                                 horizontal advance -                  */
593   /*                                   ( horiBearingX + width )            */
594   /*                                                                       */
595   /*                               resp.                                   */
596   /*                                                                       */
597   /*                                 vertical advance -                    */
598   /*                                   ( vertBearingY + height )           */
599   /*                                                                       */
600   /*    max_before_BL           :: Maximum of horiBearingY (resp.          */
601   /*                               vertBearingY).                          */
602   /*                                                                       */
603   /*    min_after_BL            :: Minimum of                              */
604   /*                                                                       */
605   /*                                 horiBearingY - height                 */
606   /*                                                                       */
607   /*                               resp.                                   */
608   /*                                                                       */
609   /*                                 vertBearingX - width                  */
610   /*                                                                       */
611   /*    pads                    :: Unused (to make the size of the record  */
612   /*                               a multiple of 32 bits.                  */
613   /*                                                                       */
614   typedef struct  TT_SBit_Line_Metrics_
615   {
616     FT_Char  ascender;
617     FT_Char  descender;
618     FT_Byte  max_width;
619     FT_Char  caret_slope_numerator;
620     FT_Char  caret_slope_denominator;
621     FT_Char  caret_offset;
622     FT_Char  min_origin_SB;
623     FT_Char  min_advance_SB;
624     FT_Char  max_before_BL;
625     FT_Char  min_after_BL;
626     FT_Char  pads[2];
627
628   } TT_SBit_Line_Metrics;
629
630
631   /*************************************************************************/
632   /*                                                                       */
633   /* <Struct>                                                              */
634   /*    TT_SBit_Range                                                      */
635   /*                                                                       */
636   /* <Description>                                                         */
637   /*    A TrueType/OpenType subIndexTable as defined in the `EBLC'         */
638   /*    (Microsoft) or `bloc' (Apple) tables.                              */
639   /*                                                                       */
640   /* <Fields>                                                              */
641   /*    first_glyph   :: The first glyph index in the range.               */
642   /*                                                                       */
643   /*    last_glyph    :: The last glyph index in the range.                */
644   /*                                                                       */
645   /*    index_format  :: The format of index table.  Valid values are 1    */
646   /*                     to 5.                                             */
647   /*                                                                       */
648   /*    image_format  :: The format of `EBDT' image data.                  */
649   /*                                                                       */
650   /*    image_offset  :: The offset to image data in `EBDT'.               */
651   /*                                                                       */
652   /*    image_size    :: For index formats 2 and 5.  This is the size in   */
653   /*                     bytes of each glyph bitmap.                       */
654   /*                                                                       */
655   /*    big_metrics   :: For index formats 2 and 5.  This is the big       */
656   /*                     metrics for each glyph bitmap.                    */
657   /*                                                                       */
658   /*    num_glyphs    :: For index formats 4 and 5.  This is the number of */
659   /*                     glyphs in the code array.                         */
660   /*                                                                       */
661   /*    glyph_offsets :: For index formats 1 and 3.                        */
662   /*                                                                       */
663   /*    glyph_codes   :: For index formats 4 and 5.                        */
664   /*                                                                       */
665   /*    table_offset  :: The offset of the index table in the `EBLC'       */
666   /*                     table.  Only used during strike loading.          */
667   /*                                                                       */
668   typedef struct  TT_SBit_Range
669   {
670     FT_UShort        first_glyph;
671     FT_UShort        last_glyph;
672
673     FT_UShort        index_format;
674     FT_UShort        image_format;
675     FT_ULong         image_offset;
676
677     FT_ULong         image_size;
678     TT_SBit_Metrics  metrics;
679     FT_ULong         num_glyphs;
680
681     FT_ULong*        glyph_offsets;
682     FT_UShort*       glyph_codes;
683
684     FT_ULong         table_offset;
685
686   } TT_SBit_Range;
687
688
689   /*************************************************************************/
690   /*                                                                       */
691   /* <Struct>                                                              */
692   /*    TT_SBit_Strike                                                     */
693   /*                                                                       */
694   /* <Description>                                                         */
695   /*    A structure used describe a given bitmap strike in the `EBLC'      */
696   /*    (Microsoft) or `bloc' (Apple) tables.                              */
697   /*                                                                       */
698   /* <Fields>                                                              */
699   /*   num_index_ranges :: The number of index ranges.                     */
700   /*                                                                       */
701   /*   index_ranges     :: An array of glyph index ranges.                 */
702   /*                                                                       */
703   /*   color_ref        :: Unused.  `color_ref' is put in for future       */
704   /*                       enhancements, but these fields are already      */
705   /*                       in use by other platforms (e.g. Newton).        */
706   /*                       For details, please see                         */
707   /*                                                                       */
708   /*                         http://fonts.apple.com/                       */
709   /*                                TTRefMan/RM06/Chap6bloc.html           */
710   /*                                                                       */
711   /*   hori             :: The line metrics for horizontal layouts.        */
712   /*                                                                       */
713   /*   vert             :: The line metrics for vertical layouts.          */
714   /*                                                                       */
715   /*   start_glyph      :: The lowest glyph index for this strike.         */
716   /*                                                                       */
717   /*   end_glyph        :: The highest glyph index for this strike.        */
718   /*                                                                       */
719   /*   x_ppem           :: The number of horizontal pixels per EM.         */
720   /*                                                                       */
721   /*   y_ppem           :: The number of vertical pixels per EM.           */
722   /*                                                                       */
723   /*   bit_depth        :: The bit depth.  Valid values are 1, 2, 4,       */
724   /*                       and 8.                                          */
725   /*                                                                       */
726   /*   flags            :: Is this a vertical or horizontal strike?  For   */
727   /*                       details, please see                             */
728   /*                                                                       */
729   /*                         http://fonts.apple.com/                       */
730   /*                                TTRefMan/RM06/Chap6bloc.html           */
731   /*                                                                       */
732   typedef struct  TT_SBit_Strike_
733   {
734     FT_Int                num_ranges;
735     TT_SBit_Range*        sbit_ranges;
736     FT_ULong              ranges_offset;
737
738     FT_ULong              color_ref;
739
740     TT_SBit_Line_Metrics  hori;
741     TT_SBit_Line_Metrics  vert;
742
743     FT_UShort             start_glyph;
744     FT_UShort             end_glyph;
745
746     FT_Byte               x_ppem;
747     FT_Byte               y_ppem;
748
749     FT_Byte               bit_depth;
750     FT_Char               flags;
751
752   } TT_SBit_Strike;
753
754
755   /*************************************************************************/
756   /*                                                                       */
757   /* <Struct>                                                              */
758   /*    TT_SBit_Component                                                  */
759   /*                                                                       */
760   /* <Description>                                                         */
761   /*    A simple structure to describe a compound sbit element.            */
762   /*                                                                       */
763   /* <Fields>                                                              */
764   /*    glyph_code :: The element's glyph index.                           */
765   /*                                                                       */
766   /*    x_offset   :: The element's left bearing.                          */
767   /*                                                                       */
768   /*    y_offset   :: The element's top bearing.                           */
769   /*                                                                       */
770   typedef struct  TT_SBit_Component_
771   {
772     FT_UShort  glyph_code;
773     FT_Char    x_offset;
774     FT_Char    y_offset;
775
776   } TT_SBit_Component;
777
778
779   /*************************************************************************/
780   /*                                                                       */
781   /* <Struct>                                                              */
782   /*    TT_SBit_Scale                                                      */
783   /*                                                                       */
784   /* <Description>                                                         */
785   /*    A structure used describe a given bitmap scaling table, as defined */
786   /*    in the `EBSC' table.                                               */
787   /*                                                                       */
788   /* <Fields>                                                              */
789   /*    hori              :: The horizontal line metrics.                  */
790   /*                                                                       */
791   /*    vert              :: The vertical line metrics.                    */
792   /*                                                                       */
793   /*    x_ppem            :: The number of horizontal pixels per EM.       */
794   /*                                                                       */
795   /*    y_ppem            :: The number of vertical pixels per EM.         */
796   /*                                                                       */
797   /*    x_ppem_substitute :: Substitution x_ppem value.                    */
798   /*                                                                       */
799   /*    y_ppem_substitute :: Substitution y_ppem value.                    */
800   /*                                                                       */
801   typedef struct  TT_SBit_Scale_
802   {
803     TT_SBit_Line_Metrics  hori;
804     TT_SBit_Line_Metrics  vert;
805
806     FT_Byte               x_ppem;
807     FT_Byte               y_ppem;
808
809     FT_Byte               x_ppem_substitute;
810     FT_Byte               y_ppem_substitute;
811
812   } TT_SBit_Scale;
813
814
815   /*************************************************************************/
816   /*************************************************************************/
817   /*************************************************************************/
818   /***                                                                   ***/
819   /***                                                                   ***/
820   /***                  POSTSCRIPT GLYPH NAMES SUPPORT                   ***/
821   /***                                                                   ***/
822   /***                                                                   ***/
823   /*************************************************************************/
824   /*************************************************************************/
825   /*************************************************************************/
826
827
828   /*************************************************************************/
829   /*                                                                       */
830   /* <Struct>                                                              */
831   /*    TT_Post_20                                                         */
832   /*                                                                       */
833   /* <Description>                                                         */
834   /*    Postscript names sub-table, format 2.0.  Stores the PS name of     */
835   /*    each glyph in the font face.                                       */
836   /*                                                                       */
837   /* <Fields>                                                              */
838   /*    num_glyphs    :: The number of named glyphs in the table.          */
839   /*                                                                       */
840   /*    num_names     :: The number of PS names stored in the table.       */
841   /*                                                                       */
842   /*    glyph_indices :: The indices of the glyphs in the names arrays.    */
843   /*                                                                       */
844   /*    glyph_names   :: The PS names not in Mac Encoding.                 */
845   /*                                                                       */
846   typedef struct  TT_Post_20_
847   {
848     FT_UShort   num_glyphs;
849     FT_UShort   num_names;
850     FT_UShort*  glyph_indices;
851     FT_Char**   glyph_names;
852
853   } TT_Post_20;
854
855
856   /*************************************************************************/
857   /*                                                                       */
858   /* <Struct>                                                              */
859   /*    TT_Post_25                                                         */
860   /*                                                                       */
861   /* <Description>                                                         */
862   /*    Postscript names sub-table, format 2.5.  Stores the PS name of     */
863   /*    each glyph in the font face.                                       */
864   /*                                                                       */
865   /* <Fields>                                                              */
866   /*    num_glyphs :: The number of glyphs in the table.                   */
867   /*                                                                       */
868   /*    offsets    :: An array of signed offsets in a normal Mac           */
869   /*                  Postscript name encoding.                            */
870   /*                                                                       */
871   typedef struct  TT_Post_25_
872   {
873     FT_UShort  num_glyphs;
874     FT_Char*   offsets;
875
876   } TT_Post_25;
877
878
879   /*************************************************************************/
880   /*                                                                       */
881   /* <Struct>                                                              */
882   /*    TT_Post_Names                                                      */
883   /*                                                                       */
884   /* <Description>                                                         */
885   /*    Postscript names table, either format 2.0 or 2.5.                  */
886   /*                                                                       */
887   /* <Fields>                                                              */
888   /*    loaded    :: A flag to indicate whether the PS names are loaded.   */
889   /*                                                                       */
890   /*    format_20 :: The sub-table used for format 2.0.                    */
891   /*                                                                       */
892   /*    format_25 :: The sub-table used for format 2.5.                    */
893   /*                                                                       */
894   typedef struct  TT_Post_Names_
895   {
896     FT_Bool       loaded;
897
898     union
899     {
900       TT_Post_20  format_20;
901       TT_Post_25  format_25;
902
903     } names;
904
905   } TT_Post_Names;
906
907
908   /*************************************************************************/
909   /*************************************************************************/
910   /*************************************************************************/
911   /***                                                                   ***/
912   /***                                                                   ***/
913   /***                  TRUETYPE CHARMAPS SUPPORT                        ***/
914   /***                                                                   ***/
915   /***                                                                   ***/
916   /*************************************************************************/
917   /*************************************************************************/
918   /*************************************************************************/
919
920
921   /* format 0 */
922
923   typedef struct  TT_CMap0_
924   {
925     FT_ULong  language;       /* for Mac fonts (originally ushort) */
926
927     FT_Byte*  glyphIdArray;
928
929   } TT_CMap0;
930
931
932   /* format 2 */
933
934   typedef struct  TT_CMap2SubHeader_
935   {
936     FT_UShort  firstCode;      /* first valid low byte         */
937     FT_UShort  entryCount;     /* number of valid low bytes    */
938     FT_Short   idDelta;        /* delta value to glyphIndex    */
939     FT_UShort  idRangeOffset;  /* offset from here to 1st code */
940
941   } TT_CMap2SubHeader;
942
943
944   typedef struct  TT_CMap2_
945   {
946     FT_ULong            language;     /* for Mac fonts (originally ushort) */
947
948     FT_UShort*          subHeaderKeys;
949     /* high byte mapping table            */
950     /* value = subHeader index * 8        */
951
952     TT_CMap2SubHeader*  subHeaders;
953     FT_UShort*          glyphIdArray;
954     FT_UShort           numGlyphId;   /* control value */
955
956   } TT_CMap2;
957
958
959   /* format 4 */
960
961   typedef struct  TT_CMap4Segment_
962   {
963     FT_UShort  endCount;
964     FT_UShort  startCount;
965     FT_Short   idDelta;
966     FT_UShort  idRangeOffset;
967
968   } TT_CMap4Segment;
969
970
971   typedef struct  TT_CMap4_
972   {
973     FT_ULong          language;       /* for Mac fonts (originally ushort) */
974
975     FT_UShort         segCountX2;     /* number of segments * 2            */
976     FT_UShort         searchRange;    /* these parameters can be used      */
977     FT_UShort         entrySelector;  /* for a binary search               */
978     FT_UShort         rangeShift;
979
980     TT_CMap4Segment*  segments;
981     FT_UShort*        glyphIdArray;
982     FT_UShort         numGlyphId;    /* control value */
983
984     TT_CMap4Segment*  last_segment;  /* last used segment; this is a small  */
985                                      /* cache to potentially increase speed */
986   } TT_CMap4;
987
988
989   /* format 6 */
990
991   typedef struct  TT_CMap6_
992   {
993     FT_ULong    language;       /* for Mac fonts (originally ushort)     */
994
995     FT_UShort   firstCode;      /* first character code of subrange      */
996     FT_UShort   entryCount;     /* number of character codes in subrange */
997
998     FT_UShort*  glyphIdArray;
999
1000   } TT_CMap6;
1001
1002
1003   /* auxiliary table for format 8 and 12 */
1004
1005   typedef struct  TT_CMapGroup_
1006   {
1007     FT_ULong  startCharCode;
1008     FT_ULong  endCharCode;
1009     FT_ULong  startGlyphID;
1010
1011   } TT_CMapGroup;
1012
1013
1014   /* FreeType handles format 8 and 12 identically.  It is not necessary to
1015      cover mixed 16bit and 32bit codes since FreeType always uses FT_ULong
1016      for input character codes -- converting Unicode surrogates to 32bit
1017      character codes must be done by the application.                      */
1018
1019   typedef struct  TT_CMap8_12_
1020   {
1021     FT_ULong       language;        /* for Mac fonts */
1022
1023     FT_ULong       nGroups;
1024     TT_CMapGroup*  groups;
1025
1026     TT_CMapGroup*  last_group;      /* last used group; this is a small    */
1027                                     /* cache to potentially increase speed */
1028   } TT_CMap8_12;
1029
1030
1031   /* format 10 */
1032
1033   typedef struct  TT_CMap10_
1034   {
1035     FT_ULong    language;           /* for Mac fonts */
1036
1037     FT_ULong    startCharCode;      /* first character covered */
1038     FT_ULong    numChars;           /* number of characters covered */
1039
1040     FT_UShort*  glyphs;
1041
1042   } TT_CMap10;
1043
1044
1045   typedef struct TT_CMapTable_  TT_CMapTable;
1046
1047
1048   typedef FT_UInt
1049   (*TT_CharMap_Func)( TT_CMapTable*  charmap,
1050                       FT_ULong       char_code );
1051
1052
1053   /* charmap table */
1054   struct  TT_CMapTable_
1055   {
1056     FT_UShort  platformID;
1057     FT_UShort  platformEncodingID;
1058     FT_UShort  format;
1059     FT_ULong   length;          /* must be ulong for formats 8, 10, and 12 */
1060
1061     FT_Bool    loaded;
1062     FT_ULong   offset;
1063
1064     union
1065     {
1066       TT_CMap0     cmap0;
1067       TT_CMap2     cmap2;
1068       TT_CMap4     cmap4;
1069       TT_CMap6     cmap6;
1070       TT_CMap8_12  cmap8_12;
1071       TT_CMap10    cmap10;
1072     } c;
1073
1074     TT_CharMap_Func  get_index;
1075   };
1076
1077
1078   /*************************************************************************/
1079   /*                                                                       */
1080   /* <Struct>                                                              */
1081   /*    TT_CharMapRec                                                      */
1082   /*                                                                       */
1083   /* <Description>                                                         */
1084   /*    The TrueType character map object type.                            */
1085   /*                                                                       */
1086   /* <Fields>                                                              */
1087   /*    root :: The parent character map structure.                        */
1088   /*                                                                       */
1089   /*    cmap :: The used character map.                                    */
1090   /*                                                                       */
1091   typedef struct  TT_CharMapRec_
1092   {
1093     FT_CharMapRec  root;
1094     TT_CMapTable   cmap;
1095
1096   } TT_CharMapRec;
1097
1098
1099   /*************************************************************************/
1100   /*************************************************************************/
1101   /*************************************************************************/
1102   /***                                                                   ***/
1103   /***                                                                   ***/
1104   /***                  ORIGINAL TT_FACE CLASS DEFINITION                ***/
1105   /***                                                                   ***/
1106   /***                                                                   ***/
1107   /*************************************************************************/
1108   /*************************************************************************/
1109   /*************************************************************************/
1110
1111
1112   /*************************************************************************/
1113   /*                                                                       */
1114   /* This structure/class is defined here because it is common to the      */
1115   /* following formats: TTF, OpenType-TT, and OpenType-CFF.                */
1116   /*                                                                       */
1117   /* Note, however, that the classes TT_Size, TT_GlyphSlot, and TT_CharMap */
1118   /* are not shared between font drivers, and are thus defined normally in */
1119   /* `ttobjs.h'.                                                           */
1120   /*                                                                       */
1121   /*************************************************************************/
1122
1123
1124   /*************************************************************************/
1125   /*                                                                       */
1126   /* <Type>                                                                */
1127   /*    TT_Face                                                            */
1128   /*                                                                       */
1129   /* <Description>                                                         */
1130   /*    A handle to a TrueType face/font object.  A TT_Face encapsulates   */
1131   /*    the resolution and scaling independent parts of a TrueType font    */
1132   /*    resource.                                                          */
1133   /*                                                                       */
1134   /* <Note>                                                                */
1135   /*    The TT_Face structure is also used as a `parent class' for the     */
1136   /*    OpenType-CFF class (T2_Face).                                      */
1137   /*                                                                       */
1138   typedef struct TT_FaceRec_*  TT_Face;
1139
1140
1141   /*************************************************************************/
1142   /*                                                                       */
1143   /* <Type>                                                                */
1144   /*    TT_CharMap                                                         */
1145   /*                                                                       */
1146   /* <Description>                                                         */
1147   /*    A handle to a TrueType character mapping object.                   */
1148   /*                                                                       */
1149   typedef struct TT_CharMapRec_*  TT_CharMap;
1150
1151
1152   /* a function type used for the truetype bytecode interpreter hooks */
1153   typedef FT_Error
1154   (*TT_Interpreter)( void*  exec_context );
1155
1156   /* forward declaration */
1157   typedef struct TT_Loader_  TT_Loader;
1158
1159
1160   /*************************************************************************/
1161   /*                                                                       */
1162   /* <FuncType>                                                            */
1163   /*    TT_Goto_Table_Func                                                 */
1164   /*                                                                       */
1165   /* <Description>                                                         */
1166   /*    Seeks a stream to the start of a given TrueType table.             */
1167   /*                                                                       */
1168   /* <Input>                                                               */
1169   /*    face   :: A handle to the target face object.                      */
1170   /*                                                                       */
1171   /*    tag    :: A 4-byte tag used to name the table.                     */
1172   /*                                                                       */
1173   /*    stream :: The input stream.                                        */
1174   /*                                                                       */
1175   /* <Output>                                                              */
1176   /*    length :: The length of the table in bytes.  Set to 0 if not       */
1177   /*              needed.                                                  */
1178   /*                                                                       */
1179   /* <Return>                                                              */
1180   /*    FreeType error code.  0 means success.                             */
1181   /*                                                                       */
1182   /* <Note>                                                                */
1183   /*    The stream cursor must be at the font file's origin.               */
1184   /*                                                                       */
1185   typedef FT_Error
1186   (*TT_Goto_Table_Func)( TT_Face    face,
1187                          FT_ULong   tag,
1188                          FT_Stream  stream,
1189                          FT_ULong*  length );
1190
1191
1192   /*************************************************************************/
1193   /*                                                                       */
1194   /* <FuncType>                                                            */
1195   /*    TT_Access_Glyph_Frame_Func                                         */
1196   /*                                                                       */
1197   /* <Description>                                                         */
1198   /*    Seeks a stream to the start of a given glyph element, and opens a  */
1199   /*    frame for it.                                                      */
1200   /*                                                                       */
1201   /* <Input>                                                               */
1202   /*    loader      :: The current TrueType glyph loader object.           */
1203   /*                                                                       */
1204   /*    glyph index :: The index of the glyph to access.                   */
1205   /*                                                                       */
1206   /*    offset      :: The offset of the glyph according to the            */
1207   /*                   `locations' table.                                  */
1208   /*                                                                       */
1209   /*    byte_count  :: The size of the frame in bytes.                     */
1210   /*                                                                       */
1211   /* <Return>                                                              */
1212   /*    FreeType error code.  0 means success.                             */
1213   /*                                                                       */
1214   /* <Note>                                                                */
1215   /*    This function is normally equivalent to FILE_Seek(offset)          */
1216   /*    followed by ACCESS_Frame(byte_count) with the loader's stream, but */
1217   /*    alternative formats (e.g. compressed ones) might use something     */
1218   /*    different.                                                         */
1219   /*                                                                       */
1220   typedef FT_Error
1221   (*TT_Access_Glyph_Frame_Func)( TT_Loader*  loader,
1222                                  FT_UInt     glyph_index,
1223                                  FT_ULong    offset,
1224                                  FT_UInt     byte_count );
1225
1226
1227   /*************************************************************************/
1228   /*                                                                       */
1229   /* <FuncType>                                                            */
1230   /*    TT_Load_Glyph_Element_Func                                         */
1231   /*                                                                       */
1232   /* <Description>                                                         */
1233   /*    Reads one glyph element (its header, a simple glyph, or a          */
1234   /*    composite) from the loader's current stream frame.                 */
1235   /*                                                                       */
1236   /* <Input>                                                               */
1237   /*    loader :: The current TrueType glyph loader object.                */
1238   /*                                                                       */
1239   /* <Return>                                                              */
1240   /*    FreeType error code.  0 means success.                             */
1241   /*                                                                       */
1242   typedef FT_Error
1243   (*TT_Load_Glyph_Element_Func)( TT_Loader*  loader );
1244
1245
1246   /*************************************************************************/
1247   /*                                                                       */
1248   /* <FuncType>                                                            */
1249   /*    TT_Forget_Glyph_Frame_Func                                         */
1250   /*                                                                       */
1251   /* <Description>                                                         */
1252   /*    Closes the current loader stream frame for the glyph.              */
1253   /*                                                                       */
1254   /* <Input>                                                               */
1255   /*    loader :: The current TrueType glyph loader object.                */
1256   /*                                                                       */
1257   typedef void
1258   (*TT_Forget_Glyph_Frame_Func)( TT_Loader*  loader );
1259
1260
1261
1262   /*************************************************************************/
1263   /*                                                                       */
1264   /*                         TrueType Face Type                            */
1265   /*                                                                       */
1266   /* <Struct>                                                              */
1267   /*    TT_Face                                                            */
1268   /*                                                                       */
1269   /* <Description>                                                         */
1270   /*    The TrueType face class.  These objects model the resolution and   */
1271   /*    point-size independent data found in a TrueType font file.         */
1272   /*                                                                       */
1273   /* <Fields>                                                              */
1274   /*    root                 :: The base FT_Face structure, managed by the */
1275   /*                            base layer.                                */
1276   /*                                                                       */
1277   /*    ttc_header           :: The TrueType collection header, used when  */
1278   /*                            the file is a `ttc' rather than a `ttf'.   */
1279   /*                            For ordinary font files, the field         */
1280   /*                            `ttc_header.count' is set to 0.            */
1281   /*                                                                       */
1282   /*    format_tag           :: The font format tag.                       */
1283   /*                                                                       */
1284   /*    num_tables           :: The number of TrueType tables in this font */
1285   /*                            file.                                      */
1286   /*                                                                       */
1287   /*    dir_tables           :: The directory of TrueType tables for this  */
1288   /*                            font file.                                 */
1289   /*                                                                       */
1290   /*    header               :: The font's font header (`head' table).     */
1291   /*                            Read on font opening.                      */
1292   /*                                                                       */
1293   /*    horizontal           :: The font's horizontal header (`hhea'       */
1294   /*                            table).  This field also contains the      */
1295   /*                            associated horizontal metrics table        */
1296   /*                            (`hmtx').                                  */
1297   /*                                                                       */
1298   /*    max_profile          :: The font's maximum profile table.  Read on */
1299   /*                            font opening.  Note that some maximum      */
1300   /*                            values cannot be taken directly from this  */
1301   /*                            table.  We thus define additional fields   */
1302   /*                            below to hold the computed maxima.         */
1303   /*                                                                       */
1304   /*    max_components       :: The maximum number of glyph components     */
1305   /*                            required to load any composite glyph from  */
1306   /*                            this font.  Used to size the load stack.   */
1307   /*                                                                       */
1308   /*    vertical_info        :: A boolean which is set when the font file  */
1309   /*                            contains vertical metrics.  If not, the    */
1310   /*                            value of the `vertical' field is           */
1311   /*                            undefined.                                 */
1312   /*                                                                       */
1313   /*    vertical             :: The font's vertical header (`vhea' table). */
1314   /*                            This field also contains the associated    */
1315   /*                            vertical metrics table (`vmtx'), if found. */
1316   /*                            IMPORTANT: The contents of this field is   */
1317   /*                            undefined if the `verticalInfo' field is   */
1318   /*                            unset.                                     */
1319   /*                                                                       */
1320   /*    num_names            :: The number of name records within this     */
1321   /*                            TrueType font.                             */
1322   /*                                                                       */
1323   /*    name_table           :: The table of name records (`name').        */
1324   /*                                                                       */
1325   /*    os2                  :: The font's OS/2 table (`OS/2').            */
1326   /*                                                                       */
1327   /*    postscript           :: The font's PostScript table (`post'        */
1328   /*                            table).  The PostScript glyph names are    */
1329   /*                            not loaded by the driver on face opening.  */
1330   /*                            See the `ttpost' module for more details.  */
1331   /*                                                                       */
1332   /*    num_charmaps         :: The number of character mappings in the    */
1333   /*                            font.                                      */
1334   /*                                                                       */
1335   /*    charmaps             :: The array of charmap objects for this font */
1336   /*                            file.  Note that this field is a typeless  */
1337   /*                            pointer.  The Reason is that the format of */
1338   /*                            charmaps varies with the underlying font   */
1339   /*                            format and cannot be determined here.      */
1340   /*                                                                       */
1341   /*    goto_table           :: A function called by each TrueType table   */
1342   /*                            loader to position a stream's cursor to    */
1343   /*                            the start of a given table according to    */
1344   /*                            its tag.  It defaults to TT_Goto_Face but  */
1345   /*                            can be different for strange formats (e.g. */
1346   /*                            Type 42).                                  */
1347   /*                                                                       */
1348   /*    access_glyph_frame   :: XXX                                        */
1349   /*                                                                       */
1350   /*    read_glyph_header    :: XXX                                        */
1351   /*                                                                       */
1352   /*    read_simple_glyph    :: XXX                                        */
1353   /*                                                                       */
1354   /*    read_composite_glyph :: XXX                                        */
1355   /*                                                                       */
1356   /*    forget_glyph_frame   :: XXX                                        */
1357   /*                                                                       */
1358   /*    sfnt                 :: A pointer to the SFNT `driver' interface.  */
1359   /*                                                                       */
1360   /*    psnames              :: A pointer to the `PSNames' module          */
1361   /*                            interface.                                 */
1362   /*                                                                       */
1363   /*    hdmx                 :: The face's horizontal device metrics       */
1364   /*                            (`hdmx' table).  This table is optional in */
1365   /*                            TrueType/OpenType fonts.                   */
1366   /*                                                                       */
1367   /*    gasp                 :: The grid-fitting and scaling properties    */
1368   /*                            table (`gasp').  This table is optional in */
1369   /*                            TrueType/OpenType fonts.                   */
1370   /*                                                                       */
1371   /*    pclt                 :: XXX                                        */
1372   /*                                                                       */
1373   /*    num_sbit_strikes     :: The number of sbit strikes, i.e., bitmap   */
1374   /*                            sizes, embedded in this font.              */
1375   /*                                                                       */
1376   /*    sbit_strikes         :: An array of sbit strikes embedded in this  */
1377   /*                            font.  This table is optional in a         */
1378   /*                            TrueType/OpenType font.                    */
1379   /*                                                                       */
1380   /*    num_sbit_scales      :: The number of sbit scales for this font.   */
1381   /*                                                                       */
1382   /*    sbit_scales          :: Array of sbit scales embedded in this      */
1383   /*                            font.  This table is optional in a         */
1384   /*                            TrueType/OpenType font.                    */
1385   /*                                                                       */
1386   /*    postscript_names     :: A table used to store the Postscript names */
1387   /*                            of  the glyphs for this font.  See the     */
1388   /*                            file  `ttconfig.h' for comments on the     */
1389   /*                            TT_CONFIG_OPTION_POSTSCRIPT_NAMES option.  */
1390   /*                                                                       */
1391   /*    num_locations        :: The number of glyph locations in this      */
1392   /*                            TrueType file.  This should be             */
1393   /*                            identical to the number of glyphs.         */
1394   /*                            Ignored for Type 2 fonts.                  */
1395   /*                                                                       */
1396   /*    glyph_locations      :: An array of longs.  These are offsets to   */
1397   /*                            glyph data within the `glyf' table.        */
1398   /*                            Ignored for Type 2 font faces.             */
1399   /*                                                                       */
1400   /*    font_program_size    :: Size in bytecodes of the face's font       */
1401   /*                            program.  0 if none defined.  Ignored for  */
1402   /*                            Type 2 fonts.                              */
1403   /*                                                                       */
1404   /*    font_program         :: The face's font program (bytecode stream)  */
1405   /*                            executed at load time, also used during    */
1406   /*                            glyph rendering.  Comes from the `fpgm'    */
1407   /*                            table.  Ignored for Type 2 font fonts.     */
1408   /*                                                                       */
1409   /*    cvt_program_size     :: The size in bytecodes of the face's cvt    */
1410   /*                            program.  Ignored for Type 2 fonts.        */
1411   /*                                                                       */
1412   /*    cvt_program          :: The face's cvt program (bytecode stream)   */
1413   /*                            executed each time an instance/size is     */
1414   /*                            changed/reset.  Comes from the `prep'      */
1415   /*                            table.  Ignored for Type 2 fonts.          */
1416   /*                                                                       */
1417   /*    cvt_size             :: Size of the control value table (in        */
1418   /*                            entries).   Ignored for Type 2 fonts.      */
1419   /*                                                                       */
1420   /*    cvt                  :: The face's original control value table.   */
1421   /*                            Coordinates are expressed in unscaled font */
1422   /*                            units.  Comes from the `cvt ' table.       */
1423   /*                            Ignored for Type 2 fonts.                  */
1424   /*                                                                       */
1425   /*    num_kern_pairs       :: The number of kerning pairs present in the */
1426   /*                            font file.  The engine only loads the      */
1427   /*                            first horizontal format 0 kern table it    */
1428   /*                            finds in the font file.  You should use    */
1429   /*                            the `ttxkern' structures if you want to    */
1430   /*                            access other kerning tables.  Ignored      */
1431   /*                            for Type 2 fonts.                          */
1432   /*                                                                       */
1433   /*    kern_table_index     :: The index of the kerning table in the font */
1434   /*                            kerning directory.  Only used by the       */
1435   /*                            ttxkern extension to avoid data            */
1436   /*                            duplication.  Ignored for Type 2 fonts.    */
1437   /*                                                                       */
1438   /*    interpreter          :: A pointer to the TrueType bytecode         */
1439   /*                            interpreters field is also used to hook    */
1440   /*                            the debugger in `ttdebug'.                 */
1441   /*                                                                       */
1442   /*    extra                :: XXX                                        */
1443   /*                                                                       */
1444   typedef struct  TT_FaceRec_
1445   {
1446     FT_FaceRec         root;
1447
1448     TTC_Header         ttc_header;
1449
1450     FT_ULong           format_tag;
1451     FT_UShort          num_tables;
1452     TT_Table*          dir_tables;
1453
1454     TT_Header          header;       /* TrueType header table          */
1455     TT_HoriHeader      horizontal;   /* TrueType horizontal header     */
1456
1457     TT_MaxProfile      max_profile;
1458     FT_ULong           max_components;
1459
1460     FT_Bool            vertical_info;
1461     TT_VertHeader      vertical;     /* TT Vertical header, if present */
1462
1463     FT_UShort          num_names;    /* number of name records  */
1464     TT_NameTable       name_table;   /* name table              */
1465
1466     TT_OS2             os2;          /* TrueType OS/2 table            */
1467     TT_Postscript      postscript;   /* TrueType Postscript table      */
1468
1469     FT_Int             num_charmaps;
1470     TT_CharMap         charmaps;     /* array of TT_CharMapRec */
1471
1472     TT_Goto_Table_Func          goto_table;
1473
1474     TT_Access_Glyph_Frame_Func  access_glyph_frame;
1475     TT_Load_Glyph_Element_Func  read_glyph_header;
1476     TT_Load_Glyph_Element_Func  read_simple_glyph;
1477     TT_Load_Glyph_Element_Func  read_composite_glyph;
1478     TT_Forget_Glyph_Frame_Func  forget_glyph_frame;
1479
1480     /* a typeless pointer to the SFNT_Interface table used to load     */
1481     /* the basic TrueType tables in the face object                    */
1482     void*              sfnt;
1483
1484     /* a typeless pointer to the PSNames_Interface table used to       */
1485     /* handle glyph names <-> unicode & Mac values                     */
1486     void*              psnames;
1487
1488     /***********************************************************************/
1489     /*                                                                     */
1490     /* Optional TrueType/OpenType tables                                   */
1491     /*                                                                     */
1492     /***********************************************************************/
1493
1494     /* horizontal device metrics */
1495     TT_Hdmx            hdmx;
1496
1497     /* grid-fitting and scaling table */
1498     TT_Gasp            gasp;                 /* the `gasp' table */
1499
1500     /* PCL 5 table */
1501     TT_PCLT            pclt;
1502
1503     /* embedded bitmaps support */
1504     FT_Int             num_sbit_strikes;
1505     TT_SBit_Strike*    sbit_strikes;
1506
1507     FT_Int             num_sbit_scales;
1508     TT_SBit_Scale*     sbit_scales;
1509
1510     /* postscript names table */
1511     TT_Post_Names      postscript_names;
1512
1513
1514     /***********************************************************************/
1515     /*                                                                     */
1516     /* TrueType-specific fields (ignored by the OTF-Type2 driver)          */
1517     /*                                                                     */
1518     /***********************************************************************/
1519
1520     /* the glyph locations */
1521     FT_UShort          num_locations;
1522     FT_Long*           glyph_locations;
1523
1524     /* the font program, if any */
1525     FT_ULong           font_program_size;
1526     FT_Byte*           font_program;
1527
1528     /* the cvt program, if any */
1529     FT_ULong           cvt_program_size;
1530     FT_Byte*           cvt_program;
1531
1532     /* the original, unscaled, control value table */
1533     FT_ULong           cvt_size;
1534     FT_Short*          cvt;
1535
1536     /* the format 0 kerning table, if any */
1537     FT_Int             num_kern_pairs;
1538     FT_Int             kern_table_index;
1539     TT_Kern_0_Pair*    kern_pairs;
1540
1541     /* A pointer to the bytecode interpreter to use.  This is also */
1542     /* used to hook the debugger for the `ttdebug' utility.        */
1543     TT_Interpreter     interpreter;
1544
1545
1546     /***********************************************************************/
1547     /*                                                                     */
1548     /* Other tables or fields. This is used by derivative formats like     */
1549     /* OpenType.                                                           */
1550     /*                                                                     */
1551     /***********************************************************************/
1552
1553     FT_Generic      extra;
1554
1555   } TT_FaceRec;
1556
1557
1558   /*************************************************************************/
1559   /*                                                                       */
1560   /*  <Struct>                                                             */
1561   /*     TT_GlyphZone                                                      */
1562   /*                                                                       */
1563   /*  <Description>                                                        */
1564   /*     A glyph zone is used to load, scale and hint glyph outline        */
1565   /*     coordinates.                                                      */
1566   /*                                                                       */
1567   /*  <Fields>                                                             */
1568   /*     memory       :: A handle to the memory manager.                   */
1569   /*                                                                       */
1570   /*     max_points   :: The maximal size in points of the zone.           */
1571   /*                                                                       */
1572   /*     max_contours :: Max size in links contours of thez one.           */
1573   /*                                                                       */
1574   /*     n_points     :: The current number of points in the zone.         */
1575   /*                                                                       */
1576   /*     n_contours   :: The current number of contours in the zone.       */
1577   /*                                                                       */
1578   /*     org          :: The original glyph coordinates (font              */
1579   /*                     units/scaled).                                    */
1580   /*                                                                       */
1581   /*     cur          :: The current glyph coordinates (scaled/hinted).    */
1582   /*                                                                       */
1583   /*     tags         :: The point control tags.                           */
1584   /*                                                                       */
1585   /*     contours     :: The contours end points.                          */
1586   /*                                                                       */
1587   typedef struct  TT_GlyphZone_
1588   {
1589     FT_Memory   memory;
1590     FT_UShort   max_points;
1591     FT_UShort   max_contours;
1592     FT_UShort   n_points;   /* number of points in zone    */
1593     FT_Short    n_contours; /* number of contours          */
1594
1595     FT_Vector*  org;        /* original point coordinates  */
1596     FT_Vector*  cur;        /* current point coordinates   */
1597
1598     FT_Byte*    tags;       /* current touch flags         */
1599     FT_UShort*  contours;   /* contour end points          */
1600
1601   } TT_GlyphZone;
1602
1603
1604   /* handle to execution context */
1605   typedef struct TT_ExecContextRec_*  TT_ExecContext;
1606
1607   /* glyph loader structure */
1608   struct  TT_Loader_
1609   {
1610     FT_Face          face;
1611     FT_Size          size;
1612     FT_GlyphSlot     glyph;
1613     FT_GlyphLoader*  gloader;
1614
1615     FT_ULong         load_flags;
1616     FT_UInt          glyph_index;
1617
1618     FT_Stream        stream;
1619     FT_Int           byte_len;
1620
1621     FT_Short         n_contours;
1622     FT_BBox          bbox;
1623     FT_Int           left_bearing;
1624     FT_Int           advance;
1625     FT_Int           linear;
1626     FT_Bool          linear_def;
1627     FT_Bool          preserve_pps;
1628     FT_Vector        pp1;
1629     FT_Vector        pp2;
1630
1631     FT_ULong         glyf_offset;
1632
1633     /* the zone where we load our glyphs */
1634     TT_GlyphZone     base;
1635     TT_GlyphZone     zone;
1636
1637     TT_ExecContext   exec;
1638     FT_Byte*         instructions;
1639     FT_ULong         ins_pos;
1640
1641     /* for possible extensibility in other formats */
1642     void*            other;
1643
1644   };
1645
1646
1647 FT_END_HEADER
1648
1649 #endif /* __TTTYPES_H__ */
1650
1651
1652 /* END */