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