Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /*  tttypes.h                                                              */
  4. /*                                                                         */
  5. /*    Basic SFNT/TrueType type definitions and interface (specification    */
  6. /*    only).                                                               */
  7. /*                                                                         */
  8. /*  Copyright 1996-2002, 2004-2008, 2012-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 __TTTYPES_H__
  21. #define __TTTYPES_H__
  22.  
  23.  
  24. #include <ft2build.h>
  25. #include FT_TRUETYPE_TABLES_H
  26. #include FT_INTERNAL_OBJECTS_H
  27.  
  28. #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
  29. #include FT_MULTIPLE_MASTERS_H
  30. #endif
  31.  
  32.  
  33. FT_BEGIN_HEADER
  34.  
  35.  
  36.   /*************************************************************************/
  37.   /*************************************************************************/
  38.   /*************************************************************************/
  39.   /***                                                                   ***/
  40.   /***                                                                   ***/
  41.   /***             REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS         ***/
  42.   /***                                                                   ***/
  43.   /***                                                                   ***/
  44.   /*************************************************************************/
  45.   /*************************************************************************/
  46.   /*************************************************************************/
  47.  
  48.  
  49.   /*************************************************************************/
  50.   /*                                                                       */
  51.   /* <Struct>                                                              */
  52.   /*    TTC_HeaderRec                                                      */
  53.   /*                                                                       */
  54.   /* <Description>                                                         */
  55.   /*    TrueType collection header.  This table contains the offsets of    */
  56.   /*    the font headers of each distinct TrueType face in the file.       */
  57.   /*                                                                       */
  58.   /* <Fields>                                                              */
  59.   /*    tag     :: Must be `ttc ' to indicate a TrueType collection.       */
  60.   /*                                                                       */
  61.   /*    version :: The version number.                                     */
  62.   /*                                                                       */
  63.   /*    count   :: The number of faces in the collection.  The             */
  64.   /*               specification says this should be an unsigned long, but */
  65.   /*               we use a signed long since we need the value -1 for     */
  66.   /*               specific purposes.                                      */
  67.   /*                                                                       */
  68.   /*    offsets :: The offsets of the font headers, one per face.          */
  69.   /*                                                                       */
  70.   typedef struct  TTC_HeaderRec_
  71.   {
  72.     FT_ULong   tag;
  73.     FT_Fixed   version;
  74.     FT_Long    count;
  75.     FT_ULong*  offsets;
  76.  
  77.   } TTC_HeaderRec;
  78.  
  79.  
  80.   /*************************************************************************/
  81.   /*                                                                       */
  82.   /* <Struct>                                                              */
  83.   /*    SFNT_HeaderRec                                                     */
  84.   /*                                                                       */
  85.   /* <Description>                                                         */
  86.   /*    SFNT file format header.                                           */
  87.   /*                                                                       */
  88.   /* <Fields>                                                              */
  89.   /*    format_tag     :: The font format tag.                             */
  90.   /*                                                                       */
  91.   /*    num_tables     :: The number of tables in file.                    */
  92.   /*                                                                       */
  93.   /*    search_range   :: Must be `16 * (max power of 2 <= num_tables)'.   */
  94.   /*                                                                       */
  95.   /*    entry_selector :: Must be log2 of `search_range / 16'.             */
  96.   /*                                                                       */
  97.   /*    range_shift    :: Must be `num_tables * 16 - search_range'.        */
  98.   /*                                                                       */
  99.   typedef struct  SFNT_HeaderRec_
  100.   {
  101.     FT_ULong   format_tag;
  102.     FT_UShort  num_tables;
  103.     FT_UShort  search_range;
  104.     FT_UShort  entry_selector;
  105.     FT_UShort  range_shift;
  106.  
  107.     FT_ULong   offset;  /* not in file */
  108.  
  109.   } SFNT_HeaderRec, *SFNT_Header;
  110.  
  111.  
  112.   /*************************************************************************/
  113.   /*                                                                       */
  114.   /* <Struct>                                                              */
  115.   /*    TT_TableRec                                                        */
  116.   /*                                                                       */
  117.   /* <Description>                                                         */
  118.   /*    This structure describes a given table of a TrueType font.         */
  119.   /*                                                                       */
  120.   /* <Fields>                                                              */
  121.   /*    Tag      :: A four-bytes tag describing the table.                 */
  122.   /*                                                                       */
  123.   /*    CheckSum :: The table checksum.  This value can be ignored.        */
  124.   /*                                                                       */
  125.   /*    Offset   :: The offset of the table from the start of the TrueType */
  126.   /*                font in its resource.                                  */
  127.   /*                                                                       */
  128.   /*    Length   :: The table length (in bytes).                           */
  129.   /*                                                                       */
  130.   typedef struct  TT_TableRec_
  131.   {
  132.     FT_ULong  Tag;        /*        table type */
  133.     FT_ULong  CheckSum;   /*    table checksum */
  134.     FT_ULong  Offset;     /* table file offset */
  135.     FT_ULong  Length;     /*      table length */
  136.  
  137.   } TT_TableRec, *TT_Table;
  138.  
  139.  
  140.   /*************************************************************************/
  141.   /*                                                                       */
  142.   /* <Struct>                                                              */
  143.   /*    TT_LongMetricsRec                                                  */
  144.   /*                                                                       */
  145.   /* <Description>                                                         */
  146.   /*    A structure modeling the long metrics of the `hmtx' and `vmtx'     */
  147.   /*    TrueType tables.  The values are expressed in font units.          */
  148.   /*                                                                       */
  149.   /* <Fields>                                                              */
  150.   /*    advance :: The advance width or height for the glyph.              */
  151.   /*                                                                       */
  152.   /*    bearing :: The left-side or top-side bearing for the glyph.        */
  153.   /*                                                                       */
  154.   typedef struct  TT_LongMetricsRec_
  155.   {
  156.     FT_UShort  advance;
  157.     FT_Short   bearing;
  158.  
  159.   } TT_LongMetricsRec, *TT_LongMetrics;
  160.  
  161.  
  162.   /*************************************************************************/
  163.   /*                                                                       */
  164.   /* <Type>                                                                */
  165.   /*    TT_ShortMetrics                                                    */
  166.   /*                                                                       */
  167.   /* <Description>                                                         */
  168.   /*    A simple type to model the short metrics of the `hmtx' and `vmtx'  */
  169.   /*    tables.                                                            */
  170.   /*                                                                       */
  171.   typedef FT_Short  TT_ShortMetrics;
  172.  
  173.  
  174.   /*************************************************************************/
  175.   /*                                                                       */
  176.   /* <Struct>                                                              */
  177.   /*    TT_NameEntryRec                                                    */
  178.   /*                                                                       */
  179.   /* <Description>                                                         */
  180.   /*    A structure modeling TrueType name records.  Name records are used */
  181.   /*    to store important strings like family name, style name,           */
  182.   /*    copyright, etc. in _localized_ versions (i.e., language, encoding, */
  183.   /*    etc).                                                              */
  184.   /*                                                                       */
  185.   /* <Fields>                                                              */
  186.   /*    platformID   :: The ID of the name's encoding platform.            */
  187.   /*                                                                       */
  188.   /*    encodingID   :: The platform-specific ID for the name's encoding.  */
  189.   /*                                                                       */
  190.   /*    languageID   :: The platform-specific ID for the name's language.  */
  191.   /*                                                                       */
  192.   /*    nameID       :: The ID specifying what kind of name this is.       */
  193.   /*                                                                       */
  194.   /*    stringLength :: The length of the string in bytes.                 */
  195.   /*                                                                       */
  196.   /*    stringOffset :: The offset to the string in the `name' table.      */
  197.   /*                                                                       */
  198.   /*    string       :: A pointer to the string's bytes.  Note that these  */
  199.   /*                    are usually UTF-16 encoded characters.             */
  200.   /*                                                                       */
  201.   typedef struct  TT_NameEntryRec_
  202.   {
  203.     FT_UShort  platformID;
  204.     FT_UShort  encodingID;
  205.     FT_UShort  languageID;
  206.     FT_UShort  nameID;
  207.     FT_UShort  stringLength;
  208.     FT_ULong   stringOffset;
  209.  
  210.     /* this last field is not defined in the spec */
  211.     /* but used by the FreeType engine            */
  212.  
  213.     FT_Byte*   string;
  214.  
  215.   } TT_NameEntryRec, *TT_NameEntry;
  216.  
  217.  
  218.   /*************************************************************************/
  219.   /*                                                                       */
  220.   /* <Struct>                                                              */
  221.   /*    TT_NameTableRec                                                    */
  222.   /*                                                                       */
  223.   /* <Description>                                                         */
  224.   /*    A structure modeling the TrueType name table.                      */
  225.   /*                                                                       */
  226.   /* <Fields>                                                              */
  227.   /*    format         :: The format of the name table.                    */
  228.   /*                                                                       */
  229.   /*    numNameRecords :: The number of names in table.                    */
  230.   /*                                                                       */
  231.   /*    storageOffset  :: The offset of the name table in the `name'       */
  232.   /*                      TrueType table.                                  */
  233.   /*                                                                       */
  234.   /*    names          :: An array of name records.                        */
  235.   /*                                                                       */
  236.   /*    stream         :: the file's input stream.                         */
  237.   /*                                                                       */
  238.   typedef struct  TT_NameTableRec_
  239.   {
  240.     FT_UShort         format;
  241.     FT_UInt           numNameRecords;
  242.     FT_UInt           storageOffset;
  243.     TT_NameEntryRec*  names;
  244.     FT_Stream         stream;
  245.  
  246.   } TT_NameTableRec, *TT_NameTable;
  247.  
  248.  
  249.   /*************************************************************************/
  250.   /*************************************************************************/
  251.   /*************************************************************************/
  252.   /***                                                                   ***/
  253.   /***                                                                   ***/
  254.   /***             OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS         ***/
  255.   /***                                                                   ***/
  256.   /***                                                                   ***/
  257.   /*************************************************************************/
  258.   /*************************************************************************/
  259.   /*************************************************************************/
  260.  
  261.  
  262.   /*************************************************************************/
  263.   /*                                                                       */
  264.   /* <Struct>                                                              */
  265.   /*    TT_GaspRangeRec                                                    */
  266.   /*                                                                       */
  267.   /* <Description>                                                         */
  268.   /*    A tiny structure used to model a gasp range according to the       */
  269.   /*    TrueType specification.                                            */
  270.   /*                                                                       */
  271.   /* <Fields>                                                              */
  272.   /*    maxPPEM  :: The maximum ppem value to which `gaspFlag' applies.    */
  273.   /*                                                                       */
  274.   /*    gaspFlag :: A flag describing the grid-fitting and anti-aliasing   */
  275.   /*                modes to be used.                                      */
  276.   /*                                                                       */
  277.   typedef struct  TT_GaspRangeRec_
  278.   {
  279.     FT_UShort  maxPPEM;
  280.     FT_UShort  gaspFlag;
  281.  
  282.   } TT_GaspRangeRec, *TT_GaspRange;
  283.  
  284.  
  285. #define TT_GASP_GRIDFIT  0x01
  286. #define TT_GASP_DOGRAY   0x02
  287.  
  288.  
  289.   /*************************************************************************/
  290.   /*                                                                       */
  291.   /* <Struct>                                                              */
  292.   /*    TT_GaspRec                                                         */
  293.   /*                                                                       */
  294.   /* <Description>                                                         */
  295.   /*    A structure modeling the TrueType `gasp' table used to specify     */
  296.   /*    grid-fitting and anti-aliasing behaviour.                          */
  297.   /*                                                                       */
  298.   /* <Fields>                                                              */
  299.   /*    version    :: The version number.                                  */
  300.   /*                                                                       */
  301.   /*    numRanges  :: The number of gasp ranges in table.                  */
  302.   /*                                                                       */
  303.   /*    gaspRanges :: An array of gasp ranges.                             */
  304.   /*                                                                       */
  305.   typedef struct  TT_Gasp_
  306.   {
  307.     FT_UShort     version;
  308.     FT_UShort     numRanges;
  309.     TT_GaspRange  gaspRanges;
  310.  
  311.   } TT_GaspRec;
  312.  
  313.  
  314.   /*************************************************************************/
  315.   /*************************************************************************/
  316.   /*************************************************************************/
  317.   /***                                                                   ***/
  318.   /***                                                                   ***/
  319.   /***                    EMBEDDED BITMAPS SUPPORT                       ***/
  320.   /***                                                                   ***/
  321.   /***                                                                   ***/
  322.   /*************************************************************************/
  323.   /*************************************************************************/
  324.   /*************************************************************************/
  325.  
  326.  
  327.   /*************************************************************************/
  328.   /*                                                                       */
  329.   /* <Struct>                                                              */
  330.   /*    TT_SBit_MetricsRec                                                 */
  331.   /*                                                                       */
  332.   /* <Description>                                                         */
  333.   /*    A structure used to hold the big metrics of a given glyph bitmap   */
  334.   /*    in a TrueType or OpenType font.  These are usually found in the    */
  335.   /*    `EBDT' (Microsoft) or `bloc' (Apple) table.                        */
  336.   /*                                                                       */
  337.   /* <Fields>                                                              */
  338.   /*    height       :: The glyph height in pixels.                        */
  339.   /*                                                                       */
  340.   /*    width        :: The glyph width in pixels.                         */
  341.   /*                                                                       */
  342.   /*    horiBearingX :: The horizontal left bearing.                       */
  343.   /*                                                                       */
  344.   /*    horiBearingY :: The horizontal top bearing.                        */
  345.   /*                                                                       */
  346.   /*    horiAdvance  :: The horizontal advance.                            */
  347.   /*                                                                       */
  348.   /*    vertBearingX :: The vertical left bearing.                         */
  349.   /*                                                                       */
  350.   /*    vertBearingY :: The vertical top bearing.                          */
  351.   /*                                                                       */
  352.   /*    vertAdvance  :: The vertical advance.                              */
  353.   /*                                                                       */
  354.   typedef struct  TT_SBit_MetricsRec_
  355.   {
  356.     FT_Byte  height;
  357.     FT_Byte  width;
  358.  
  359.     FT_Char  horiBearingX;
  360.     FT_Char  horiBearingY;
  361.     FT_Byte  horiAdvance;
  362.  
  363.     FT_Char  vertBearingX;
  364.     FT_Char  vertBearingY;
  365.     FT_Byte  vertAdvance;
  366.  
  367.   } TT_SBit_MetricsRec, *TT_SBit_Metrics;
  368.  
  369.  
  370.   /*************************************************************************/
  371.   /*                                                                       */
  372.   /* <Struct>                                                              */
  373.   /*    TT_SBit_SmallMetricsRec                                            */
  374.   /*                                                                       */
  375.   /* <Description>                                                         */
  376.   /*    A structure used to hold the small metrics of a given glyph bitmap */
  377.   /*    in a TrueType or OpenType font.  These are usually found in the    */
  378.   /*    `EBDT' (Microsoft) or the `bdat' (Apple) table.                    */
  379.   /*                                                                       */
  380.   /* <Fields>                                                              */
  381.   /*    height   :: The glyph height in pixels.                            */
  382.   /*                                                                       */
  383.   /*    width    :: The glyph width in pixels.                             */
  384.   /*                                                                       */
  385.   /*    bearingX :: The left-side bearing.                                 */
  386.   /*                                                                       */
  387.   /*    bearingY :: The top-side bearing.                                  */
  388.   /*                                                                       */
  389.   /*    advance  :: The advance width or height.                           */
  390.   /*                                                                       */
  391.   typedef struct  TT_SBit_Small_Metrics_
  392.   {
  393.     FT_Byte  height;
  394.     FT_Byte  width;
  395.  
  396.     FT_Char  bearingX;
  397.     FT_Char  bearingY;
  398.     FT_Byte  advance;
  399.  
  400.   } TT_SBit_SmallMetricsRec, *TT_SBit_SmallMetrics;
  401.  
  402.  
  403.   /*************************************************************************/
  404.   /*                                                                       */
  405.   /* <Struct>                                                              */
  406.   /*    TT_SBit_LineMetricsRec                                             */
  407.   /*                                                                       */
  408.   /* <Description>                                                         */
  409.   /*    A structure used to describe the text line metrics of a given      */
  410.   /*    bitmap strike, for either a horizontal or vertical layout.         */
  411.   /*                                                                       */
  412.   /* <Fields>                                                              */
  413.   /*    ascender                :: The ascender in pixels.                 */
  414.   /*                                                                       */
  415.   /*    descender               :: The descender in pixels.                */
  416.   /*                                                                       */
  417.   /*    max_width               :: The maximum glyph width in pixels.      */
  418.   /*                                                                       */
  419.   /*    caret_slope_enumerator  :: Rise of the caret slope, typically set  */
  420.   /*                               to 1 for non-italic fonts.              */
  421.   /*                                                                       */
  422.   /*    caret_slope_denominator :: Rise of the caret slope, typically set  */
  423.   /*                               to 0 for non-italic fonts.              */
  424.   /*                                                                       */
  425.   /*    caret_offset            :: Offset in pixels to move the caret for  */
  426.   /*                               proper positioning.                     */
  427.   /*                                                                       */
  428.   /*    min_origin_SB           :: Minimum of horiBearingX (resp.          */
  429.   /*                               vertBearingY).                          */
  430.   /*    min_advance_SB          :: Minimum of                              */
  431.   /*                                                                       */
  432.   /*                                 horizontal advance -                  */
  433.   /*                                   ( horiBearingX + width )            */
  434.   /*                                                                       */
  435.   /*                               resp.                                   */
  436.   /*                                                                       */
  437.   /*                                 vertical advance -                    */
  438.   /*                                   ( vertBearingY + height )           */
  439.   /*                                                                       */
  440.   /*    max_before_BL           :: Maximum of horiBearingY (resp.          */
  441.   /*                               vertBearingY).                          */
  442.   /*                                                                       */
  443.   /*    min_after_BL            :: Minimum of                              */
  444.   /*                                                                       */
  445.   /*                                 horiBearingY - height                 */
  446.   /*                                                                       */
  447.   /*                               resp.                                   */
  448.   /*                                                                       */
  449.   /*                                 vertBearingX - width                  */
  450.   /*                                                                       */
  451.   /*    pads                    :: Unused (to make the size of the record  */
  452.   /*                               a multiple of 32 bits.                  */
  453.   /*                                                                       */
  454.   typedef struct  TT_SBit_LineMetricsRec_
  455.   {
  456.     FT_Char  ascender;
  457.     FT_Char  descender;
  458.     FT_Byte  max_width;
  459.     FT_Char  caret_slope_numerator;
  460.     FT_Char  caret_slope_denominator;
  461.     FT_Char  caret_offset;
  462.     FT_Char  min_origin_SB;
  463.     FT_Char  min_advance_SB;
  464.     FT_Char  max_before_BL;
  465.     FT_Char  min_after_BL;
  466.     FT_Char  pads[2];
  467.  
  468.   } TT_SBit_LineMetricsRec, *TT_SBit_LineMetrics;
  469.  
  470.  
  471.   /*************************************************************************/
  472.   /*                                                                       */
  473.   /* <Struct>                                                              */
  474.   /*    TT_SBit_RangeRec                                                   */
  475.   /*                                                                       */
  476.   /* <Description>                                                         */
  477.   /*    A TrueType/OpenType subIndexTable as defined in the `EBLC'         */
  478.   /*    (Microsoft) or `bloc' (Apple) tables.                              */
  479.   /*                                                                       */
  480.   /* <Fields>                                                              */
  481.   /*    first_glyph   :: The first glyph index in the range.               */
  482.   /*                                                                       */
  483.   /*    last_glyph    :: The last glyph index in the range.                */
  484.   /*                                                                       */
  485.   /*    index_format  :: The format of index table.  Valid values are 1    */
  486.   /*                     to 5.                                             */
  487.   /*                                                                       */
  488.   /*    image_format  :: The format of `EBDT' image data.                  */
  489.   /*                                                                       */
  490.   /*    image_offset  :: The offset to image data in `EBDT'.               */
  491.   /*                                                                       */
  492.   /*    image_size    :: For index formats 2 and 5.  This is the size in   */
  493.   /*                     bytes of each glyph bitmap.                       */
  494.   /*                                                                       */
  495.   /*    big_metrics   :: For index formats 2 and 5.  This is the big       */
  496.   /*                     metrics for each glyph bitmap.                    */
  497.   /*                                                                       */
  498.   /*    num_glyphs    :: For index formats 4 and 5.  This is the number of */
  499.   /*                     glyphs in the code array.                         */
  500.   /*                                                                       */
  501.   /*    glyph_offsets :: For index formats 1 and 3.                        */
  502.   /*                                                                       */
  503.   /*    glyph_codes   :: For index formats 4 and 5.                        */
  504.   /*                                                                       */
  505.   /*    table_offset  :: The offset of the index table in the `EBLC'       */
  506.   /*                     table.  Only used during strike loading.          */
  507.   /*                                                                       */
  508.   typedef struct  TT_SBit_RangeRec_
  509.   {
  510.     FT_UShort           first_glyph;
  511.     FT_UShort           last_glyph;
  512.  
  513.     FT_UShort           index_format;
  514.     FT_UShort           image_format;
  515.     FT_ULong            image_offset;
  516.  
  517.     FT_ULong            image_size;
  518.     TT_SBit_MetricsRec  metrics;
  519.     FT_ULong            num_glyphs;
  520.  
  521.     FT_ULong*           glyph_offsets;
  522.     FT_UShort*          glyph_codes;
  523.  
  524.     FT_ULong            table_offset;
  525.  
  526.   } TT_SBit_RangeRec, *TT_SBit_Range;
  527.  
  528.  
  529.   /*************************************************************************/
  530.   /*                                                                       */
  531.   /* <Struct>                                                              */
  532.   /*    TT_SBit_StrikeRec                                                  */
  533.   /*                                                                       */
  534.   /* <Description>                                                         */
  535.   /*    A structure used describe a given bitmap strike in the `EBLC'      */
  536.   /*    (Microsoft) or `bloc' (Apple) tables.                              */
  537.   /*                                                                       */
  538.   /* <Fields>                                                              */
  539.   /*   num_index_ranges :: The number of index ranges.                     */
  540.   /*                                                                       */
  541.   /*   index_ranges     :: An array of glyph index ranges.                 */
  542.   /*                                                                       */
  543.   /*   color_ref        :: Unused.  `color_ref' is put in for future       */
  544.   /*                       enhancements, but these fields are already      */
  545.   /*                       in use by other platforms (e.g. Newton).        */
  546.   /*                       For details, please see                         */
  547.   /*                                                                       */
  548.   /*                         http://fonts.apple.com/                       */
  549.   /*                                TTRefMan/RM06/Chap6bloc.html           */
  550.   /*                                                                       */
  551.   /*   hori             :: The line metrics for horizontal layouts.        */
  552.   /*                                                                       */
  553.   /*   vert             :: The line metrics for vertical layouts.          */
  554.   /*                                                                       */
  555.   /*   start_glyph      :: The lowest glyph index for this strike.         */
  556.   /*                                                                       */
  557.   /*   end_glyph        :: The highest glyph index for this strike.        */
  558.   /*                                                                       */
  559.   /*   x_ppem           :: The number of horizontal pixels per EM.         */
  560.   /*                                                                       */
  561.   /*   y_ppem           :: The number of vertical pixels per EM.           */
  562.   /*                                                                       */
  563.   /*   bit_depth        :: The bit depth.  Valid values are 1, 2, 4,       */
  564.   /*                       and 8.                                          */
  565.   /*                                                                       */
  566.   /*   flags            :: Is this a vertical or horizontal strike?  For   */
  567.   /*                       details, please see                             */
  568.   /*                                                                       */
  569.   /*                         http://fonts.apple.com/                       */
  570.   /*                                TTRefMan/RM06/Chap6bloc.html           */
  571.   /*                                                                       */
  572.   typedef struct  TT_SBit_StrikeRec_
  573.   {
  574.     FT_Int                  num_ranges;
  575.     TT_SBit_Range           sbit_ranges;
  576.     FT_ULong                ranges_offset;
  577.  
  578.     FT_ULong                color_ref;
  579.  
  580.     TT_SBit_LineMetricsRec  hori;
  581.     TT_SBit_LineMetricsRec  vert;
  582.  
  583.     FT_UShort               start_glyph;
  584.     FT_UShort               end_glyph;
  585.  
  586.     FT_Byte                 x_ppem;
  587.     FT_Byte                 y_ppem;
  588.  
  589.     FT_Byte                 bit_depth;
  590.     FT_Char                 flags;
  591.  
  592.   } TT_SBit_StrikeRec, *TT_SBit_Strike;
  593.  
  594.  
  595.   /*************************************************************************/
  596.   /*                                                                       */
  597.   /* <Struct>                                                              */
  598.   /*    TT_SBit_ComponentRec                                               */
  599.   /*                                                                       */
  600.   /* <Description>                                                         */
  601.   /*    A simple structure to describe a compound sbit element.            */
  602.   /*                                                                       */
  603.   /* <Fields>                                                              */
  604.   /*    glyph_code :: The element's glyph index.                           */
  605.   /*                                                                       */
  606.   /*    x_offset   :: The element's left bearing.                          */
  607.   /*                                                                       */
  608.   /*    y_offset   :: The element's top bearing.                           */
  609.   /*                                                                       */
  610.   typedef struct  TT_SBit_ComponentRec_
  611.   {
  612.     FT_UShort  glyph_code;
  613.     FT_Char    x_offset;
  614.     FT_Char    y_offset;
  615.  
  616.   } TT_SBit_ComponentRec, *TT_SBit_Component;
  617.  
  618.  
  619.   /*************************************************************************/
  620.   /*                                                                       */
  621.   /* <Struct>                                                              */
  622.   /*    TT_SBit_ScaleRec                                                   */
  623.   /*                                                                       */
  624.   /* <Description>                                                         */
  625.   /*    A structure used describe a given bitmap scaling table, as defined */
  626.   /*    in the `EBSC' table.                                               */
  627.   /*                                                                       */
  628.   /* <Fields>                                                              */
  629.   /*    hori              :: The horizontal line metrics.                  */
  630.   /*                                                                       */
  631.   /*    vert              :: The vertical line metrics.                    */
  632.   /*                                                                       */
  633.   /*    x_ppem            :: The number of horizontal pixels per EM.       */
  634.   /*                                                                       */
  635.   /*    y_ppem            :: The number of vertical pixels per EM.         */
  636.   /*                                                                       */
  637.   /*    x_ppem_substitute :: Substitution x_ppem value.                    */
  638.   /*                                                                       */
  639.   /*    y_ppem_substitute :: Substitution y_ppem value.                    */
  640.   /*                                                                       */
  641.   typedef struct  TT_SBit_ScaleRec_
  642.   {
  643.     TT_SBit_LineMetricsRec  hori;
  644.     TT_SBit_LineMetricsRec  vert;
  645.  
  646.     FT_Byte                 x_ppem;
  647.     FT_Byte                 y_ppem;
  648.  
  649.     FT_Byte                 x_ppem_substitute;
  650.     FT_Byte                 y_ppem_substitute;
  651.  
  652.   } TT_SBit_ScaleRec, *TT_SBit_Scale;
  653.  
  654.  
  655.   /*************************************************************************/
  656.   /*************************************************************************/
  657.   /*************************************************************************/
  658.   /***                                                                   ***/
  659.   /***                                                                   ***/
  660.   /***                  POSTSCRIPT GLYPH NAMES SUPPORT                   ***/
  661.   /***                                                                   ***/
  662.   /***                                                                   ***/
  663.   /*************************************************************************/
  664.   /*************************************************************************/
  665.   /*************************************************************************/
  666.  
  667.  
  668.   /*************************************************************************/
  669.   /*                                                                       */
  670.   /* <Struct>                                                              */
  671.   /*    TT_Post_20Rec                                                      */
  672.   /*                                                                       */
  673.   /* <Description>                                                         */
  674.   /*    Postscript names sub-table, format 2.0.  Stores the PS name of     */
  675.   /*    each glyph in the font face.                                       */
  676.   /*                                                                       */
  677.   /* <Fields>                                                              */
  678.   /*    num_glyphs    :: The number of named glyphs in the table.          */
  679.   /*                                                                       */
  680.   /*    num_names     :: The number of PS names stored in the table.       */
  681.   /*                                                                       */
  682.   /*    glyph_indices :: The indices of the glyphs in the names arrays.    */
  683.   /*                                                                       */
  684.   /*    glyph_names   :: The PS names not in Mac Encoding.                 */
  685.   /*                                                                       */
  686.   typedef struct  TT_Post_20Rec_
  687.   {
  688.     FT_UShort   num_glyphs;
  689.     FT_UShort   num_names;
  690.     FT_UShort*  glyph_indices;
  691.     FT_Char**   glyph_names;
  692.  
  693.   } TT_Post_20Rec, *TT_Post_20;
  694.  
  695.  
  696.   /*************************************************************************/
  697.   /*                                                                       */
  698.   /* <Struct>                                                              */
  699.   /*    TT_Post_25Rec                                                      */
  700.   /*                                                                       */
  701.   /* <Description>                                                         */
  702.   /*    Postscript names sub-table, format 2.5.  Stores the PS name of     */
  703.   /*    each glyph in the font face.                                       */
  704.   /*                                                                       */
  705.   /* <Fields>                                                              */
  706.   /*    num_glyphs :: The number of glyphs in the table.                   */
  707.   /*                                                                       */
  708.   /*    offsets    :: An array of signed offsets in a normal Mac           */
  709.   /*                  Postscript name encoding.                            */
  710.   /*                                                                       */
  711.   typedef struct  TT_Post_25_
  712.   {
  713.     FT_UShort  num_glyphs;
  714.     FT_Char*   offsets;
  715.  
  716.   } TT_Post_25Rec, *TT_Post_25;
  717.  
  718.  
  719.   /*************************************************************************/
  720.   /*                                                                       */
  721.   /* <Struct>                                                              */
  722.   /*    TT_Post_NamesRec                                                   */
  723.   /*                                                                       */
  724.   /* <Description>                                                         */
  725.   /*    Postscript names table, either format 2.0 or 2.5.                  */
  726.   /*                                                                       */
  727.   /* <Fields>                                                              */
  728.   /*    loaded    :: A flag to indicate whether the PS names are loaded.   */
  729.   /*                                                                       */
  730.   /*    format_20 :: The sub-table used for format 2.0.                    */
  731.   /*                                                                       */
  732.   /*    format_25 :: The sub-table used for format 2.5.                    */
  733.   /*                                                                       */
  734.   typedef struct  TT_Post_NamesRec_
  735.   {
  736.     FT_Bool  loaded;
  737.  
  738.     union
  739.     {
  740.       TT_Post_20Rec  format_20;
  741.       TT_Post_25Rec  format_25;
  742.  
  743.     } names;
  744.  
  745.   } TT_Post_NamesRec, *TT_Post_Names;
  746.  
  747.  
  748.   /*************************************************************************/
  749.   /*************************************************************************/
  750.   /*************************************************************************/
  751.   /***                                                                   ***/
  752.   /***                                                                   ***/
  753.   /***                    GX VARIATION TABLE SUPPORT                     ***/
  754.   /***                                                                   ***/
  755.   /***                                                                   ***/
  756.   /*************************************************************************/
  757.   /*************************************************************************/
  758.   /*************************************************************************/
  759.  
  760.  
  761. #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
  762.   typedef struct GX_BlendRec_  *GX_Blend;
  763. #endif
  764.  
  765.   /*************************************************************************/
  766.   /*************************************************************************/
  767.   /*************************************************************************/
  768.   /***                                                                   ***/
  769.   /***                                                                   ***/
  770.   /***              EMBEDDED BDF PROPERTIES TABLE SUPPORT                ***/
  771.   /***                                                                   ***/
  772.   /***                                                                   ***/
  773.   /*************************************************************************/
  774.   /*************************************************************************/
  775.   /*************************************************************************/
  776.  
  777.   /*
  778.    * These types are used to support a `BDF ' table that isn't part of the
  779.    * official TrueType specification.  It is mainly used in SFNT-based
  780.    * bitmap fonts that were generated from a set of BDF fonts.
  781.    *
  782.    * The format of the table is as follows.
  783.    *
  784.    *   USHORT   version      `BDF ' table version number, should be 0x0001.
  785.    *   USHORT   strikeCount  Number of strikes (bitmap sizes) in this table.
  786.    *   ULONG    stringTable  Offset (from start of BDF table) to string
  787.    *                         table.
  788.    *
  789.    * This is followed by an array of `strikeCount' descriptors, having the
  790.    * following format.
  791.    *
  792.    *   USHORT   ppem         Vertical pixels per EM for this strike.
  793.    *   USHORT   numItems     Number of items for this strike (properties and
  794.    *                         atoms).  Maximum is 255.
  795.    *
  796.    * This array in turn is followed by `strikeCount' value sets.  Each
  797.    * `value set' is an array of `numItems' items with the following format.
  798.    *
  799.    *   ULONG    item_name    Offset in string table to item name.
  800.    *   USHORT   item_type    The item type.  Possible values are
  801.    *                            0 => string (e.g., COMMENT)
  802.    *                            1 => atom   (e.g., FONT or even SIZE)
  803.    *                            2 => int32
  804.    *                            3 => uint32
  805.    *                         0x10 => A flag to indicate a properties.  This
  806.    *                                 is ORed with the above values.
  807.    *   ULONG    item_value   For strings  => Offset into string table without
  808.    *                                         the corresponding double quotes.
  809.    *                         For atoms    => Offset into string table.
  810.    *                         For integers => Direct value.
  811.    *
  812.    * All strings in the string table consist of bytes and are
  813.    * zero-terminated.
  814.    *
  815.    */
  816.  
  817. #ifdef TT_CONFIG_OPTION_BDF
  818.  
  819.   typedef struct  TT_BDFRec_
  820.   {
  821.     FT_Byte*   table;
  822.     FT_Byte*   table_end;
  823.     FT_Byte*   strings;
  824.     FT_ULong   strings_size;
  825.     FT_UInt    num_strikes;
  826.     FT_Bool    loaded;
  827.  
  828.   } TT_BDFRec, *TT_BDF;
  829.  
  830. #endif /* TT_CONFIG_OPTION_BDF */
  831.  
  832.   /*************************************************************************/
  833.   /*************************************************************************/
  834.   /*************************************************************************/
  835.   /***                                                                   ***/
  836.   /***                                                                   ***/
  837.   /***                  ORIGINAL TT_FACE CLASS DEFINITION                ***/
  838.   /***                                                                   ***/
  839.   /***                                                                   ***/
  840.   /*************************************************************************/
  841.   /*************************************************************************/
  842.   /*************************************************************************/
  843.  
  844.  
  845.   /*************************************************************************/
  846.   /*                                                                       */
  847.   /* This structure/class is defined here because it is common to the      */
  848.   /* following formats: TTF, OpenType-TT, and OpenType-CFF.                */
  849.   /*                                                                       */
  850.   /* Note, however, that the classes TT_Size and TT_GlyphSlot are not      */
  851.   /* shared between font drivers, and are thus defined in `ttobjs.h'.      */
  852.   /*                                                                       */
  853.   /*************************************************************************/
  854.  
  855.  
  856.   /*************************************************************************/
  857.   /*                                                                       */
  858.   /* <Type>                                                                */
  859.   /*    TT_Face                                                            */
  860.   /*                                                                       */
  861.   /* <Description>                                                         */
  862.   /*    A handle to a TrueType face/font object.  A TT_Face encapsulates   */
  863.   /*    the resolution and scaling independent parts of a TrueType font    */
  864.   /*    resource.                                                          */
  865.   /*                                                                       */
  866.   /* <Note>                                                                */
  867.   /*    The TT_Face structure is also used as a `parent class' for the     */
  868.   /*    OpenType-CFF class (T2_Face).                                      */
  869.   /*                                                                       */
  870.   typedef struct TT_FaceRec_*  TT_Face;
  871.  
  872.  
  873.   /* a function type used for the truetype bytecode interpreter hooks */
  874.   typedef FT_Error
  875.   (*TT_Interpreter)( void*  exec_context );
  876.  
  877.   /* forward declaration */
  878.   typedef struct TT_LoaderRec_*  TT_Loader;
  879.  
  880.  
  881.   /*************************************************************************/
  882.   /*                                                                       */
  883.   /* <FuncType>                                                            */
  884.   /*    TT_Loader_GotoTableFunc                                            */
  885.   /*                                                                       */
  886.   /* <Description>                                                         */
  887.   /*    Seeks a stream to the start of a given TrueType table.             */
  888.   /*                                                                       */
  889.   /* <Input>                                                               */
  890.   /*    face   :: A handle to the target face object.                      */
  891.   /*                                                                       */
  892.   /*    tag    :: A 4-byte tag used to name the table.                     */
  893.   /*                                                                       */
  894.   /*    stream :: The input stream.                                        */
  895.   /*                                                                       */
  896.   /* <Output>                                                              */
  897.   /*    length :: The length of the table in bytes.  Set to 0 if not       */
  898.   /*              needed.                                                  */
  899.   /*                                                                       */
  900.   /* <Return>                                                              */
  901.   /*    FreeType error code.  0 means success.                             */
  902.   /*                                                                       */
  903.   /* <Note>                                                                */
  904.   /*    The stream cursor must be at the font file's origin.               */
  905.   /*                                                                       */
  906.   typedef FT_Error
  907.   (*TT_Loader_GotoTableFunc)( TT_Face    face,
  908.                               FT_ULong   tag,
  909.                               FT_Stream  stream,
  910.                               FT_ULong*  length );
  911.  
  912.  
  913.   /*************************************************************************/
  914.   /*                                                                       */
  915.   /* <FuncType>                                                            */
  916.   /*    TT_Loader_StartGlyphFunc                                           */
  917.   /*                                                                       */
  918.   /* <Description>                                                         */
  919.   /*    Seeks a stream to the start of a given glyph element, and opens a  */
  920.   /*    frame for it.                                                      */
  921.   /*                                                                       */
  922.   /* <Input>                                                               */
  923.   /*    loader      :: The current TrueType glyph loader object.           */
  924.   /*                                                                       */
  925.   /*    glyph index :: The index of the glyph to access.                   */
  926.   /*                                                                       */
  927.   /*    offset      :: The offset of the glyph according to the            */
  928.   /*                   `locations' table.                                  */
  929.   /*                                                                       */
  930.   /*    byte_count  :: The size of the frame in bytes.                     */
  931.   /*                                                                       */
  932.   /* <Return>                                                              */
  933.   /*    FreeType error code.  0 means success.                             */
  934.   /*                                                                       */
  935.   /* <Note>                                                                */
  936.   /*    This function is normally equivalent to FT_STREAM_SEEK(offset)     */
  937.   /*    followed by FT_FRAME_ENTER(byte_count) with the loader's stream,   */
  938.   /*    but alternative formats (e.g. compressed ones) might use something */
  939.   /*    different.                                                         */
  940.   /*                                                                       */
  941.   typedef FT_Error
  942.   (*TT_Loader_StartGlyphFunc)( TT_Loader  loader,
  943.                                FT_UInt    glyph_index,
  944.                                FT_ULong   offset,
  945.                                FT_UInt    byte_count );
  946.  
  947.  
  948.   /*************************************************************************/
  949.   /*                                                                       */
  950.   /* <FuncType>                                                            */
  951.   /*    TT_Loader_ReadGlyphFunc                                            */
  952.   /*                                                                       */
  953.   /* <Description>                                                         */
  954.   /*    Reads one glyph element (its header, a simple glyph, or a          */
  955.   /*    composite) from the loader's current stream frame.                 */
  956.   /*                                                                       */
  957.   /* <Input>                                                               */
  958.   /*    loader :: The current TrueType glyph loader object.                */
  959.   /*                                                                       */
  960.   /* <Return>                                                              */
  961.   /*    FreeType error code.  0 means success.                             */
  962.   /*                                                                       */
  963.   typedef FT_Error
  964.   (*TT_Loader_ReadGlyphFunc)( TT_Loader  loader );
  965.  
  966.  
  967.   /*************************************************************************/
  968.   /*                                                                       */
  969.   /* <FuncType>                                                            */
  970.   /*    TT_Loader_EndGlyphFunc                                             */
  971.   /*                                                                       */
  972.   /* <Description>                                                         */
  973.   /*    Closes the current loader stream frame for the glyph.              */
  974.   /*                                                                       */
  975.   /* <Input>                                                               */
  976.   /*    loader :: The current TrueType glyph loader object.                */
  977.   /*                                                                       */
  978.   typedef void
  979.   (*TT_Loader_EndGlyphFunc)( TT_Loader  loader );
  980.  
  981.  
  982.   /*************************************************************************/
  983.   /*                                                                       */
  984.   /*                         TrueType Face Type                            */
  985.   /*                                                                       */
  986.   /* <Struct>                                                              */
  987.   /*    TT_Face                                                            */
  988.   /*                                                                       */
  989.   /* <Description>                                                         */
  990.   /*    The TrueType face class.  These objects model the resolution and   */
  991.   /*    point-size independent data found in a TrueType font file.         */
  992.   /*                                                                       */
  993.   /* <Fields>                                                              */
  994.   /*    root                 :: The base FT_Face structure, managed by the */
  995.   /*                            base layer.                                */
  996.   /*                                                                       */
  997.   /*    ttc_header           :: The TrueType collection header, used when  */
  998.   /*                            the file is a `ttc' rather than a `ttf'.   */
  999.   /*                            For ordinary font files, the field         */
  1000.   /*                            `ttc_header.count' is set to 0.            */
  1001.   /*                                                                       */
  1002.   /*    format_tag           :: The font format tag.                       */
  1003.   /*                                                                       */
  1004.   /*    num_tables           :: The number of TrueType tables in this font */
  1005.   /*                            file.                                      */
  1006.   /*                                                                       */
  1007.   /*    dir_tables           :: The directory of TrueType tables for this  */
  1008.   /*                            font file.                                 */
  1009.   /*                                                                       */
  1010.   /*    header               :: The font's font header (`head' table).     */
  1011.   /*                            Read on font opening.                      */
  1012.   /*                                                                       */
  1013.   /*    horizontal           :: The font's horizontal header (`hhea'       */
  1014.   /*                            table).  This field also contains the      */
  1015.   /*                            associated horizontal metrics table        */
  1016.   /*                            (`hmtx').                                  */
  1017.   /*                                                                       */
  1018.   /*    max_profile          :: The font's maximum profile table.  Read on */
  1019.   /*                            font opening.  Note that some maximum      */
  1020.   /*                            values cannot be taken directly from this  */
  1021.   /*                            table.  We thus define additional fields   */
  1022.   /*                            below to hold the computed maxima.         */
  1023.   /*                                                                       */
  1024.   /*    vertical_info        :: A boolean which is set when the font file  */
  1025.   /*                            contains vertical metrics.  If not, the    */
  1026.   /*                            value of the `vertical' field is           */
  1027.   /*                            undefined.                                 */
  1028.   /*                                                                       */
  1029.   /*    vertical             :: The font's vertical header (`vhea' table). */
  1030.   /*                            This field also contains the associated    */
  1031.   /*                            vertical metrics table (`vmtx'), if found. */
  1032.   /*                            IMPORTANT: The contents of this field is   */
  1033.   /*                            undefined if the `verticalInfo' field is   */
  1034.   /*                            unset.                                     */
  1035.   /*                                                                       */
  1036.   /*    num_names            :: The number of name records within this     */
  1037.   /*                            TrueType font.                             */
  1038.   /*                                                                       */
  1039.   /*    name_table           :: The table of name records (`name').        */
  1040.   /*                                                                       */
  1041.   /*    os2                  :: The font's OS/2 table (`OS/2').            */
  1042.   /*                                                                       */
  1043.   /*    postscript           :: The font's PostScript table (`post'        */
  1044.   /*                            table).  The PostScript glyph names are    */
  1045.   /*                            not loaded by the driver on face opening.  */
  1046.   /*                            See the `ttpost' module for more details.  */
  1047.   /*                                                                       */
  1048.   /*    cmap_table           :: Address of the face's `cmap' SFNT table    */
  1049.   /*                            in memory (it's an extracted frame).       */
  1050.   /*                                                                       */
  1051.   /*    cmap_size            :: The size in bytes of the `cmap_table'      */
  1052.   /*                            described above.                           */
  1053.   /*                                                                       */
  1054.   /*    goto_table           :: A function called by each TrueType table   */
  1055.   /*                            loader to position a stream's cursor to    */
  1056.   /*                            the start of a given table according to    */
  1057.   /*                            its tag.  It defaults to TT_Goto_Face but  */
  1058.   /*                            can be different for strange formats (e.g. */
  1059.   /*                            Type 42).                                  */
  1060.   /*                                                                       */
  1061.   /*    access_glyph_frame   :: A function used to access the frame of a   */
  1062.   /*                            given glyph within the face's font file.   */
  1063.   /*                                                                       */
  1064.   /*    forget_glyph_frame   :: A function used to forget the frame of a   */
  1065.   /*                            given glyph when all data has been loaded. */
  1066.   /*                                                                       */
  1067.   /*    read_glyph_header    :: A function used to read a glyph header.    */
  1068.   /*                            It must be called between an `access' and  */
  1069.   /*                            `forget'.                                  */
  1070.   /*                                                                       */
  1071.   /*    read_simple_glyph    :: A function used to read a simple glyph.    */
  1072.   /*                            It must be called after the header was     */
  1073.   /*                            read, and before the `forget'.             */
  1074.   /*                                                                       */
  1075.   /*    read_composite_glyph :: A function used to read a composite glyph. */
  1076.   /*                            It must be called after the header was     */
  1077.   /*                            read, and before the `forget'.             */
  1078.   /*                                                                       */
  1079.   /*    sfnt                 :: A pointer to the SFNT service.             */
  1080.   /*                                                                       */
  1081.   /*    psnames              :: A pointer to the PostScript names service. */
  1082.   /*                                                                       */
  1083.   /*    hdmx                 :: The face's horizontal device metrics       */
  1084.   /*                            (`hdmx' table).  This table is optional in */
  1085.   /*                            TrueType/OpenType fonts.                   */
  1086.   /*                                                                       */
  1087.   /*    gasp                 :: The grid-fitting and scaling properties    */
  1088.   /*                            table (`gasp').  This table is optional in */
  1089.   /*                            TrueType/OpenType fonts.                   */
  1090.   /*                                                                       */
  1091.   /*    pclt                 :: The `pclt' SFNT table.                     */
  1092.   /*                                                                       */
  1093.   /*    num_sbit_strikes     :: The number of sbit strikes, i.e., bitmap   */
  1094.   /*                            sizes, embedded in this font.              */
  1095.   /*                                                                       */
  1096.   /*    sbit_strikes         :: An array of sbit strikes embedded in this  */
  1097.   /*                            font.  This table is optional in a         */
  1098.   /*                            TrueType/OpenType font.                    */
  1099.   /*                                                                       */
  1100.   /*    num_sbit_scales      :: The number of sbit scales for this font.   */
  1101.   /*                                                                       */
  1102.   /*    sbit_scales          :: Array of sbit scales embedded in this      */
  1103.   /*                            font.  This table is optional in a         */
  1104.   /*                            TrueType/OpenType font.                    */
  1105.   /*                                                                       */
  1106.   /*    postscript_names     :: A table used to store the Postscript names */
  1107.   /*                            of  the glyphs for this font.  See the     */
  1108.   /*                            file  `ttconfig.h' for comments on the     */
  1109.   /*                            TT_CONFIG_OPTION_POSTSCRIPT_NAMES option.  */
  1110.   /*                                                                       */
  1111.   /*    num_locations        :: The number of glyph locations in this      */
  1112.   /*                            TrueType file.  This should be             */
  1113.   /*                            identical to the number of glyphs.         */
  1114.   /*                            Ignored for Type 2 fonts.                  */
  1115.   /*                                                                       */
  1116.   /*    glyph_locations      :: An array of longs.  These are offsets to   */
  1117.   /*                            glyph data within the `glyf' table.        */
  1118.   /*                            Ignored for Type 2 font faces.             */
  1119.   /*                                                                       */
  1120.   /*    glyf_len             :: The length of the `glyf' table.  Needed    */
  1121.   /*                            for malformed `loca' tables.               */
  1122.   /*                                                                       */
  1123.   /*    font_program_size    :: Size in bytecodes of the face's font       */
  1124.   /*                            program.  0 if none defined.  Ignored for  */
  1125.   /*                            Type 2 fonts.                              */
  1126.   /*                                                                       */
  1127.   /*    font_program         :: The face's font program (bytecode stream)  */
  1128.   /*                            executed at load time, also used during    */
  1129.   /*                            glyph rendering.  Comes from the `fpgm'    */
  1130.   /*                            table.  Ignored for Type 2 font fonts.     */
  1131.   /*                                                                       */
  1132.   /*    cvt_program_size     :: The size in bytecodes of the face's cvt    */
  1133.   /*                            program.  Ignored for Type 2 fonts.        */
  1134.   /*                                                                       */
  1135.   /*    cvt_program          :: The face's cvt program (bytecode stream)   */
  1136.   /*                            executed each time an instance/size is     */
  1137.   /*                            changed/reset.  Comes from the `prep'      */
  1138.   /*                            table.  Ignored for Type 2 fonts.          */
  1139.   /*                                                                       */
  1140.   /*    cvt_size             :: Size of the control value table (in        */
  1141.   /*                            entries).   Ignored for Type 2 fonts.      */
  1142.   /*                                                                       */
  1143.   /*    cvt                  :: The face's original control value table.   */
  1144.   /*                            Coordinates are expressed in unscaled font */
  1145.   /*                            units.  Comes from the `cvt ' table.       */
  1146.   /*                            Ignored for Type 2 fonts.                  */
  1147.   /*                                                                       */
  1148.   /*    num_kern_pairs       :: The number of kerning pairs present in the */
  1149.   /*                            font file.  The engine only loads the      */
  1150.   /*                            first horizontal format 0 kern table it    */
  1151.   /*                            finds in the font file.  Ignored for       */
  1152.   /*                            Type 2 fonts.                              */
  1153.   /*                                                                       */
  1154.   /*    kern_table_index     :: The index of the kerning table in the font */
  1155.   /*                            kerning directory.  Ignored for Type 2     */
  1156.   /*                            fonts.                                     */
  1157.   /*                                                                       */
  1158.   /*    interpreter          :: A pointer to the TrueType bytecode         */
  1159.   /*                            interpreters field is also used to hook    */
  1160.   /*                            the debugger in `ttdebug'.                 */
  1161.   /*                                                                       */
  1162.   /*    unpatented_hinting   :: If true, use only unpatented methods in    */
  1163.   /*                            the bytecode interpreter.                  */
  1164.   /*                                                                       */
  1165.   /*    doblend              :: A boolean which is set if the font should  */
  1166.   /*                            be blended (this is for GX var).           */
  1167.   /*                                                                       */
  1168.   /*    blend                :: Contains the data needed to control GX     */
  1169.   /*                            variation tables (rather like Multiple     */
  1170.   /*                            Master data).                              */
  1171.   /*                                                                       */
  1172.   /*    extra                :: Reserved for third-party font drivers.     */
  1173.   /*                                                                       */
  1174.   /*    postscript_name      :: The PS name of the font.  Used by the      */
  1175.   /*                            postscript name service.                   */
  1176.   /*                                                                       */
  1177.   typedef struct  TT_FaceRec_
  1178.   {
  1179.     FT_FaceRec            root;
  1180.  
  1181.     TTC_HeaderRec         ttc_header;
  1182.  
  1183.     FT_ULong              format_tag;
  1184.     FT_UShort             num_tables;
  1185.     TT_Table              dir_tables;
  1186.  
  1187.     TT_Header             header;       /* TrueType header table          */
  1188.     TT_HoriHeader         horizontal;   /* TrueType horizontal header     */
  1189.  
  1190.     TT_MaxProfile         max_profile;
  1191.  
  1192.     FT_Bool               vertical_info;
  1193.     TT_VertHeader         vertical;     /* TT Vertical header, if present */
  1194.  
  1195.     FT_UShort             num_names;    /* number of name records  */
  1196.     TT_NameTableRec       name_table;   /* name table              */
  1197.  
  1198.     TT_OS2                os2;          /* TrueType OS/2 table            */
  1199.     TT_Postscript         postscript;   /* TrueType Postscript table      */
  1200.  
  1201.     FT_Byte*              cmap_table;   /* extracted `cmap' table */
  1202.     FT_ULong              cmap_size;
  1203.  
  1204.     TT_Loader_GotoTableFunc   goto_table;
  1205.  
  1206.     TT_Loader_StartGlyphFunc  access_glyph_frame;
  1207.     TT_Loader_EndGlyphFunc    forget_glyph_frame;
  1208.     TT_Loader_ReadGlyphFunc   read_glyph_header;
  1209.     TT_Loader_ReadGlyphFunc   read_simple_glyph;
  1210.     TT_Loader_ReadGlyphFunc   read_composite_glyph;
  1211.  
  1212.     /* a typeless pointer to the SFNT_Interface table used to load */
  1213.     /* the basic TrueType tables in the face object                */
  1214.     void*                 sfnt;
  1215.  
  1216.     /* a typeless pointer to the FT_Service_PsCMapsRec table used to */
  1217.     /* handle glyph names <-> unicode & Mac values                   */
  1218.     void*                 psnames;
  1219.  
  1220.  
  1221.     /***********************************************************************/
  1222.     /*                                                                     */
  1223.     /* Optional TrueType/OpenType tables                                   */
  1224.     /*                                                                     */
  1225.     /***********************************************************************/
  1226.  
  1227.     /* grid-fitting and scaling table */
  1228.     TT_GaspRec            gasp;                 /* the `gasp' table */
  1229.  
  1230.     /* PCL 5 table */
  1231.     TT_PCLT               pclt;
  1232.  
  1233.     /* embedded bitmaps support */
  1234.     FT_ULong              num_sbit_scales;
  1235.     TT_SBit_Scale         sbit_scales;
  1236.  
  1237.     /* postscript names table */
  1238.     TT_Post_NamesRec      postscript_names;
  1239.  
  1240.  
  1241.     /***********************************************************************/
  1242.     /*                                                                     */
  1243.     /* TrueType-specific fields (ignored by the OTF-Type2 driver)          */
  1244.     /*                                                                     */
  1245.     /***********************************************************************/
  1246.  
  1247.     /* the font program, if any */
  1248.     FT_ULong              font_program_size;
  1249.     FT_Byte*              font_program;
  1250.  
  1251.     /* the cvt program, if any */
  1252.     FT_ULong              cvt_program_size;
  1253.     FT_Byte*              cvt_program;
  1254.  
  1255.     /* the original, unscaled, control value table */
  1256.     FT_ULong              cvt_size;
  1257.     FT_Short*             cvt;
  1258.  
  1259.     /* A pointer to the bytecode interpreter to use.  This is also */
  1260.     /* used to hook the debugger for the `ttdebug' utility.        */
  1261.     TT_Interpreter        interpreter;
  1262.  
  1263. #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
  1264.     /* Use unpatented hinting only. */
  1265.     FT_Bool               unpatented_hinting;
  1266. #endif
  1267.  
  1268.     /***********************************************************************/
  1269.     /*                                                                     */
  1270.     /* Other tables or fields. This is used by derivative formats like     */
  1271.     /* OpenType.                                                           */
  1272.     /*                                                                     */
  1273.     /***********************************************************************/
  1274.  
  1275.     FT_Generic            extra;
  1276.  
  1277.     const char*           postscript_name;
  1278.  
  1279.     FT_ULong              glyf_len;
  1280.  
  1281. #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
  1282.     FT_Bool               doblend;
  1283.     GX_Blend              blend;
  1284. #endif
  1285.  
  1286.     /* since version 2.2 */
  1287.  
  1288.     FT_Byte*              horz_metrics;
  1289.     FT_ULong              horz_metrics_size;
  1290.  
  1291.     FT_Byte*              vert_metrics;
  1292.     FT_ULong              vert_metrics_size;
  1293.  
  1294.     FT_ULong              num_locations; /* in broken TTF, gid > 0xFFFF */
  1295.     FT_Byte*              glyph_locations;
  1296.  
  1297.     FT_Byte*              hdmx_table;
  1298.     FT_ULong              hdmx_table_size;
  1299.     FT_UInt               hdmx_record_count;
  1300.     FT_ULong              hdmx_record_size;
  1301.     FT_Byte*              hdmx_record_sizes;
  1302.  
  1303.     FT_Byte*              sbit_table;
  1304.     FT_ULong              sbit_table_size;
  1305.     FT_UInt               sbit_num_strikes;
  1306.  
  1307.     FT_Byte*              kern_table;
  1308.     FT_ULong              kern_table_size;
  1309.     FT_UInt               num_kern_tables;
  1310.     FT_UInt32             kern_avail_bits;
  1311.     FT_UInt32             kern_order_bits;
  1312.  
  1313. #ifdef TT_CONFIG_OPTION_BDF
  1314.     TT_BDFRec             bdf;
  1315. #endif /* TT_CONFIG_OPTION_BDF */
  1316.  
  1317.     /* since 2.3.0 */
  1318.     FT_ULong              horz_metrics_offset;
  1319.     FT_ULong              vert_metrics_offset;
  1320.  
  1321. #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
  1322.     /* since 2.4.12 */
  1323.     FT_ULong              sph_found_func_flags; /* special functions found */
  1324.                                                 /* for this face           */
  1325.     FT_Bool               sph_compatibility_mode;
  1326. #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
  1327.  
  1328.   } TT_FaceRec;
  1329.  
  1330.  
  1331.   /*************************************************************************/
  1332.   /*                                                                       */
  1333.   /*  <Struct>                                                             */
  1334.   /*     TT_GlyphZoneRec                                                   */
  1335.   /*                                                                       */
  1336.   /*  <Description>                                                        */
  1337.   /*     A glyph zone is used to load, scale and hint glyph outline        */
  1338.   /*     coordinates.                                                      */
  1339.   /*                                                                       */
  1340.   /*  <Fields>                                                             */
  1341.   /*     memory       :: A handle to the memory manager.                   */
  1342.   /*                                                                       */
  1343.   /*     max_points   :: The maximum size in points of the zone.           */
  1344.   /*                                                                       */
  1345.   /*     max_contours :: Max size in links contours of the zone.           */
  1346.   /*                                                                       */
  1347.   /*     n_points     :: The current number of points in the zone.         */
  1348.   /*                                                                       */
  1349.   /*     n_contours   :: The current number of contours in the zone.       */
  1350.   /*                                                                       */
  1351.   /*     org          :: The original glyph coordinates (font              */
  1352.   /*                     units/scaled).                                    */
  1353.   /*                                                                       */
  1354.   /*     cur          :: The current glyph coordinates (scaled/hinted).    */
  1355.   /*                                                                       */
  1356.   /*     tags         :: The point control tags.                           */
  1357.   /*                                                                       */
  1358.   /*     contours     :: The contours end points.                          */
  1359.   /*                                                                       */
  1360.   /*     first_point  :: Offset of the current subglyph's first point.     */
  1361.   /*                                                                       */
  1362.   typedef struct  TT_GlyphZoneRec_
  1363.   {
  1364.     FT_Memory   memory;
  1365.     FT_UShort   max_points;
  1366.     FT_UShort   max_contours;
  1367.     FT_UShort   n_points;    /* number of points in zone    */
  1368.     FT_Short    n_contours;  /* number of contours          */
  1369.  
  1370.     FT_Vector*  org;         /* original point coordinates  */
  1371.     FT_Vector*  cur;         /* current point coordinates   */
  1372.     FT_Vector*  orus;        /* original (unscaled) point coordinates */
  1373.  
  1374.     FT_Byte*    tags;        /* current touch flags         */
  1375.     FT_UShort*  contours;    /* contour end points          */
  1376.  
  1377.     FT_UShort   first_point; /* offset of first (#0) point  */
  1378.  
  1379.   } TT_GlyphZoneRec, *TT_GlyphZone;
  1380.  
  1381.  
  1382.   /* handle to execution context */
  1383.   typedef struct TT_ExecContextRec_*  TT_ExecContext;
  1384.  
  1385.   /* glyph loader structure */
  1386.   typedef struct  TT_LoaderRec_
  1387.   {
  1388.     FT_Face          face;
  1389.     FT_Size          size;
  1390.     FT_GlyphSlot     glyph;
  1391.     FT_GlyphLoader   gloader;
  1392.  
  1393.     FT_ULong         load_flags;
  1394.     FT_UInt          glyph_index;
  1395.  
  1396.     FT_Stream        stream;
  1397.     FT_Int           byte_len;
  1398.  
  1399.     FT_Short         n_contours;
  1400.     FT_BBox          bbox;
  1401.     FT_Int           left_bearing;
  1402.     FT_Int           advance;
  1403.     FT_Int           linear;
  1404.     FT_Bool          linear_def;
  1405.     FT_Bool          preserve_pps;
  1406.     FT_Vector        pp1;
  1407.     FT_Vector        pp2;
  1408.  
  1409.     FT_ULong         glyf_offset;
  1410.  
  1411.     /* the zone where we load our glyphs */
  1412.     TT_GlyphZoneRec  base;
  1413.     TT_GlyphZoneRec  zone;
  1414.  
  1415.     TT_ExecContext   exec;
  1416.     FT_Byte*         instructions;
  1417.     FT_ULong         ins_pos;
  1418.  
  1419.     /* for possible extensibility in other formats */
  1420.     void*            other;
  1421.  
  1422.     /* since version 2.1.8 */
  1423.     FT_Int           top_bearing;
  1424.     FT_Int           vadvance;
  1425.     FT_Vector        pp3;
  1426.     FT_Vector        pp4;
  1427.  
  1428.     /* since version 2.2.1 */
  1429.     FT_Byte*         cursor;
  1430.     FT_Byte*         limit;
  1431.  
  1432.   } TT_LoaderRec;
  1433.  
  1434.  
  1435. FT_END_HEADER
  1436.  
  1437. #endif /* __TTTYPES_H__ */
  1438.  
  1439.  
  1440. /* END */
  1441.