Add the license back to ftmodule.h after the freetype 2.5.4 upgrade.
[pdfium.git] / third_party / freetype / include / tttables.h
1 /***************************************************************************/
2 /*                                                                         */
3 /*  tttables.h                                                             */
4 /*                                                                         */
5 /*    Basic SFNT/TrueType tables definitions and interface                 */
6 /*    (specification only).                                                */
7 /*                                                                         */
8 /*  Copyright 1996-2005, 2008-2014 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 __TTTABLES_H__
21 #define __TTTABLES_H__
22
23
24 #include <ft2build.h>
25 #include FT_FREETYPE_H
26
27 #ifdef FREETYPE_H
28 #error "freetype.h of FreeType 1 has been loaded!"
29 #error "Please fix the directory search order for header files"
30 #error "so that freetype.h of FreeType 2 is found first."
31 #endif
32
33
34 FT_BEGIN_HEADER
35
36   /*************************************************************************/
37   /*                                                                       */
38   /* <Section>                                                             */
39   /*    truetype_tables                                                    */
40   /*                                                                       */
41   /* <Title>                                                               */
42   /*    TrueType Tables                                                    */
43   /*                                                                       */
44   /* <Abstract>                                                            */
45   /*    TrueType specific table types and functions.                       */
46   /*                                                                       */
47   /* <Description>                                                         */
48   /*    This section contains the definition of TrueType-specific tables   */
49   /*    as well as some routines used to access and process them.          */
50   /*                                                                       */
51   /* <Order>                                                               */
52   /*    TT_Header                                                          */
53   /*    TT_HoriHeader                                                      */
54   /*    TT_VertHeader                                                      */
55   /*    TT_OS2                                                             */
56   /*    TT_Postscript                                                      */
57   /*    TT_PCLT                                                            */
58   /*    TT_MaxProfile                                                      */
59   /*                                                                       */
60   /*    FT_Sfnt_Tag                                                        */
61   /*    FT_Get_Sfnt_Table                                                  */
62   /*    FT_Load_Sfnt_Table                                                 */
63   /*    FT_Sfnt_Table_Info                                                 */
64   /*                                                                       */
65   /*    FT_Get_CMap_Language_ID                                            */
66   /*    FT_Get_CMap_Format                                                 */
67   /*                                                                       */
68   /*    FT_PARAM_TAG_UNPATENTED_HINTING                                    */
69   /*                                                                       */
70   /*************************************************************************/
71
72
73   /*************************************************************************/
74   /*                                                                       */
75   /* <Struct>                                                              */
76   /*    TT_Header                                                          */
77   /*                                                                       */
78   /* <Description>                                                         */
79   /*    A structure used to model a TrueType font header table.  All       */
80   /*    fields follow the TrueType specification.                          */
81   /*                                                                       */
82   typedef struct  TT_Header_
83   {
84     FT_Fixed   Table_Version;
85     FT_Fixed   Font_Revision;
86
87     FT_Long    CheckSum_Adjust;
88     FT_Long    Magic_Number;
89
90     FT_UShort  Flags;
91     FT_UShort  Units_Per_EM;
92
93     FT_Long    Created [2];
94     FT_Long    Modified[2];
95
96     FT_Short   xMin;
97     FT_Short   yMin;
98     FT_Short   xMax;
99     FT_Short   yMax;
100
101     FT_UShort  Mac_Style;
102     FT_UShort  Lowest_Rec_PPEM;
103
104     FT_Short   Font_Direction;
105     FT_Short   Index_To_Loc_Format;
106     FT_Short   Glyph_Data_Format;
107
108   } TT_Header;
109
110
111   /*************************************************************************/
112   /*                                                                       */
113   /* <Struct>                                                              */
114   /*    TT_HoriHeader                                                      */
115   /*                                                                       */
116   /* <Description>                                                         */
117   /*    A structure used to model a TrueType horizontal header, the `hhea' */
118   /*    table, as well as the corresponding horizontal metrics table,      */
119   /*    i.e., the `hmtx' table.                                            */
120   /*                                                                       */
121   /* <Fields>                                                              */
122   /*    Version                :: The table version.                       */
123   /*                                                                       */
124   /*    Ascender               :: The font's ascender, i.e., the distance  */
125   /*                              from the baseline to the top-most of all */
126   /*                              glyph points found in the font.          */
127   /*                                                                       */
128   /*                              This value is invalid in many fonts, as  */
129   /*                              it is usually set by the font designer,  */
130   /*                              and often reflects only a portion of the */
131   /*                              glyphs found in the font (maybe ASCII).  */
132   /*                                                                       */
133   /*                              You should use the `sTypoAscender' field */
134   /*                              of the OS/2 table instead if you want    */
135   /*                              the correct one.                         */
136   /*                                                                       */
137   /*    Descender              :: The font's descender, i.e., the distance */
138   /*                              from the baseline to the bottom-most of  */
139   /*                              all glyph points found in the font.  It  */
140   /*                              is negative.                             */
141   /*                                                                       */
142   /*                              This value is invalid in many fonts, as  */
143   /*                              it is usually set by the font designer,  */
144   /*                              and often reflects only a portion of the */
145   /*                              glyphs found in the font (maybe ASCII).  */
146   /*                                                                       */
147   /*                              You should use the `sTypoDescender'      */
148   /*                              field of the OS/2 table instead if you   */
149   /*                              want the correct one.                    */
150   /*                                                                       */
151   /*    Line_Gap               :: The font's line gap, i.e., the distance  */
152   /*                              to add to the ascender and descender to  */
153   /*                              get the BTB, i.e., the                   */
154   /*                              baseline-to-baseline distance for the    */
155   /*                              font.                                    */
156   /*                                                                       */
157   /*    advance_Width_Max      :: This field is the maximum of all advance */
158   /*                              widths found in the font.  It can be     */
159   /*                              used to compute the maximum width of an  */
160   /*                              arbitrary string of text.                */
161   /*                                                                       */
162   /*    min_Left_Side_Bearing  :: The minimum left side bearing of all     */
163   /*                              glyphs within the font.                  */
164   /*                                                                       */
165   /*    min_Right_Side_Bearing :: The minimum right side bearing of all    */
166   /*                              glyphs within the font.                  */
167   /*                                                                       */
168   /*    xMax_Extent            :: The maximum horizontal extent (i.e., the */
169   /*                              `width' of a glyph's bounding box) for   */
170   /*                              all glyphs in the font.                  */
171   /*                                                                       */
172   /*    caret_Slope_Rise       :: The rise coefficient of the cursor's     */
173   /*                              slope of the cursor (slope=rise/run).    */
174   /*                                                                       */
175   /*    caret_Slope_Run        :: The run coefficient of the cursor's      */
176   /*                              slope.                                   */
177   /*                                                                       */
178   /*    Reserved               :: 8~reserved bytes.                        */
179   /*                                                                       */
180   /*    metric_Data_Format     :: Always~0.                                */
181   /*                                                                       */
182   /*    number_Of_HMetrics     :: Number of HMetrics entries in the `hmtx' */
183   /*                              table -- this value can be smaller than  */
184   /*                              the total number of glyphs in the font.  */
185   /*                                                                       */
186   /*    long_metrics           :: A pointer into the `hmtx' table.         */
187   /*                                                                       */
188   /*    short_metrics          :: A pointer into the `hmtx' table.         */
189   /*                                                                       */
190   /* <Note>                                                                */
191   /*    IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should   */
192   /*               be identical except for the names of their fields,      */
193   /*               which are different.                                    */
194   /*                                                                       */
195   /*               This ensures that a single function in the `ttload'     */
196   /*               module is able to read both the horizontal and vertical */
197   /*               headers.                                                */
198   /*                                                                       */
199   typedef struct  TT_HoriHeader_
200   {
201     FT_Fixed   Version;
202     FT_Short   Ascender;
203     FT_Short   Descender;
204     FT_Short   Line_Gap;
205
206     FT_UShort  advance_Width_Max;      /* advance width maximum */
207
208     FT_Short   min_Left_Side_Bearing;  /* minimum left-sb       */
209     FT_Short   min_Right_Side_Bearing; /* minimum right-sb      */
210     FT_Short   xMax_Extent;            /* xmax extents          */
211     FT_Short   caret_Slope_Rise;
212     FT_Short   caret_Slope_Run;
213     FT_Short   caret_Offset;
214
215     FT_Short   Reserved[4];
216
217     FT_Short   metric_Data_Format;
218     FT_UShort  number_Of_HMetrics;
219
220     /* The following fields are not defined by the TrueType specification */
221     /* but they are used to connect the metrics header to the relevant    */
222     /* `HMTX' table.                                                      */
223
224     void*      long_metrics;
225     void*      short_metrics;
226
227   } TT_HoriHeader;
228
229
230   /*************************************************************************/
231   /*                                                                       */
232   /* <Struct>                                                              */
233   /*    TT_VertHeader                                                      */
234   /*                                                                       */
235   /* <Description>                                                         */
236   /*    A structure used to model a TrueType vertical header, the `vhea'   */
237   /*    table, as well as the corresponding vertical metrics table, i.e.,  */
238   /*    the `vmtx' table.                                                  */
239   /*                                                                       */
240   /* <Fields>                                                              */
241   /*    Version                 :: The table version.                      */
242   /*                                                                       */
243   /*    Ascender                :: The font's ascender, i.e., the distance */
244   /*                               from the baseline to the top-most of    */
245   /*                               all glyph points found in the font.     */
246   /*                                                                       */
247   /*                               This value is invalid in many fonts, as */
248   /*                               it is usually set by the font designer, */
249   /*                               and often reflects only a portion of    */
250   /*                               the glyphs found in the font (maybe     */
251   /*                               ASCII).                                 */
252   /*                                                                       */
253   /*                               You should use the `sTypoAscender'      */
254   /*                               field of the OS/2 table instead if you  */
255   /*                               want the correct one.                   */
256   /*                                                                       */
257   /*    Descender               :: The font's descender, i.e., the         */
258   /*                               distance from the baseline to the       */
259   /*                               bottom-most of all glyph points found   */
260   /*                               in the font.  It is negative.           */
261   /*                                                                       */
262   /*                               This value is invalid in many fonts, as */
263   /*                               it is usually set by the font designer, */
264   /*                               and often reflects only a portion of    */
265   /*                               the glyphs found in the font (maybe     */
266   /*                               ASCII).                                 */
267   /*                                                                       */
268   /*                               You should use the `sTypoDescender'     */
269   /*                               field of the OS/2 table instead if you  */
270   /*                               want the correct one.                   */
271   /*                                                                       */
272   /*    Line_Gap                :: The font's line gap, i.e., the distance */
273   /*                               to add to the ascender and descender to */
274   /*                               get the BTB, i.e., the                  */
275   /*                               baseline-to-baseline distance for the   */
276   /*                               font.                                   */
277   /*                                                                       */
278   /*    advance_Height_Max      :: This field is the maximum of all        */
279   /*                               advance heights found in the font.  It  */
280   /*                               can be used to compute the maximum      */
281   /*                               height of an arbitrary string of text.  */
282   /*                                                                       */
283   /*    min_Top_Side_Bearing    :: The minimum top side bearing of all     */
284   /*                               glyphs within the font.                 */
285   /*                                                                       */
286   /*    min_Bottom_Side_Bearing :: The minimum bottom side bearing of all  */
287   /*                               glyphs within the font.                 */
288   /*                                                                       */
289   /*    yMax_Extent             :: The maximum vertical extent (i.e., the  */
290   /*                               `height' of a glyph's bounding box) for */
291   /*                               all glyphs in the font.                 */
292   /*                                                                       */
293   /*    caret_Slope_Rise        :: The rise coefficient of the cursor's    */
294   /*                               slope of the cursor (slope=rise/run).   */
295   /*                                                                       */
296   /*    caret_Slope_Run         :: The run coefficient of the cursor's     */
297   /*                               slope.                                  */
298   /*                                                                       */
299   /*    caret_Offset            :: The cursor's offset for slanted fonts.  */
300   /*                               This value is `reserved' in vmtx        */
301   /*                               version 1.0.                            */
302   /*                                                                       */
303   /*    Reserved                :: 8~reserved bytes.                       */
304   /*                                                                       */
305   /*    metric_Data_Format      :: Always~0.                               */
306   /*                                                                       */
307   /*    number_Of_HMetrics      :: Number of VMetrics entries in the       */
308   /*                               `vmtx' table -- this value can be       */
309   /*                               smaller than the total number of glyphs */
310   /*                               in the font.                            */
311   /*                                                                       */
312   /*    long_metrics           :: A pointer into the `vmtx' table.         */
313   /*                                                                       */
314   /*    short_metrics          :: A pointer into the `vmtx' table.         */
315   /*                                                                       */
316   /* <Note>                                                                */
317   /*    IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should   */
318   /*               be identical except for the names of their fields,      */
319   /*               which are different.                                    */
320   /*                                                                       */
321   /*               This ensures that a single function in the `ttload'     */
322   /*               module is able to read both the horizontal and vertical */
323   /*               headers.                                                */
324   /*                                                                       */
325   typedef struct  TT_VertHeader_
326   {
327     FT_Fixed   Version;
328     FT_Short   Ascender;
329     FT_Short   Descender;
330     FT_Short   Line_Gap;
331
332     FT_UShort  advance_Height_Max;      /* advance height maximum */
333
334     FT_Short   min_Top_Side_Bearing;    /* minimum left-sb or top-sb       */
335     FT_Short   min_Bottom_Side_Bearing; /* minimum right-sb or bottom-sb   */
336     FT_Short   yMax_Extent;             /* xmax or ymax extents            */
337     FT_Short   caret_Slope_Rise;
338     FT_Short   caret_Slope_Run;
339     FT_Short   caret_Offset;
340
341     FT_Short   Reserved[4];
342
343     FT_Short   metric_Data_Format;
344     FT_UShort  number_Of_VMetrics;
345
346     /* The following fields are not defined by the TrueType specification */
347     /* but they're used to connect the metrics header to the relevant     */
348     /* `HMTX' or `VMTX' table.                                            */
349
350     void*      long_metrics;
351     void*      short_metrics;
352
353   } TT_VertHeader;
354
355
356   /*************************************************************************/
357   /*                                                                       */
358   /* <Struct>                                                              */
359   /*    TT_OS2                                                             */
360   /*                                                                       */
361   /* <Description>                                                         */
362   /*    A structure used to model a TrueType OS/2 table.  All fields       */
363   /*    comply to the OpenType specification.                              */
364   /*                                                                       */
365   /*    Note that we now support old Mac fonts that do not include an OS/2 */
366   /*    table.  In this case, the `version' field is always set to 0xFFFF. */
367   /*                                                                       */
368   typedef struct  TT_OS2_
369   {
370     FT_UShort  version;                /* 0x0001 - more or 0xFFFF */
371     FT_Short   xAvgCharWidth;
372     FT_UShort  usWeightClass;
373     FT_UShort  usWidthClass;
374     FT_Short   fsType;
375     FT_Short   ySubscriptXSize;
376     FT_Short   ySubscriptYSize;
377     FT_Short   ySubscriptXOffset;
378     FT_Short   ySubscriptYOffset;
379     FT_Short   ySuperscriptXSize;
380     FT_Short   ySuperscriptYSize;
381     FT_Short   ySuperscriptXOffset;
382     FT_Short   ySuperscriptYOffset;
383     FT_Short   yStrikeoutSize;
384     FT_Short   yStrikeoutPosition;
385     FT_Short   sFamilyClass;
386
387     FT_Byte    panose[10];
388
389     FT_ULong   ulUnicodeRange1;        /* Bits 0-31   */
390     FT_ULong   ulUnicodeRange2;        /* Bits 32-63  */
391     FT_ULong   ulUnicodeRange3;        /* Bits 64-95  */
392     FT_ULong   ulUnicodeRange4;        /* Bits 96-127 */
393
394     FT_Char    achVendID[4];
395
396     FT_UShort  fsSelection;
397     FT_UShort  usFirstCharIndex;
398     FT_UShort  usLastCharIndex;
399     FT_Short   sTypoAscender;
400     FT_Short   sTypoDescender;
401     FT_Short   sTypoLineGap;
402     FT_UShort  usWinAscent;
403     FT_UShort  usWinDescent;
404
405     /* only version 1 and higher: */
406
407     FT_ULong   ulCodePageRange1;       /* Bits 0-31   */
408     FT_ULong   ulCodePageRange2;       /* Bits 32-63  */
409
410     /* only version 2 and higher: */
411
412     FT_Short   sxHeight;
413     FT_Short   sCapHeight;
414     FT_UShort  usDefaultChar;
415     FT_UShort  usBreakChar;
416     FT_UShort  usMaxContext;
417
418     /* only version 5 and higher: */
419
420     FT_UShort  usLowerOpticalPointSize;       /* in twips (1/20th points) */
421     FT_UShort  usUpperOpticalPointSize;       /* in twips (1/20th points) */
422
423   } TT_OS2;
424
425
426   /*************************************************************************/
427   /*                                                                       */
428   /* <Struct>                                                              */
429   /*    TT_Postscript                                                      */
430   /*                                                                       */
431   /* <Description>                                                         */
432   /*    A structure used to model a TrueType PostScript table.  All fields */
433   /*    comply to the TrueType specification.  This structure does not     */
434   /*    reference the PostScript glyph names, which can be nevertheless    */
435   /*    accessed with the `ttpost' module.                                 */
436   /*                                                                       */
437   typedef struct  TT_Postscript_
438   {
439     FT_Fixed  FormatType;
440     FT_Fixed  italicAngle;
441     FT_Short  underlinePosition;
442     FT_Short  underlineThickness;
443     FT_ULong  isFixedPitch;
444     FT_ULong  minMemType42;
445     FT_ULong  maxMemType42;
446     FT_ULong  minMemType1;
447     FT_ULong  maxMemType1;
448
449     /* Glyph names follow in the file, but we don't   */
450     /* load them by default.  See the ttpost.c file.  */
451
452   } TT_Postscript;
453
454
455   /*************************************************************************/
456   /*                                                                       */
457   /* <Struct>                                                              */
458   /*    TT_PCLT                                                            */
459   /*                                                                       */
460   /* <Description>                                                         */
461   /*    A structure used to model a TrueType PCLT table.  All fields       */
462   /*    comply to the TrueType specification.                              */
463   /*                                                                       */
464   typedef struct  TT_PCLT_
465   {
466     FT_Fixed   Version;
467     FT_ULong   FontNumber;
468     FT_UShort  Pitch;
469     FT_UShort  xHeight;
470     FT_UShort  Style;
471     FT_UShort  TypeFamily;
472     FT_UShort  CapHeight;
473     FT_UShort  SymbolSet;
474     FT_Char    TypeFace[16];
475     FT_Char    CharacterComplement[8];
476     FT_Char    FileName[6];
477     FT_Char    StrokeWeight;
478     FT_Char    WidthType;
479     FT_Byte    SerifStyle;
480     FT_Byte    Reserved;
481
482   } TT_PCLT;
483
484
485   /*************************************************************************/
486   /*                                                                       */
487   /* <Struct>                                                              */
488   /*    TT_MaxProfile                                                      */
489   /*                                                                       */
490   /* <Description>                                                         */
491   /*    The maximum profile is a table containing many max values, which   */
492   /*    can be used to pre-allocate arrays.  This ensures that no memory   */
493   /*    allocation occurs during a glyph load.                             */
494   /*                                                                       */
495   /* <Fields>                                                              */
496   /*    version               :: The version number.                       */
497   /*                                                                       */
498   /*    numGlyphs             :: The number of glyphs in this TrueType     */
499   /*                             font.                                     */
500   /*                                                                       */
501   /*    maxPoints             :: The maximum number of points in a         */
502   /*                             non-composite TrueType glyph.  See also   */
503   /*                             the structure element                     */
504   /*                             `maxCompositePoints'.                     */
505   /*                                                                       */
506   /*    maxContours           :: The maximum number of contours in a       */
507   /*                             non-composite TrueType glyph.  See also   */
508   /*                             the structure element                     */
509   /*                             `maxCompositeContours'.                   */
510   /*                                                                       */
511   /*    maxCompositePoints    :: The maximum number of points in a         */
512   /*                             composite TrueType glyph.  See also the   */
513   /*                             structure element `maxPoints'.            */
514   /*                                                                       */
515   /*    maxCompositeContours  :: The maximum number of contours in a       */
516   /*                             composite TrueType glyph.  See also the   */
517   /*                             structure element `maxContours'.          */
518   /*                                                                       */
519   /*    maxZones              :: The maximum number of zones used for      */
520   /*                             glyph hinting.                            */
521   /*                                                                       */
522   /*    maxTwilightPoints     :: The maximum number of points in the       */
523   /*                             twilight zone used for glyph hinting.     */
524   /*                                                                       */
525   /*    maxStorage            :: The maximum number of elements in the     */
526   /*                             storage area used for glyph hinting.      */
527   /*                                                                       */
528   /*    maxFunctionDefs       :: The maximum number of function            */
529   /*                             definitions in the TrueType bytecode for  */
530   /*                             this font.                                */
531   /*                                                                       */
532   /*    maxInstructionDefs    :: The maximum number of instruction         */
533   /*                             definitions in the TrueType bytecode for  */
534   /*                             this font.                                */
535   /*                                                                       */
536   /*    maxStackElements      :: The maximum number of stack elements used */
537   /*                             during bytecode interpretation.           */
538   /*                                                                       */
539   /*    maxSizeOfInstructions :: The maximum number of TrueType opcodes    */
540   /*                             used for glyph hinting.                   */
541   /*                                                                       */
542   /*    maxComponentElements  :: The maximum number of simple (i.e., non-  */
543   /*                             composite) glyphs in a composite glyph.   */
544   /*                                                                       */
545   /*    maxComponentDepth     :: The maximum nesting depth of composite    */
546   /*                             glyphs.                                   */
547   /*                                                                       */
548   /* <Note>                                                                */
549   /*    This structure is only used during font loading.                   */
550   /*                                                                       */
551   typedef struct  TT_MaxProfile_
552   {
553     FT_Fixed   version;
554     FT_UShort  numGlyphs;
555     FT_UShort  maxPoints;
556     FT_UShort  maxContours;
557     FT_UShort  maxCompositePoints;
558     FT_UShort  maxCompositeContours;
559     FT_UShort  maxZones;
560     FT_UShort  maxTwilightPoints;
561     FT_UShort  maxStorage;
562     FT_UShort  maxFunctionDefs;
563     FT_UShort  maxInstructionDefs;
564     FT_UShort  maxStackElements;
565     FT_UShort  maxSizeOfInstructions;
566     FT_UShort  maxComponentElements;
567     FT_UShort  maxComponentDepth;
568
569   } TT_MaxProfile;
570
571
572   /*************************************************************************/
573   /*                                                                       */
574   /* <Enum>                                                                */
575   /*    FT_Sfnt_Tag                                                        */
576   /*                                                                       */
577   /* <Description>                                                         */
578   /*    An enumeration used to specify the index of an SFNT table.         */
579   /*    Used in the @FT_Get_Sfnt_Table API function.                       */
580   /*                                                                       */
581   /* <Values>                                                              */
582   /*    FT_SFNT_HEAD :: To access the font's @TT_Header structure.         */
583   /*                                                                       */
584   /*    FT_SFNT_MAXP :: To access the font's @TT_MaxProfile structure.     */
585   /*                                                                       */
586   /*    FT_SFNT_OS2  :: To access the font's @TT_OS2 structure.            */
587   /*                                                                       */
588   /*    FT_SFNT_HHEA :: To access the font's @TT_HoriHeader structure.     */
589   /*                                                                       */
590   /*    FT_SFNT_VHEA :: To access the font's @TT_VertHeader struture.      */
591   /*                                                                       */
592   /*    FT_SFNT_POST :: To access the font's @TT_Postscript structure.     */
593   /*                                                                       */
594   /*    FT_SFNT_PCLT :: To access the font's @TT_PCLT structure.           */
595   /*                                                                       */
596   typedef enum  FT_Sfnt_Tag_
597   {
598     FT_SFNT_HEAD,
599     FT_SFNT_MAXP,
600     FT_SFNT_OS2,
601     FT_SFNT_HHEA,
602     FT_SFNT_VHEA,
603     FT_SFNT_POST,
604     FT_SFNT_PCLT,
605
606     FT_SFNT_MAX
607
608   } FT_Sfnt_Tag;
609
610   /* these constants are deprecated; use the corresponding `FT_Sfnt_Tag' */
611   /* values instead                                                      */
612 #define ft_sfnt_head  FT_SFNT_HEAD
613 #define ft_sfnt_maxp  FT_SFNT_MAXP
614 #define ft_sfnt_os2   FT_SFNT_OS2
615 #define ft_sfnt_hhea  FT_SFNT_HHEA
616 #define ft_sfnt_vhea  FT_SFNT_VHEA
617 #define ft_sfnt_post  FT_SFNT_POST
618 #define ft_sfnt_pclt  FT_SFNT_PCLT
619
620
621   /*************************************************************************/
622   /*                                                                       */
623   /* <Function>                                                            */
624   /*    FT_Get_Sfnt_Table                                                  */
625   /*                                                                       */
626   /* <Description>                                                         */
627   /*    Return a pointer to a given SFNT table within a face.              */
628   /*                                                                       */
629   /* <Input>                                                               */
630   /*    face :: A handle to the source.                                    */
631   /*                                                                       */
632   /*    tag  :: The index of the SFNT table.                               */
633   /*                                                                       */
634   /* <Return>                                                              */
635   /*    A type-less pointer to the table.  This will be~0 in case of       */
636   /*    error, or if the corresponding table was not found *OR* loaded     */
637   /*    from the file.                                                     */
638   /*                                                                       */
639   /*    Use a typecast according to `tag' to access the structure          */
640   /*    elements.                                                          */
641   /*                                                                       */
642   /* <Note>                                                                */
643   /*    The table is owned by the face object and disappears with it.      */
644   /*                                                                       */
645   /*    This function is only useful to access SFNT tables that are loaded */
646   /*    by the sfnt, truetype, and opentype drivers.  See @FT_Sfnt_Tag for */
647   /*    a list.                                                            */
648   /*                                                                       */
649   /*    Here an example how to access the `vhea' table:                    */
650   /*                                                                       */
651   /*    {                                                                  */
652   /*      TT_VertHeader*  vert_header;                                     */
653   /*                                                                       */
654   /*                                                                       */
655   /*      vert_header =                                                    */
656   /*        (TT_VertHeader*)FT_Get_Sfnt_Table( face, FT_SFNT_VHEA );       */
657   /*    }                                                                  */
658   /*                                                                       */
659   FT_EXPORT( void* )
660   FT_Get_Sfnt_Table( FT_Face      face,
661                      FT_Sfnt_Tag  tag );
662
663
664  /**************************************************************************
665   *
666   * @function:
667   *   FT_Load_Sfnt_Table
668   *
669   * @description:
670   *   Load any font table into client memory.
671   *
672   * @input:
673   *   face ::
674   *     A handle to the source face.
675   *
676   *   tag ::
677   *     The four-byte tag of the table to load.  Use the value~0 if you want
678   *     to access the whole font file.  Otherwise, you can use one of the
679   *     definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new
680   *     one with @FT_MAKE_TAG.
681   *
682   *   offset ::
683   *     The starting offset in the table (or file if tag == 0).
684   *
685   * @output:
686   *   buffer ::
687   *     The target buffer address.  The client must ensure that the memory
688   *     array is big enough to hold the data.
689   *
690   * @inout:
691   *   length ::
692   *     If the `length' parameter is NULL, then try to load the whole table.
693   *     Return an error code if it fails.
694   *
695   *     Else, if `*length' is~0, exit immediately while returning the
696   *     table's (or file) full size in it.
697   *
698   *     Else the number of bytes to read from the table or file, from the
699   *     starting offset.
700   *
701   * @return:
702   *   FreeType error code.  0~means success.
703   *
704   * @note:
705   *   If you need to determine the table's length you should first call this
706   *   function with `*length' set to~0, as in the following example:
707   *
708   *     {
709   *       FT_ULong  length = 0;
710   *
711   *
712   *       error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length );
713   *       if ( error ) { ... table does not exist ... }
714   *
715   *       buffer = malloc( length );
716   *       if ( buffer == NULL ) { ... not enough memory ... }
717   *
718   *       error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length );
719   *       if ( error ) { ... could not load table ... }
720   *     }
721   *
722   *   Note that structures like @TT_Header or @TT_OS2 can't be used with
723   *   this function; they are limited to @FT_Get_Sfnt_Table.  Reason is that
724   *   those structures depend on the processor architecture, with varying
725   *   size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian).
726   *
727   */
728   FT_EXPORT( FT_Error )
729   FT_Load_Sfnt_Table( FT_Face    face,
730                       FT_ULong   tag,
731                       FT_Long    offset,
732                       FT_Byte*   buffer,
733                       FT_ULong*  length );
734
735
736  /**************************************************************************
737   *
738   * @function:
739   *   FT_Sfnt_Table_Info
740   *
741   * @description:
742   *   Return information on an SFNT table.
743   *
744   * @input:
745   *   face ::
746   *     A handle to the source face.
747   *
748   *   table_index ::
749   *     The index of an SFNT table.  The function returns
750   *     FT_Err_Table_Missing for an invalid value.
751   *
752   * @inout:
753   *   tag ::
754   *     The name tag of the SFNT table.  If the value is NULL, `table_index'
755   *     is ignored, and `length' returns the number of SFNT tables in the
756   *     font.
757   *
758   * @output:
759   *   length ::
760   *     The length of the SFNT table (or the number of SFNT tables, depending
761   *     on `tag').
762   *
763   * @return:
764   *   FreeType error code.  0~means success.
765   *
766   * @note:
767   *   While parsing fonts, FreeType handles SFNT tables with length zero as
768   *   missing.
769   *
770   */
771   FT_EXPORT( FT_Error )
772   FT_Sfnt_Table_Info( FT_Face    face,
773                       FT_UInt    table_index,
774                       FT_ULong  *tag,
775                       FT_ULong  *length );
776
777
778   /*************************************************************************/
779   /*                                                                       */
780   /* <Function>                                                            */
781   /*    FT_Get_CMap_Language_ID                                            */
782   /*                                                                       */
783   /* <Description>                                                         */
784   /*    Return TrueType/sfnt specific cmap language ID.  Definitions of    */
785   /*    language ID values are in `ttnameid.h'.                            */
786   /*                                                                       */
787   /* <Input>                                                               */
788   /*    charmap ::                                                         */
789   /*      The target charmap.                                              */
790   /*                                                                       */
791   /* <Return>                                                              */
792   /*    The language ID of `charmap'.  If `charmap' doesn't belong to a    */
793   /*    TrueType/sfnt face, just return~0 as the default value.            */
794   /*                                                                       */
795   /*    For a format~14 cmap (to access Unicode IVS), the return value is  */
796   /*    0xFFFFFFFF.                                                        */
797   /*                                                                       */
798   FT_EXPORT( FT_ULong )
799   FT_Get_CMap_Language_ID( FT_CharMap  charmap );
800
801
802   /*************************************************************************/
803   /*                                                                       */
804   /* <Function>                                                            */
805   /*    FT_Get_CMap_Format                                                 */
806   /*                                                                       */
807   /* <Description>                                                         */
808   /*    Return TrueType/sfnt specific cmap format.                         */
809   /*                                                                       */
810   /* <Input>                                                               */
811   /*    charmap ::                                                         */
812   /*      The target charmap.                                              */
813   /*                                                                       */
814   /* <Return>                                                              */
815   /*    The format of `charmap'.  If `charmap' doesn't belong to a         */
816   /*    TrueType/sfnt face, return -1.                                     */
817   /*                                                                       */
818   FT_EXPORT( FT_Long )
819   FT_Get_CMap_Format( FT_CharMap  charmap );
820
821   /* */
822
823
824 FT_END_HEADER
825
826 #endif /* __TTTABLES_H__ */
827
828
829 /* END */