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

其他游戏

开发平台:

Visual C++

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /*  psaux.h                                                                */
  4. /*                                                                         */
  5. /*    Auxiliary functions and data structures related to PostScript fonts  */
  6. /*    (specification).                                                     */
  7. /*                                                                         */
  8. /*  Copyright 1996-2001, 2002, 2003, 2004, 2006 by                         */
  9. /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
  10. /*                                                                         */
  11. /*  This file is part of the FreeType project, and may only be used,       */
  12. /*  modified, and distributed under the terms of the FreeType project      */
  13. /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
  14. /*  this file you indicate that you have read the license and              */
  15. /*  understand and accept it fully.                                        */
  16. /*                                                                         */
  17. /***************************************************************************/
  18. #ifndef __PSAUX_H__
  19. #define __PSAUX_H__
  20. #include <ft2build.h>
  21. #include FT_INTERNAL_OBJECTS_H
  22. #include FT_INTERNAL_TYPE1_TYPES_H
  23. #include FT_SERVICE_POSTSCRIPT_CMAPS_H
  24. FT_BEGIN_HEADER
  25.   /*************************************************************************/
  26.   /*************************************************************************/
  27.   /*****                                                               *****/
  28.   /*****                             T1_TABLE                          *****/
  29.   /*****                                                               *****/
  30.   /*************************************************************************/
  31.   /*************************************************************************/
  32.   typedef struct PS_TableRec_*              PS_Table;
  33.   typedef const struct PS_Table_FuncsRec_*  PS_Table_Funcs;
  34.   /*************************************************************************/
  35.   /*                                                                       */
  36.   /* <Struct>                                                              */
  37.   /*    PS_Table_FuncsRec                                                  */
  38.   /*                                                                       */
  39.   /* <Description>                                                         */
  40.   /*    A set of function pointers to manage PS_Table objects.             */
  41.   /*                                                                       */
  42.   /* <Fields>                                                              */
  43.   /*    table_init    :: Used to initialize a table.                       */
  44.   /*                                                                       */
  45.   /*    table_done    :: Finalizes resp. destroy a given table.            */
  46.   /*                                                                       */
  47.   /*    table_add     :: Adds a new object to a table.                     */
  48.   /*                                                                       */
  49.   /*    table_release :: Releases table data, then finalizes it.           */
  50.   /*                                                                       */
  51.   typedef struct  PS_Table_FuncsRec_
  52.   {
  53.     FT_Error
  54.     (*init)( PS_Table   table,
  55.              FT_Int     count,
  56.              FT_Memory  memory );
  57.     void
  58.     (*done)( PS_Table  table );
  59.     FT_Error
  60.     (*add)( PS_Table    table,
  61.             FT_Int      idx,
  62.             void*       object,
  63.             FT_PtrDist  length );
  64.     void
  65.     (*release)( PS_Table  table );
  66.   } PS_Table_FuncsRec;
  67.   /*************************************************************************/
  68.   /*                                                                       */
  69.   /* <Struct>                                                              */
  70.   /*    PS_TableRec                                                        */
  71.   /*                                                                       */
  72.   /* <Description>                                                         */
  73.   /*    A PS_Table is a simple object used to store an array of objects in */
  74.   /*    a single memory block.                                             */
  75.   /*                                                                       */
  76.   /* <Fields>                                                              */
  77.   /*    block     :: The address in memory of the growheap's block.  This  */
  78.   /*                 can change between two object adds, due to            */
  79.   /*                 reallocation.                                         */
  80.   /*                                                                       */
  81.   /*    cursor    :: The current top of the grow heap within its block.    */
  82.   /*                                                                       */
  83.   /*    capacity  :: The current size of the heap block.  Increments by    */
  84.   /*                 1kByte chunks.                                        */
  85.   /*                                                                       */
  86.   /*    max_elems :: The maximum number of elements in table.              */
  87.   /*                                                                       */
  88.   /*    num_elems :: The current number of elements in table.              */
  89.   /*                                                                       */
  90.   /*    elements  :: A table of element addresses within the block.        */
  91.   /*                                                                       */
  92.   /*    lengths   :: A table of element sizes within the block.            */
  93.   /*                                                                       */
  94.   /*    memory    :: The object used for memory operations                 */
  95.   /*                 (alloc/realloc).                                      */
  96.   /*                                                                       */
  97.   /*    funcs     :: A table of method pointers for this object.           */
  98.   /*                                                                       */
  99.   typedef struct  PS_TableRec_
  100.   {
  101.     FT_Byte*           block;          /* current memory block           */
  102.     FT_Offset          cursor;         /* current cursor in memory block */
  103.     FT_Offset          capacity;       /* current size of memory block   */
  104.     FT_Long            init;
  105.     FT_Int             max_elems;
  106.     FT_Int             num_elems;
  107.     FT_Byte**          elements;       /* addresses of table elements */
  108.     FT_PtrDist*        lengths;        /* lengths of table elements   */
  109.     FT_Memory          memory;
  110.     PS_Table_FuncsRec  funcs;
  111.   } PS_TableRec;
  112.   /*************************************************************************/
  113.   /*************************************************************************/
  114.   /*****                                                               *****/
  115.   /*****                       T1 FIELDS & TOKENS                      *****/
  116.   /*****                                                               *****/
  117.   /*************************************************************************/
  118.   /*************************************************************************/
  119.   typedef struct PS_ParserRec_*  PS_Parser;
  120.   typedef struct T1_TokenRec_*   T1_Token;
  121.   typedef struct T1_FieldRec_*   T1_Field;
  122.   /* simple enumeration type used to identify token types */
  123.   typedef enum  T1_TokenType_
  124.   {
  125.     T1_TOKEN_TYPE_NONE = 0,
  126.     T1_TOKEN_TYPE_ANY,
  127.     T1_TOKEN_TYPE_STRING,
  128.     T1_TOKEN_TYPE_ARRAY,
  129.     T1_TOKEN_TYPE_KEY, /* aka `name' */
  130.     /* do not remove */
  131.     T1_TOKEN_TYPE_MAX
  132.   } T1_TokenType;
  133.   /* a simple structure used to identify tokens */
  134.   typedef struct  T1_TokenRec_
  135.   {
  136.     FT_Byte*      start;   /* first character of token in input stream */
  137.     FT_Byte*      limit;   /* first character after the token          */
  138.     T1_TokenType  type;    /* type of token                            */
  139.   } T1_TokenRec;
  140.   /* enumeration type used to identify object fields */
  141.   typedef enum  T1_FieldType_
  142.   {
  143.     T1_FIELD_TYPE_NONE = 0,
  144.     T1_FIELD_TYPE_BOOL,
  145.     T1_FIELD_TYPE_INTEGER,
  146.     T1_FIELD_TYPE_FIXED,
  147.     T1_FIELD_TYPE_FIXED_1000,
  148.     T1_FIELD_TYPE_STRING,
  149.     T1_FIELD_TYPE_KEY,
  150.     T1_FIELD_TYPE_BBOX,
  151.     T1_FIELD_TYPE_INTEGER_ARRAY,
  152.     T1_FIELD_TYPE_FIXED_ARRAY,
  153.     T1_FIELD_TYPE_CALLBACK,
  154.     /* do not remove */
  155.     T1_FIELD_TYPE_MAX
  156.   } T1_FieldType;
  157.   typedef enum  T1_FieldLocation_
  158.   {
  159.     T1_FIELD_LOCATION_CID_INFO,
  160.     T1_FIELD_LOCATION_FONT_DICT,
  161.     T1_FIELD_LOCATION_FONT_INFO,
  162.     T1_FIELD_LOCATION_PRIVATE,
  163.     T1_FIELD_LOCATION_BBOX,
  164.     T1_FIELD_LOCATION_LOADER,
  165.     T1_FIELD_LOCATION_FACE,
  166.     T1_FIELD_LOCATION_BLEND,
  167.     /* do not remove */
  168.     T1_FIELD_LOCATION_MAX
  169.   } T1_FieldLocation;
  170.   typedef void
  171.   (*T1_Field_ParseFunc)( FT_Face     face,
  172.                          FT_Pointer  parser );
  173.   /* structure type used to model object fields */
  174.   typedef struct  T1_FieldRec_
  175.   {
  176.     const char*         ident;        /* field identifier               */
  177.     T1_FieldLocation    location;
  178.     T1_FieldType        type;         /* type of field                  */
  179.     T1_Field_ParseFunc  reader;
  180.     FT_UInt             offset;       /* offset of field in object      */
  181.     FT_Byte             size;         /* size of field in bytes         */
  182.     FT_UInt             array_max;    /* maximal number of elements for */
  183.                                       /* array                          */
  184.     FT_UInt             count_offset; /* offset of element count for    */
  185.                                       /* arrays                         */
  186.     FT_UInt             dict;         /* where we expect it             */
  187.   } T1_FieldRec;
  188. #define T1_FIELD_DICT_FONTDICT ( 1 << 0 ) /* also FontInfo and FDArray */
  189. #define T1_FIELD_DICT_PRIVATE  ( 1 << 1 )
  190. #define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname, _dict ) 
  191.           {                                                 
  192.             _ident, T1CODE, _type,                          
  193.             0,                                              
  194.             FT_FIELD_OFFSET( _fname ),                      
  195.             FT_FIELD_SIZE( _fname ),                        
  196.             0, 0,                                           
  197.             _dict                                           
  198.           },
  199. #define T1_NEW_CALLBACK_FIELD( _ident, _reader, _dict ) 
  200.           {                                             
  201.             _ident, T1CODE, T1_FIELD_TYPE_CALLBACK,     
  202.             (T1_Field_ParseFunc)_reader,                
  203.             0, 0,                                       
  204.             0, 0,                                       
  205.             _dict                                       
  206.           },
  207. #define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max, _dict ) 
  208.           {                                                      
  209.             _ident, T1CODE, _type,                               
  210.             0,                                                   
  211.             FT_FIELD_OFFSET( _fname ),                           
  212.             FT_FIELD_SIZE_DELTA( _fname ),                       
  213.             _max,                                                
  214.             FT_FIELD_OFFSET( num_ ## _fname ),                   
  215.             _dict                                                
  216.           },
  217. #define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max, _dict ) 
  218.           {                                                       
  219.             _ident, T1CODE, _type,                                
  220.             0,                                                    
  221.             FT_FIELD_OFFSET( _fname ),                            
  222.             FT_FIELD_SIZE_DELTA( _fname ),                        
  223.             _max, 0,                                              
  224.             _dict                                                 
  225.           },
  226. #define T1_FIELD_BOOL( _ident, _fname, _dict )                             
  227.           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname, _dict )
  228. #define T1_FIELD_NUM( _ident, _fname, _dict )                                 
  229.           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname, _dict )
  230. #define T1_FIELD_FIXED( _ident, _fname, _dict )                             
  231.           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname, _dict )
  232. #define T1_FIELD_FIXED_1000( _ident, _fname, _dict )                     
  233.           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname, 
  234.                                _dict )
  235. #define T1_FIELD_STRING( _ident, _fname, _dict )                             
  236.           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname, _dict )
  237. #define T1_FIELD_KEY( _ident, _fname, _dict )                             
  238.           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname, _dict )
  239. #define T1_FIELD_BBOX( _ident, _fname, _dict )                             
  240.           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname, _dict )
  241. #define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax, _dict )         
  242.           T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, 
  243.                               _fname, _fmax, _dict )
  244. #define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax, _dict )     
  245.           T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, 
  246.                               _fname, _fmax, _dict )
  247. #define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax, _dict )         
  248.           T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, 
  249.                                _fname, _fmax, _dict )
  250. #define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax, _dict )     
  251.           T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, 
  252.                                _fname, _fmax, _dict )
  253. #define T1_FIELD_CALLBACK( _ident, _name, _dict )       
  254.           T1_NEW_CALLBACK_FIELD( _ident, _name, _dict )
  255.   /*************************************************************************/
  256.   /*************************************************************************/
  257.   /*****                                                               *****/
  258.   /*****                            T1 PARSER                          *****/
  259.   /*****                                                               *****/
  260.   /*************************************************************************/
  261.   /*************************************************************************/
  262.   typedef const struct PS_Parser_FuncsRec_*  PS_Parser_Funcs;
  263.   typedef struct  PS_Parser_FuncsRec_
  264.   {
  265.     void
  266.     (*init)( PS_Parser  parser,
  267.              FT_Byte*   base,
  268.              FT_Byte*   limit,
  269.              FT_Memory  memory );
  270.     void
  271.     (*done)( PS_Parser  parser );
  272.     void
  273.     (*skip_spaces)( PS_Parser  parser );
  274.     void
  275.     (*skip_PS_token)( PS_Parser  parser );
  276.     FT_Long
  277.     (*to_int)( PS_Parser  parser );
  278.     FT_Fixed
  279.     (*to_fixed)( PS_Parser  parser,
  280.                  FT_Int     power_ten );
  281.     FT_Error
  282.     (*to_bytes)( PS_Parser  parser,
  283.                  FT_Byte*   bytes,
  284.                  FT_Long    max_bytes,
  285.                  FT_Long*   pnum_bytes,
  286.                  FT_Bool    delimiters );
  287.     FT_Int
  288.     (*to_coord_array)( PS_Parser  parser,
  289.                        FT_Int     max_coords,
  290.                        FT_Short*  coords );
  291.     FT_Int
  292.     (*to_fixed_array)( PS_Parser  parser,
  293.                        FT_Int     max_values,
  294.                        FT_Fixed*  values,
  295.                        FT_Int     power_ten );
  296.     void
  297.     (*to_token)( PS_Parser  parser,
  298.                  T1_Token   token );
  299.     void
  300.     (*to_token_array)( PS_Parser  parser,
  301.                        T1_Token   tokens,
  302.                        FT_UInt    max_tokens,
  303.                        FT_Int*    pnum_tokens );
  304.     FT_Error
  305.     (*load_field)( PS_Parser       parser,
  306.                    const T1_Field  field,
  307.                    void**          objects,
  308.                    FT_UInt         max_objects,
  309.                    FT_ULong*       pflags );
  310.     FT_Error
  311.     (*load_field_table)( PS_Parser       parser,
  312.                          const T1_Field  field,
  313.                          void**          objects,
  314.                          FT_UInt         max_objects,
  315.                          FT_ULong*       pflags );
  316.   } PS_Parser_FuncsRec;
  317.   /*************************************************************************/
  318.   /*                                                                       */
  319.   /* <Struct>                                                              */
  320.   /*    PS_ParserRec                                                       */
  321.   /*                                                                       */
  322.   /* <Description>                                                         */
  323.   /*    A PS_Parser is an object used to parse a Type 1 font very quickly. */
  324.   /*                                                                       */
  325.   /* <Fields>                                                              */
  326.   /*    cursor :: The current position in the text.                        */
  327.   /*                                                                       */
  328.   /*    base   :: Start of the processed text.                             */
  329.   /*                                                                       */
  330.   /*    limit  :: End of the processed text.                               */
  331.   /*                                                                       */
  332.   /*    error  :: The last error returned.                                 */
  333.   /*                                                                       */
  334.   /*    memory :: The object used for memory operations (alloc/realloc).   */
  335.   /*                                                                       */
  336.   /*    funcs  :: A table of functions for the parser.                     */
  337.   /*                                                                       */
  338.   typedef struct  PS_ParserRec_
  339.   {
  340.     FT_Byte*   cursor;
  341.     FT_Byte*   base;
  342.     FT_Byte*   limit;
  343.     FT_Error   error;
  344.     FT_Memory  memory;
  345.     PS_Parser_FuncsRec  funcs;
  346.   } PS_ParserRec;
  347.   /*************************************************************************/
  348.   /*************************************************************************/
  349.   /*****                                                               *****/
  350.   /*****                         T1 BUILDER                            *****/
  351.   /*****                                                               *****/
  352.   /*************************************************************************/
  353.   /*************************************************************************/
  354.   typedef struct T1_BuilderRec_*  T1_Builder;
  355.   typedef FT_Error
  356.   (*T1_Builder_Check_Points_Func)( T1_Builder  builder,
  357.                                    FT_Int      count );
  358.   typedef void
  359.   (*T1_Builder_Add_Point_Func)( T1_Builder  builder,
  360.                                 FT_Pos      x,
  361.                                 FT_Pos      y,
  362.                                 FT_Byte     flag );
  363.   typedef FT_Error
  364.   (*T1_Builder_Add_Point1_Func)( T1_Builder  builder,
  365.                                  FT_Pos      x,
  366.                                  FT_Pos      y );
  367.   typedef FT_Error
  368.   (*T1_Builder_Add_Contour_Func)( T1_Builder  builder );
  369.   typedef FT_Error
  370.   (*T1_Builder_Start_Point_Func)( T1_Builder  builder,
  371.                                   FT_Pos      x,
  372.                                   FT_Pos      y );
  373.   typedef void
  374.   (*T1_Builder_Close_Contour_Func)( T1_Builder  builder );
  375.   typedef const struct T1_Builder_FuncsRec_*  T1_Builder_Funcs;
  376.   typedef struct  T1_Builder_FuncsRec_
  377.   {
  378.     void
  379.     (*init)( T1_Builder    builder,
  380.              FT_Face       face,
  381.              FT_Size       size,
  382.              FT_GlyphSlot  slot,
  383.              FT_Bool       hinting );
  384.     void
  385.     (*done)( T1_Builder   builder );
  386.     T1_Builder_Check_Points_Func   check_points;
  387.     T1_Builder_Add_Point_Func      add_point;
  388.     T1_Builder_Add_Point1_Func     add_point1;
  389.     T1_Builder_Add_Contour_Func    add_contour;
  390.     T1_Builder_Start_Point_Func    start_point;
  391.     T1_Builder_Close_Contour_Func  close_contour;
  392.   } T1_Builder_FuncsRec;
  393.   /* an enumeration type to handle charstring parsing states */
  394.   typedef enum  T1_ParseState_
  395.   {
  396.     T1_Parse_Start,
  397.     T1_Parse_Have_Width,
  398.     T1_Parse_Have_Moveto,
  399.     T1_Parse_Have_Path
  400.   } T1_ParseState;
  401.   /*************************************************************************/
  402.   /*                                                                       */
  403.   /* <Structure>                                                           */
  404.   /*    T1_BuilderRec                                                      */
  405.   /*                                                                       */
  406.   /* <Description>                                                         */
  407.   /*     A structure used during glyph loading to store its outline.       */
  408.   /*                                                                       */
  409.   /* <Fields>                                                              */
  410.   /*    memory       :: The current memory object.                         */
  411.   /*                                                                       */
  412.   /*    face         :: The current face object.                           */
  413.   /*                                                                       */
  414.   /*    glyph        :: The current glyph slot.                            */
  415.   /*                                                                       */
  416.   /*    loader       :: XXX                                                */
  417.   /*                                                                       */
  418.   /*    base         :: The base glyph outline.                            */
  419.   /*                                                                       */
  420.   /*    current      :: The current glyph outline.                         */
  421.   /*                                                                       */
  422.   /*    max_points   :: maximum points in builder outline                  */
  423.   /*                                                                       */
  424.   /*    max_contours :: Maximal number of contours in builder outline.     */
  425.   /*                                                                       */
  426.   /*    last         :: The last point position.                           */
  427.   /*                                                                       */
  428.   /*    scale_x      :: The horizontal scaling value (FUnits to            */
  429.   /*                    sub-pixels).                                       */
  430.   /*                                                                       */
  431.   /*    scale_y      :: The vertical scaling value (FUnits to sub-pixels). */
  432.   /*                                                                       */
  433.   /*    pos_x        :: The horizontal translation (if composite glyph).   */
  434.   /*                                                                       */
  435.   /*    pos_y        :: The vertical translation (if composite glyph).     */
  436.   /*                                                                       */
  437.   /*    left_bearing :: The left side bearing point.                       */
  438.   /*                                                                       */
  439.   /*    advance      :: The horizontal advance vector.                     */
  440.   /*                                                                       */
  441.   /*    bbox         :: Unused.                                            */
  442.   /*                                                                       */
  443.   /*    parse_state  :: An enumeration which controls the charstring       */
  444.   /*                    parsing state.                                     */
  445.   /*                                                                       */
  446.   /*    load_points  :: If this flag is not set, no points are loaded.     */
  447.   /*                                                                       */
  448.   /*    no_recurse   :: Set but not used.                                  */
  449.   /*                                                                       */
  450.   /*    metrics_only :: A boolean indicating that we only want to compute  */
  451.   /*                    the metrics of a given glyph, not load all of its  */
  452.   /*                    points.                                            */
  453.   /*                                                                       */
  454.   /*    funcs        :: An array of function pointers for the builder.     */
  455.   /*                                                                       */
  456.   typedef struct  T1_BuilderRec_
  457.   {
  458.     FT_Memory       memory;
  459.     FT_Face         face;
  460.     FT_GlyphSlot    glyph;
  461.     FT_GlyphLoader  loader;
  462.     FT_Outline*     base;
  463.     FT_Outline*     current;
  464.     FT_Vector       last;
  465.     FT_Fixed        scale_x;
  466.     FT_Fixed        scale_y;
  467.     FT_Pos          pos_x;
  468.     FT_Pos          pos_y;
  469.     FT_Vector       left_bearing;
  470.     FT_Vector       advance;
  471.     FT_BBox         bbox;          /* bounding box */
  472.     T1_ParseState   parse_state;
  473.     FT_Bool         load_points;
  474.     FT_Bool         no_recurse;
  475.     FT_Bool         shift;
  476.     FT_Bool         metrics_only;
  477.     void*           hints_funcs;    /* hinter-specific */
  478.     void*           hints_globals;  /* hinter-specific */
  479.     T1_Builder_FuncsRec  funcs;
  480.   } T1_BuilderRec;
  481.   /*************************************************************************/
  482.   /*************************************************************************/
  483.   /*****                                                               *****/
  484.   /*****                         T1 DECODER                            *****/
  485.   /*****                                                               *****/
  486.   /*************************************************************************/
  487.   /*************************************************************************/
  488. #if 0
  489.   /*************************************************************************/
  490.   /*                                                                       */
  491.   /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine   */
  492.   /* calls during glyph loading.                                           */
  493.   /*                                                                       */
  494. #define T1_MAX_SUBRS_CALLS  8
  495.   /*************************************************************************/
  496.   /*                                                                       */
  497.   /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity.  A     */
  498.   /* minimum of 16 is required.                                            */
  499.   /*                                                                       */
  500. #define T1_MAX_CHARSTRINGS_OPERANDS  32
  501. #endif /* 0 */
  502.   typedef struct  T1_Decoder_ZoneRec_
  503.   {
  504.     FT_Byte*  cursor;
  505.     FT_Byte*  base;
  506.     FT_Byte*  limit;
  507.   } T1_Decoder_ZoneRec, *T1_Decoder_Zone;
  508.   typedef struct T1_DecoderRec_*              T1_Decoder;
  509.   typedef const struct T1_Decoder_FuncsRec_*  T1_Decoder_Funcs;
  510.   typedef FT_Error
  511.   (*T1_Decoder_Callback)( T1_Decoder  decoder,
  512.                           FT_UInt     glyph_index );
  513.   typedef struct  T1_Decoder_FuncsRec_
  514.   {
  515.     FT_Error
  516.     (*init)( T1_Decoder           decoder,
  517.              FT_Face              face,
  518.              FT_Size              size,
  519.              FT_GlyphSlot         slot,
  520.              FT_Byte**            glyph_names,
  521.              PS_Blend             blend,
  522.              FT_Bool              hinting,
  523.              FT_Render_Mode       hint_mode,
  524.              T1_Decoder_Callback  callback );
  525.     void
  526.     (*done)( T1_Decoder  decoder );
  527.     FT_Error
  528.     (*parse_charstrings)( T1_Decoder  decoder,
  529.                           FT_Byte*    base,
  530.                           FT_UInt     len );
  531.   } T1_Decoder_FuncsRec;
  532.   typedef struct  T1_DecoderRec_
  533.   {
  534.     T1_BuilderRec        builder;
  535.     FT_Long              stack[T1_MAX_CHARSTRINGS_OPERANDS];
  536.     FT_Long*             top;
  537.     T1_Decoder_ZoneRec   zones[T1_MAX_SUBRS_CALLS + 1];
  538.     T1_Decoder_Zone      zone;
  539.     FT_Service_PsCMaps   psnames;      /* for seac */
  540.     FT_UInt              num_glyphs;
  541.     FT_Byte**            glyph_names;
  542.     FT_Int               lenIV;        /* internal for sub routine calls */
  543.     FT_UInt              num_subrs;
  544.     FT_Byte**            subrs;
  545.     FT_PtrDist*          subrs_len;    /* array of subrs length (optional) */
  546.     FT_Matrix            font_matrix;
  547.     FT_Vector            font_offset;
  548.     FT_Int               flex_state;
  549.     FT_Int               num_flex_vectors;
  550.     FT_Vector            flex_vectors[7];
  551.     PS_Blend             blend;       /* for multiple master support */
  552.     FT_Render_Mode       hint_mode;
  553.     T1_Decoder_Callback  parse_callback;
  554.     T1_Decoder_FuncsRec  funcs;
  555.     FT_Int*              buildchar;
  556.     FT_UInt              len_buildchar;
  557.   } T1_DecoderRec;
  558.   /*************************************************************************/
  559.   /*************************************************************************/
  560.   /*****                                                               *****/
  561.   /*****                            AFM PARSER                         *****/
  562.   /*****                                                               *****/
  563.   /*************************************************************************/
  564.   /*************************************************************************/
  565.   typedef struct AFM_ParserRec_*  AFM_Parser;
  566.   typedef struct  AFM_Parser_FuncsRec_
  567.   {
  568.     FT_Error
  569.     (*init)( AFM_Parser  parser,
  570.              FT_Memory   memory,
  571.              FT_Byte*    base,
  572.              FT_Byte*    limit );
  573.     void
  574.     (*done)( AFM_Parser  parser );
  575.     FT_Error
  576.     (*parse)( AFM_Parser  parser );
  577.   } AFM_Parser_FuncsRec;
  578.   typedef struct AFM_StreamRec_*  AFM_Stream;
  579.   /*************************************************************************/
  580.   /*                                                                       */
  581.   /* <Struct>                                                              */
  582.   /*    AFM_ParserRec                                                      */
  583.   /*                                                                       */
  584.   /* <Description>                                                         */
  585.   /*    An AFM_Parser is a parser for the AFM files.                       */
  586.   /*                                                                       */
  587.   /* <Fields>                                                              */
  588.   /*    memory    :: The object used for memory operations (alloc and      */
  589.   /*                 realloc).                                             */
  590.   /*                                                                       */
  591.   /*    stream    :: This is an opaque object.                             */
  592.   /*                                                                       */
  593.   /*    FontInfo  :: The result will be stored here.                       */
  594.   /*                                                                       */
  595.   /*    get_index :: A user provided function to get a glyph index by its  */
  596.   /*                 name.                                                 */
  597.   /*                                                                       */
  598.   typedef struct  AFM_ParserRec_
  599.   {
  600.     FT_Memory     memory;
  601.     AFM_Stream    stream;
  602.     AFM_FontInfo  FontInfo;
  603.     FT_Int
  604.     (*get_index)( const char*  name,
  605.                   FT_UInt      len,
  606.                   void*        user_data );
  607.     void*         user_data;
  608.   } AFM_ParserRec;
  609.   /*************************************************************************/
  610.   /*************************************************************************/
  611.   /*****                                                               *****/
  612.   /*****                     TYPE1 CHARMAPS                            *****/
  613.   /*****                                                               *****/
  614.   /*************************************************************************/
  615.   /*************************************************************************/
  616.   typedef const struct T1_CMap_ClassesRec_*  T1_CMap_Classes;
  617.   typedef struct T1_CMap_ClassesRec_
  618.   {
  619.     FT_CMap_Class  standard;
  620.     FT_CMap_Class  expert;
  621.     FT_CMap_Class  custom;
  622.     FT_CMap_Class  unicode;
  623.   } T1_CMap_ClassesRec;
  624.   /*************************************************************************/
  625.   /*************************************************************************/
  626.   /*****                                                               *****/
  627.   /*****                        PSAux Module Interface                 *****/
  628.   /*****                                                               *****/
  629.   /*************************************************************************/
  630.   /*************************************************************************/
  631.   typedef struct  PSAux_ServiceRec_
  632.   {
  633.     /* don't use `PS_Table_Funcs' and friends to avoid compiler warnings */
  634.     const PS_Table_FuncsRec*    ps_table_funcs;
  635.     const PS_Parser_FuncsRec*   ps_parser_funcs;
  636.     const T1_Builder_FuncsRec*  t1_builder_funcs;
  637.     const T1_Decoder_FuncsRec*  t1_decoder_funcs;
  638.     void
  639.     (*t1_decrypt)( FT_Byte*   buffer,
  640.                    FT_Offset  length,
  641.                    FT_UShort  seed );
  642.     T1_CMap_Classes  t1_cmap_classes;
  643.     /* fields after this comment line were added after version 2.1.10 */
  644.     const AFM_Parser_FuncsRec*  afm_parser_funcs;
  645.   } PSAux_ServiceRec, *PSAux_Service;
  646.   /* backwards-compatible type definition */
  647.   typedef PSAux_ServiceRec   PSAux_Interface;
  648.   /*************************************************************************/
  649.   /*************************************************************************/
  650.   /*****                                                               *****/
  651.   /*****                 Some convenience functions                    *****/
  652.   /*****                                                               *****/
  653.   /*************************************************************************/
  654.   /*************************************************************************/
  655. #define IS_PS_NEWLINE( ch ) 
  656.   ( (ch) == 'r' ||         
  657.     (ch) == 'n' )
  658. #define IS_PS_SPACE( ch )  
  659.   ( (ch) == ' '         || 
  660.     IS_PS_NEWLINE( ch ) || 
  661.     (ch) == 't'        || 
  662.     (ch) == 'f'        || 
  663.     (ch) == '' )
  664. #define IS_PS_SPECIAL( ch )       
  665.   ( (ch) == '/'                || 
  666.     (ch) == '(' || (ch) == ')' || 
  667.     (ch) == '<' || (ch) == '>' || 
  668.     (ch) == '[' || (ch) == ']' || 
  669.     (ch) == '{' || (ch) == '}' || 
  670.     (ch) == '%'                )
  671. #define IS_PS_DELIM( ch )  
  672.   ( IS_PS_SPACE( ch )   || 
  673.     IS_PS_SPECIAL( ch ) )
  674. #define IS_PS_DIGIT( ch )        
  675.   ( (ch) >= '0' && (ch) <= '9' )
  676. #define IS_PS_XDIGIT( ch )            
  677.   ( IS_PS_DIGIT( ch )              || 
  678.     ( (ch) >= 'A' && (ch) <= 'F' ) || 
  679.     ( (ch) >= 'a' && (ch) <= 'f' ) )
  680. #define IS_PS_BASE85( ch )       
  681.   ( (ch) >= '!' && (ch) <= 'u' )
  682. #define IS_PS_TOKEN( cur, limit, token )                                
  683.   ( (char)(cur)[0] == (token)[0]                                     && 
  684.     ( (cur) + sizeof ( (token) ) == (limit) ||                          
  685.       ( (cur) + sizeof( (token) ) < (limit)          &&                 
  686.         IS_PS_DELIM( (cur)[sizeof ( (token) ) - 1] ) ) )             && 
  687.     ft_strncmp( (char*)(cur), (token), sizeof ( (token) ) - 1 ) == 0 )
  688. FT_END_HEADER
  689. #endif /* __PSAUX_H__ */
  690. /* END */