tttables.h
上传用户:yisoukefu
上传日期:2020-08-09
资源大小:39506k
文件大小:39k
源码类别:

其他游戏

开发平台:

Visual C++

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