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