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

其他游戏

开发平台:

Visual C++

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /*  sfnt.h                                                                 */
  4. /*                                                                         */
  5. /*    High-level `sfnt' driver interface (specification).                  */
  6. /*                                                                         */
  7. /*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */
  8. /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
  9. /*                                                                         */
  10. /*  This file is part of the FreeType project, and may only be used,       */
  11. /*  modified, and distributed under the terms of the FreeType project      */
  12. /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
  13. /*  this file you indicate that you have read the license and              */
  14. /*  understand and accept it fully.                                        */
  15. /*                                                                         */
  16. /***************************************************************************/
  17. #ifndef __SFNT_H__
  18. #define __SFNT_H__
  19. #include <ft2build.h>
  20. #include FT_INTERNAL_DRIVER_H
  21. #include FT_INTERNAL_TRUETYPE_TYPES_H
  22. FT_BEGIN_HEADER
  23.   /*************************************************************************/
  24.   /*                                                                       */
  25.   /* <FuncType>                                                            */
  26.   /*    TT_Init_Face_Func                                                  */
  27.   /*                                                                       */
  28.   /* <Description>                                                         */
  29.   /*    First part of the SFNT face object initialization.  This finds     */
  30.   /*    the face in a SFNT file or collection, and load its format tag in  */
  31.   /*    face->format_tag.                                                  */
  32.   /*                                                                       */
  33.   /* <Input>                                                               */
  34.   /*    stream     :: The input stream.                                    */
  35.   /*                                                                       */
  36.   /*    face       :: A handle to the target face object.                  */
  37.   /*                                                                       */
  38.   /*    face_index :: The index of the TrueType font, if we are opening a  */
  39.   /*                  collection.                                          */
  40.   /*                                                                       */
  41.   /*    num_params :: The number of additional parameters.                 */
  42.   /*                                                                       */
  43.   /*    params     :: Optional additional parameters.                      */
  44.   /*                                                                       */
  45.   /* <Return>                                                              */
  46.   /*    FreeType error code.  0 means success.                             */
  47.   /*                                                                       */
  48.   /* <Note>                                                                */
  49.   /*    The stream cursor must be at the font file's origin.               */
  50.   /*                                                                       */
  51.   /*    This function recognizes fonts embedded in a `TrueType             */
  52.   /*    collection'.                                                       */
  53.   /*                                                                       */
  54.   /*    Once the format tag has been validated by the font driver, it      */
  55.   /*    should then call the TT_Load_Face_Func() callback to read the rest */
  56.   /*    of the SFNT tables in the object.                                  */
  57.   /*                                                                       */
  58.   typedef FT_Error
  59.   (*TT_Init_Face_Func)( FT_Stream      stream,
  60.                         TT_Face        face,
  61.                         FT_Int         face_index,
  62.                         FT_Int         num_params,
  63.                         FT_Parameter*  params );
  64.   /*************************************************************************/
  65.   /*                                                                       */
  66.   /* <FuncType>                                                            */
  67.   /*    TT_Load_Face_Func                                                  */
  68.   /*                                                                       */
  69.   /* <Description>                                                         */
  70.   /*    Second part of the SFNT face object initialization.  This loads    */
  71.   /*    the common SFNT tables (head, OS/2, maxp, metrics, etc.) in the    */
  72.   /*    face object.                                                       */
  73.   /*                                                                       */
  74.   /* <Input>                                                               */
  75.   /*    stream     :: The input stream.                                    */
  76.   /*                                                                       */
  77.   /*    face       :: A handle to the target face object.                  */
  78.   /*                                                                       */
  79.   /*    face_index :: The index of the TrueType font, if we are opening a  */
  80.   /*                  collection.                                          */
  81.   /*                                                                       */
  82.   /*    num_params :: The number of additional parameters.                 */
  83.   /*                                                                       */
  84.   /*    params     :: Optional additional parameters.                      */
  85.   /*                                                                       */
  86.   /* <Return>                                                              */
  87.   /*    FreeType error code.  0 means success.                             */
  88.   /*                                                                       */
  89.   /* <Note>                                                                */
  90.   /*    This function must be called after TT_Init_Face_Func().            */
  91.   /*                                                                       */
  92.   typedef FT_Error
  93.   (*TT_Load_Face_Func)( FT_Stream      stream,
  94.                         TT_Face        face,
  95.                         FT_Int         face_index,
  96.                         FT_Int         num_params,
  97.                         FT_Parameter*  params );
  98.   /*************************************************************************/
  99.   /*                                                                       */
  100.   /* <FuncType>                                                            */
  101.   /*    TT_Done_Face_Func                                                  */
  102.   /*                                                                       */
  103.   /* <Description>                                                         */
  104.   /*    A callback used to delete the common SFNT data from a face.        */
  105.   /*                                                                       */
  106.   /* <Input>                                                               */
  107.   /*    face :: A handle to the target face object.                        */
  108.   /*                                                                       */
  109.   /* <Note>                                                                */
  110.   /*    This function does NOT destroy the face object.                    */
  111.   /*                                                                       */
  112.   typedef void
  113.   (*TT_Done_Face_Func)( TT_Face  face );
  114. #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
  115.   /*************************************************************************/
  116.   /*                                                                       */
  117.   /* <FuncType>                                                            */
  118.   /*    TT_Load_SFNT_HeaderRec_Func                                        */
  119.   /*                                                                       */
  120.   /* <Description>                                                         */
  121.   /*    Loads the header of a SFNT font file.  Supports collections.       */
  122.   /*                                                                       */
  123.   /* <Input>                                                               */
  124.   /*    face       :: A handle to the target face object.                  */
  125.   /*                                                                       */
  126.   /*    stream     :: The input stream.                                    */
  127.   /*                                                                       */
  128.   /*    face_index :: The index of the TrueType font, if we are opening a  */
  129.   /*                  collection.                                          */
  130.   /*                                                                       */
  131.   /* <Output>                                                              */
  132.   /*    sfnt       :: The SFNT header.                                     */
  133.   /*                                                                       */
  134.   /* <Return>                                                              */
  135.   /*    FreeType error code.  0 means success.                             */
  136.   /*                                                                       */
  137.   /* <Note>                                                                */
  138.   /*    The stream cursor must be at the font file's origin.               */
  139.   /*                                                                       */
  140.   /*    This function recognizes fonts embedded in a `TrueType             */
  141.   /*    collection'.                                                       */
  142.   /*                                                                       */
  143.   /*    This function checks that the header is valid by looking at the    */
  144.   /*    values of `search_range', `entry_selector', and `range_shift'.     */
  145.   /*                                                                       */
  146.   typedef FT_Error
  147.   (*TT_Load_SFNT_HeaderRec_Func)( TT_Face      face,
  148.                                   FT_Stream    stream,
  149.                                   FT_Long      face_index,
  150.                                   SFNT_Header  sfnt );
  151.   /*************************************************************************/
  152.   /*                                                                       */
  153.   /* <FuncType>                                                            */
  154.   /*    TT_Load_Directory_Func                                             */
  155.   /*                                                                       */
  156.   /* <Description>                                                         */
  157.   /*    Loads the table directory into a face object.                      */
  158.   /*                                                                       */
  159.   /* <Input>                                                               */
  160.   /*    face   :: A handle to the target face object.                      */
  161.   /*                                                                       */
  162.   /*    stream :: The input stream.                                        */
  163.   /*                                                                       */
  164.   /*    sfnt   :: The SFNT header.                                         */
  165.   /*                                                                       */
  166.   /* <Return>                                                              */
  167.   /*    FreeType error code.  0 means success.                             */
  168.   /*                                                                       */
  169.   /* <Note>                                                                */
  170.   /*    The stream cursor must be on the first byte after the 4-byte font  */
  171.   /*    format tag.  This is the case just after a call to                 */
  172.   /*    TT_Load_Format_Tag().                                              */
  173.   /*                                                                       */
  174.   typedef FT_Error
  175.   (*TT_Load_Directory_Func)( TT_Face      face,
  176.                              FT_Stream    stream,
  177.                              SFNT_Header  sfnt );
  178. #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
  179.   /*************************************************************************/
  180.   /*                                                                       */
  181.   /* <FuncType>                                                            */
  182.   /*    TT_Load_Any_Func                                                   */
  183.   /*                                                                       */
  184.   /* <Description>                                                         */
  185.   /*    Load any font table into client memory.                            */
  186.   /*                                                                       */
  187.   /* <Input>                                                               */
  188.   /*    face   :: The face object to look for.                             */
  189.   /*                                                                       */
  190.   /*    tag    :: The tag of table to load.  Use the value 0 if you want   */
  191.   /*              to access the whole font file, else set this parameter   */
  192.   /*              to a valid TrueType table tag that you can forge with    */
  193.   /*              the MAKE_TT_TAG macro.                                   */
  194.   /*                                                                       */
  195.   /*    offset :: The starting offset in the table (or the file if         */
  196.   /*              tag == 0).                                               */
  197.   /*                                                                       */
  198.   /*    length :: The address of the decision variable:                    */
  199.   /*                                                                       */
  200.   /*                If length == NULL:                                     */
  201.   /*                  Loads the whole table.  Returns an error if          */
  202.   /*                  `offset' == 0!                                       */
  203.   /*                                                                       */
  204.   /*                If *length == 0:                                       */
  205.   /*                  Exits immediately; returning the length of the given */
  206.   /*                  table or of the font file, depending on the value of */
  207.   /*                  `tag'.                                               */
  208.   /*                                                                       */
  209.   /*                If *length != 0:                                       */
  210.   /*                  Loads the next `length' bytes of table or font,      */
  211.   /*                  starting at offset `offset' (in table or font too).  */
  212.   /*                                                                       */
  213.   /* <Output>                                                              */
  214.   /*    buffer :: The address of target buffer.                            */
  215.   /*                                                                       */
  216.   /* <Return>                                                              */
  217.   /*    TrueType error code.  0 means success.                             */
  218.   /*                                                                       */
  219.   typedef FT_Error
  220.   (*TT_Load_Any_Func)( TT_Face    face,
  221.                        FT_ULong   tag,
  222.                        FT_Long    offset,
  223.                        FT_Byte   *buffer,
  224.                        FT_ULong*  length );
  225.   /*************************************************************************/
  226.   /*                                                                       */
  227.   /* <FuncType>                                                            */
  228.   /*    TT_Find_SBit_Image_Func                                            */
  229.   /*                                                                       */
  230.   /* <Description>                                                         */
  231.   /*    Check whether an embedded bitmap (an `sbit') exists for a given    */
  232.   /*    glyph, at a given strike.                                          */
  233.   /*                                                                       */
  234.   /* <Input>                                                               */
  235.   /*    face          :: The target face object.                           */
  236.   /*                                                                       */
  237.   /*    glyph_index   :: The glyph index.                                  */
  238.   /*                                                                       */
  239.   /*    strike_index  :: The current strike index.                         */
  240.   /*                                                                       */
  241.   /* <Output>                                                              */
  242.   /*    arange        :: The SBit range containing the glyph index.        */
  243.   /*                                                                       */
  244.   /*    astrike       :: The SBit strike containing the glyph index.       */
  245.   /*                                                                       */
  246.   /*    aglyph_offset :: The offset of the glyph data in `EBDT' table.     */
  247.   /*                                                                       */
  248.   /* <Return>                                                              */
  249.   /*    FreeType error code.  0 means success.  Returns                    */
  250.   /*    SFNT_Err_Invalid_Argument if no sbit exists for the requested      */
  251.   /*    glyph.                                                             */
  252.   /*                                                                       */
  253.   typedef FT_Error
  254.   (*TT_Find_SBit_Image_Func)( TT_Face          face,
  255.                               FT_UInt          glyph_index,
  256.                               FT_ULong         strike_index,
  257.                               TT_SBit_Range   *arange,
  258.                               TT_SBit_Strike  *astrike,
  259.                               FT_ULong        *aglyph_offset );
  260.   /*************************************************************************/
  261.   /*                                                                       */
  262.   /* <FuncType>                                                            */
  263.   /*    TT_Load_SBit_Metrics_Func                                          */
  264.   /*                                                                       */
  265.   /* <Description>                                                         */
  266.   /*    Get the big metrics for a given embedded bitmap.                   */
  267.   /*                                                                       */
  268.   /* <Input>                                                               */
  269.   /*    stream      :: The input stream.                                   */
  270.   /*                                                                       */
  271.   /*    range       :: The SBit range containing the glyph.                */
  272.   /*                                                                       */
  273.   /* <Output>                                                              */
  274.   /*    big_metrics :: A big SBit metrics structure for the glyph.         */
  275.   /*                                                                       */
  276.   /* <Return>                                                              */
  277.   /*    FreeType error code.  0 means success.                             */
  278.   /*                                                                       */
  279.   /* <Note>                                                                */
  280.   /*    The stream cursor must be positioned at the glyph's offset within  */
  281.   /*    the `EBDT' table before the call.                                  */
  282.   /*                                                                       */
  283.   /*    If the image format uses variable metrics, the stream cursor is    */
  284.   /*    positioned just after the metrics header in the `EBDT' table on    */
  285.   /*    function exit.                                                     */
  286.   /*                                                                       */
  287.   typedef FT_Error
  288.   (*TT_Load_SBit_Metrics_Func)( FT_Stream        stream,
  289.                                 TT_SBit_Range    range,
  290.                                 TT_SBit_Metrics  metrics );
  291.   /*************************************************************************/
  292.   /*                                                                       */
  293.   /* <FuncType>                                                            */
  294.   /*    TT_Load_SBit_Image_Func                                            */
  295.   /*                                                                       */
  296.   /* <Description>                                                         */
  297.   /*    Load a given glyph sbit image from the font resource.  This also   */
  298.   /*    returns its metrics.                                               */
  299.   /*                                                                       */
  300.   /* <Input>                                                               */
  301.   /*    face ::                                                            */
  302.   /*      The target face object.                                          */
  303.   /*                                                                       */
  304.   /*    strike_index ::                                                    */
  305.   /*      The strike index.                                                */
  306.   /*                                                                       */
  307.   /*    glyph_index ::                                                     */
  308.   /*      The current glyph index.                                         */
  309.   /*                                                                       */
  310.   /*    load_flags ::                                                      */
  311.   /*      The current load flags.                                          */
  312.   /*                                                                       */
  313.   /*    stream ::                                                          */
  314.   /*      The input stream.                                                */
  315.   /*                                                                       */
  316.   /* <Output>                                                              */
  317.   /*    amap ::                                                            */
  318.   /*      The target pixmap.                                               */
  319.   /*                                                                       */
  320.   /*    ametrics ::                                                        */
  321.   /*      A big sbit metrics structure for the glyph image.                */
  322.   /*                                                                       */
  323.   /* <Return>                                                              */
  324.   /*    FreeType error code.  0 means success.  Returns an error if no     */
  325.   /*    glyph sbit exists for the index.                                   */
  326.   /*                                                                       */
  327.   /*  <Note>                                                               */
  328.   /*    The `map.buffer' field is always freed before the glyph is loaded. */
  329.   /*                                                                       */
  330.   typedef FT_Error
  331.   (*TT_Load_SBit_Image_Func)( TT_Face              face,
  332.                               FT_ULong             strike_index,
  333.                               FT_UInt              glyph_index,
  334.                               FT_UInt              load_flags,
  335.                               FT_Stream            stream,
  336.                               FT_Bitmap           *amap,
  337.                               TT_SBit_MetricsRec  *ametrics );
  338. #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
  339.   /*************************************************************************/
  340.   /*                                                                       */
  341.   /* <FuncType>                                                            */
  342.   /*    TT_Set_SBit_Strike_OldFunc                                         */
  343.   /*                                                                       */
  344.   /* <Description>                                                         */
  345.   /*    Select an sbit strike for a given size request.                    */
  346.   /*                                                                       */
  347.   /* <Input>                                                               */
  348.   /*    face          :: The target face object.                           */
  349.   /*                                                                       */
  350.   /*    req           :: The size request.                                 */
  351.   /*                                                                       */
  352.   /* <Output>                                                              */
  353.   /*    astrike_index :: The index of the sbit strike.                     */
  354.   /*                                                                       */
  355.   /* <Return>                                                              */
  356.   /*    FreeType error code.  0 means success.  Returns an error if no     */
  357.   /*    sbit strike exists for the selected ppem values.                   */
  358.   /*                                                                       */
  359.   typedef FT_Error
  360.   (*TT_Set_SBit_Strike_OldFunc)( TT_Face    face,
  361.                                  FT_UInt    x_ppem,
  362.                                  FT_UInt    y_ppem,
  363.                                  FT_ULong*  astrike_index );
  364.   /*************************************************************************/
  365.   /*                                                                       */
  366.   /* <FuncType>                                                            */
  367.   /*    TT_CharMap_Load_Func                                               */
  368.   /*                                                                       */
  369.   /* <Description>                                                         */
  370.   /*    Loads a given TrueType character map into memory.                  */
  371.   /*                                                                       */
  372.   /* <Input>                                                               */
  373.   /*    face   :: A handle to the parent face object.                      */
  374.   /*                                                                       */
  375.   /*    stream :: A handle to the current stream object.                   */
  376.   /*                                                                       */
  377.   /* <InOut>                                                               */
  378.   /*    cmap   :: A pointer to a cmap object.                              */
  379.   /*                                                                       */
  380.   /* <Return>                                                              */
  381.   /*    FreeType error code.  0 means success.                             */
  382.   /*                                                                       */
  383.   /* <Note>                                                                */
  384.   /*    The function assumes that the stream is already in use (i.e.,      */
  385.   /*    opened).  In case of error, all partially allocated tables are     */
  386.   /*    released.                                                          */
  387.   /*                                                                       */
  388.   typedef FT_Error
  389.   (*TT_CharMap_Load_Func)( TT_Face    face,
  390.                            void*      cmap,
  391.                            FT_Stream  input );
  392.   /*************************************************************************/
  393.   /*                                                                       */
  394.   /* <FuncType>                                                            */
  395.   /*    TT_CharMap_Free_Func                                               */
  396.   /*                                                                       */
  397.   /* <Description>                                                         */
  398.   /*    Destroys a character mapping table.                                */
  399.   /*                                                                       */
  400.   /* <Input>                                                               */
  401.   /*    face :: A handle to the parent face object.                        */
  402.   /*                                                                       */
  403.   /*    cmap :: A handle to a cmap object.                                 */
  404.   /*                                                                       */
  405.   /* <Return>                                                              */
  406.   /*    FreeType error code.  0 means success.                             */
  407.   /*                                                                       */
  408.   typedef FT_Error
  409.   (*TT_CharMap_Free_Func)( TT_Face       face,
  410.                            void*         cmap );
  411. #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
  412.   /*************************************************************************/
  413.   /*                                                                       */
  414.   /* <FuncType>                                                            */
  415.   /*    TT_Set_SBit_Strike_Func                                            */
  416.   /*                                                                       */
  417.   /* <Description>                                                         */
  418.   /*    Select an sbit strike for a given size request.                    */
  419.   /*                                                                       */
  420.   /* <Input>                                                               */
  421.   /*    face          :: The target face object.                           */
  422.   /*                                                                       */
  423.   /*    req           :: The size request.                                 */
  424.   /*                                                                       */
  425.   /* <Output>                                                              */
  426.   /*    astrike_index :: The index of the sbit strike.                     */
  427.   /*                                                                       */
  428.   /* <Return>                                                              */
  429.   /*    FreeType error code.  0 means success.  Returns an error if no     */
  430.   /*    sbit strike exists for the selected ppem values.                   */
  431.   /*                                                                       */
  432.   typedef FT_Error
  433.   (*TT_Set_SBit_Strike_Func)( TT_Face          face,
  434.                               FT_Size_Request  req,
  435.                               FT_ULong*        astrike_index );
  436.   /*************************************************************************/
  437.   /*                                                                       */
  438.   /* <FuncType>                                                            */
  439.   /*    TT_Load_Strike_Metrics_Func                                        */
  440.   /*                                                                       */
  441.   /* <Description>                                                         */
  442.   /*    Load the metrics of a given strike.                                */
  443.   /*                                                                       */
  444.   /* <Input>                                                               */
  445.   /*    face          :: The target face object.                           */
  446.   /*                                                                       */
  447.   /*    strike_index  :: The strike index.                                 */
  448.   /*                                                                       */
  449.   /* <Output>                                                              */
  450.   /*    metrics       :: the metrics of the strike.                        */
  451.   /*                                                                       */
  452.   /* <Return>                                                              */
  453.   /*    FreeType error code.  0 means success.  Returns an error if no     */
  454.   /*    such sbit strike exists.                                           */
  455.   /*                                                                       */
  456.   typedef FT_Error
  457.   (*TT_Load_Strike_Metrics_Func)( TT_Face           face,
  458.                                   FT_ULong          strike_index,
  459.                                   FT_Size_Metrics*  metrics );
  460.   /*************************************************************************/
  461.   /*                                                                       */
  462.   /* <FuncType>                                                            */
  463.   /*    TT_Get_PS_Name_Func                                                */
  464.   /*                                                                       */
  465.   /* <Description>                                                         */
  466.   /*    Get the PostScript glyph name of a glyph.                          */
  467.   /*                                                                       */
  468.   /* <Input>                                                               */
  469.   /*    idx  :: The glyph index.                                           */
  470.   /*                                                                       */
  471.   /*    PSname :: The address of a string pointer.  Will be NULL in case   */
  472.   /*              of error, otherwise it is a pointer to the glyph name.   */
  473.   /*                                                                       */
  474.   /*              You must not modify the returned string!                 */
  475.   /*                                                                       */
  476.   /* <Output>                                                              */
  477.   /*    FreeType error code.  0 means success.                             */
  478.   /*                                                                       */
  479.   typedef FT_Error
  480.   (*TT_Get_PS_Name_Func)( TT_Face      face,
  481.                           FT_UInt      idx,
  482.                           FT_String**  PSname );
  483.   /*************************************************************************/
  484.   /*                                                                       */
  485.   /* <FuncType>                                                            */
  486.   /*    TT_Load_Metrics_Func                                               */
  487.   /*                                                                       */
  488.   /* <Description>                                                         */
  489.   /*    Load a metrics table, which is a table with a horizontal and a     */
  490.   /*    vertical version.                                                  */
  491.   /*                                                                       */
  492.   /* <Input>                                                               */
  493.   /*    face     :: A handle to the target face object.                    */
  494.   /*                                                                       */
  495.   /*    stream   :: The input stream.                                      */
  496.   /*                                                                       */
  497.   /*    vertical :: A boolean flag.  If set, load the vertical one.        */
  498.   /*                                                                       */
  499.   /* <Return>                                                              */
  500.   /*    FreeType error code.  0 means success.                             */
  501.   /*                                                                       */
  502.   typedef FT_Error
  503.   (*TT_Load_Metrics_Func)( TT_Face    face,
  504.                            FT_Stream  stream,
  505.                            FT_Bool    vertical );
  506.   /*************************************************************************/
  507.   /*                                                                       */
  508.   /* <FuncType>                                                            */
  509.   /*    TT_Get_Metrics_Func                                                */
  510.   /*                                                                       */
  511.   /* <Description>                                                         */
  512.   /*    Load the horizontal or vertical header in a face object.           */
  513.   /*                                                                       */
  514.   /* <Input>                                                               */
  515.   /*    face     :: A handle to the target face object.                    */
  516.   /*                                                                       */
  517.   /*    stream   :: The input stream.                                      */
  518.   /*                                                                       */
  519.   /*    vertical :: A boolean flag.  If set, load vertical metrics.        */
  520.   /*                                                                       */
  521.   /* <Return>                                                              */
  522.   /*    FreeType error code.  0 means success.                             */
  523.   /*                                                                       */
  524.   typedef FT_Error
  525.   (*TT_Get_Metrics_Func)( TT_Face     face,
  526.                           FT_Bool     vertical,
  527.                           FT_UInt     gindex,
  528.                           FT_Short*   abearing,
  529.                           FT_UShort*  aadvance );
  530.   /*************************************************************************/
  531.   /*                                                                       */
  532.   /* <FuncType>                                                            */
  533.   /*    TT_Load_Table_Func                                                 */
  534.   /*                                                                       */
  535.   /* <Description>                                                         */
  536.   /*    Load a given TrueType table.                                       */
  537.   /*                                                                       */
  538.   /* <Input>                                                               */
  539.   /*    face   :: A handle to the target face object.                      */
  540.   /*                                                                       */
  541.   /*    stream :: The input stream.                                        */
  542.   /*                                                                       */
  543.   /* <Return>                                                              */
  544.   /*    FreeType error code.  0 means success.                             */
  545.   /*                                                                       */
  546.   /* <Note>                                                                */
  547.   /*    The function uses `face->goto_table' to seek the stream to the     */
  548.   /*    start of the table, except while loading the font directory.       */
  549.   /*                                                                       */
  550.   typedef FT_Error
  551.   (*TT_Load_Table_Func)( TT_Face    face,
  552.                          FT_Stream  stream );
  553.   /*************************************************************************/
  554.   /*                                                                       */
  555.   /* <FuncType>                                                            */
  556.   /*    TT_Free_Table_Func                                                 */
  557.   /*                                                                       */
  558.   /* <Description>                                                         */
  559.   /*    Free a given TrueType table.                                       */
  560.   /*                                                                       */
  561.   /* <Input>                                                               */
  562.   /*    face :: A handle to the target face object.                        */
  563.   /*                                                                       */
  564.   typedef void
  565.   (*TT_Free_Table_Func)( TT_Face  face );
  566.   /*
  567.    * @functype:
  568.    *    TT_Face_GetKerningFunc
  569.    *
  570.    * @description:
  571.    *    Return the horizontal kerning value between two glyphs.
  572.    *
  573.    * @input:
  574.    *    face        :: A handle to the source face object.
  575.    *    left_glyph  :: The left glyph index.
  576.    *    right_glyph :: The right glyph index.
  577.    *
  578.    * @return:
  579.    *    The kerning value in font units.
  580.    */
  581.   typedef FT_Int
  582.   (*TT_Face_GetKerningFunc)( TT_Face  face,
  583.                              FT_UInt  left_glyph,
  584.                              FT_UInt  right_glyph );
  585.   /*************************************************************************/
  586.   /*                                                                       */
  587.   /* <Struct>                                                              */
  588.   /*    SFNT_Interface                                                     */
  589.   /*                                                                       */
  590.   /* <Description>                                                         */
  591.   /*    This structure holds pointers to the functions used to load and    */
  592.   /*    free the basic tables that are required in a `sfnt' font file.     */
  593.   /*                                                                       */
  594.   /* <Fields>                                                              */
  595.   /*    Check the various xxx_Func() descriptions for details.             */
  596.   /*                                                                       */
  597.   typedef struct  SFNT_Interface_
  598.   {
  599.     TT_Loader_GotoTableFunc      goto_table;
  600.     TT_Init_Face_Func            init_face;
  601.     TT_Load_Face_Func            load_face;
  602.     TT_Done_Face_Func            done_face;
  603.     FT_Module_Requester          get_interface;
  604.     TT_Load_Any_Func             load_any;
  605. #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
  606.     TT_Load_SFNT_HeaderRec_Func  load_sfnt_header;
  607.     TT_Load_Directory_Func       load_directory;
  608. #endif
  609.     /* these functions are called by `load_face' but they can also  */
  610.     /* be called from external modules, if there is a need to do so */
  611.     TT_Load_Table_Func           load_head;
  612.     TT_Load_Metrics_Func         load_hhea;
  613.     TT_Load_Table_Func           load_cmap;
  614.     TT_Load_Table_Func           load_maxp;
  615.     TT_Load_Table_Func           load_os2;
  616.     TT_Load_Table_Func           load_post;
  617.     TT_Load_Table_Func           load_name;
  618.     TT_Free_Table_Func           free_name;
  619.     /* optional tables */
  620. #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
  621.     TT_Load_Table_Func           load_hdmx_stub;
  622.     TT_Free_Table_Func           free_hdmx_stub;
  623. #endif
  624.     /* this field was called `load_kerning' up to version 2.1.10 */
  625.     TT_Load_Table_Func           load_kern;
  626.     TT_Load_Table_Func           load_gasp;
  627.     TT_Load_Table_Func           load_pclt;
  628.     /* see `ttload.h'; this field was called `load_bitmap_header' up to */
  629.     /* version 2.1.10                                                   */
  630.     TT_Load_Table_Func           load_bhed;
  631. #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
  632.     /* see `ttsbit.h' */
  633.     TT_Set_SBit_Strike_OldFunc   set_sbit_strike_stub;
  634.     TT_Load_Table_Func           load_sbits_stub;
  635.     /*
  636.      *  The following two fields appeared in version 2.1.8, and were placed
  637.      *  between `load_sbits' and `load_sbit_image'.  We support them as a
  638.      *  special exception since they are used by Xfont library within the
  639.      *  X.Org xserver, and because the probability that other rogue clients
  640.      *  use the other version 2.1.7 fields below is _extremely_ low.
  641.      *
  642.      *  Note that this forces us to disable an interesting memory-saving
  643.      *  optimization though...
  644.      */
  645.     TT_Find_SBit_Image_Func      find_sbit_image;
  646.     TT_Load_SBit_Metrics_Func    load_sbit_metrics;
  647. #endif
  648.     TT_Load_SBit_Image_Func      load_sbit_image;
  649. #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
  650.     TT_Free_Table_Func           free_sbits_stub;
  651. #endif
  652.     /* see `ttpost.h' */
  653.     TT_Get_PS_Name_Func          get_psname;
  654.     TT_Free_Table_Func           free_psnames;
  655. #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
  656.     TT_CharMap_Load_Func         load_charmap_stub;
  657.     TT_CharMap_Free_Func         free_charmap_stub;
  658. #endif
  659.     /* starting here, the structure differs from version 2.1.7 */
  660.     /* this field was introduced in version 2.1.8, named `get_psname' */
  661.     TT_Face_GetKerningFunc       get_kerning;
  662.     /* new elements introduced after version 2.1.10 */
  663.     /* load the font directory, i.e., the offset table and */
  664.     /* the table directory                                 */
  665.     TT_Load_Table_Func           load_font_dir;
  666.     TT_Load_Metrics_Func         load_hmtx;
  667.     TT_Load_Table_Func           load_eblc;
  668.     TT_Free_Table_Func           free_eblc;
  669.     TT_Set_SBit_Strike_Func      set_sbit_strike;
  670.     TT_Load_Strike_Metrics_Func  load_strike_metrics;
  671.     TT_Get_Metrics_Func          get_metrics;
  672.   } SFNT_Interface;
  673.   /* transitional */
  674.   typedef SFNT_Interface*   SFNT_Service;
  675. FT_END_HEADER
  676. #endif /* __SFNT_H__ */
  677. /* END */