ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

psaux.h
Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  psaux.h                                                                */
00004 /*                                                                         */
00005 /*    Auxiliary functions and data structures related to PostScript fonts  */
00006 /*    (specification).                                                     */
00007 /*                                                                         */
00008 /*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by             */
00009 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00010 /*                                                                         */
00011 /*  This file is part of the FreeType project, and may only be used,       */
00012 /*  modified, and distributed under the terms of the FreeType project      */
00013 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00014 /*  this file you indicate that you have read the license and              */
00015 /*  understand and accept it fully.                                        */
00016 /*                                                                         */
00017 /***************************************************************************/
00018 
00019 
00020 #ifndef __PSAUX_H__
00021 #define __PSAUX_H__
00022 
00023 
00024 #include <ft2build.h>
00025 #include FT_INTERNAL_OBJECTS_H
00026 #include FT_INTERNAL_TYPE1_TYPES_H
00027 #include FT_SERVICE_POSTSCRIPT_CMAPS_H
00028 
00029 
00030 FT_BEGIN_HEADER
00031 
00032 
00033   /*************************************************************************/
00034   /*************************************************************************/
00035   /*****                                                               *****/
00036   /*****                             T1_TABLE                          *****/
00037   /*****                                                               *****/
00038   /*************************************************************************/
00039   /*************************************************************************/
00040 
00041 
00042   typedef struct PS_TableRec_*              PS_Table;
00043   typedef const struct PS_Table_FuncsRec_*  PS_Table_Funcs;
00044 
00045 
00046   /*************************************************************************/
00047   /*                                                                       */
00048   /* <Struct>                                                              */
00049   /*    PS_Table_FuncsRec                                                  */
00050   /*                                                                       */
00051   /* <Description>                                                         */
00052   /*    A set of function pointers to manage PS_Table objects.             */
00053   /*                                                                       */
00054   /* <Fields>                                                              */
00055   /*    table_init    :: Used to initialize a table.                       */
00056   /*                                                                       */
00057   /*    table_done    :: Finalizes resp. destroy a given table.            */
00058   /*                                                                       */
00059   /*    table_add     :: Adds a new object to a table.                     */
00060   /*                                                                       */
00061   /*    table_release :: Releases table data, then finalizes it.           */
00062   /*                                                                       */
00063   typedef struct  PS_Table_FuncsRec_
00064   {
00065     FT_Error
00066     (*init)( PS_Table   table,
00067              FT_Int     count,
00068              FT_Memory  memory );
00069 
00070     void
00071     (*done)( PS_Table  table );
00072 
00073     FT_Error
00074     (*add)( PS_Table    table,
00075             FT_Int      idx,
00076             void*       object,
00077             FT_PtrDist  length );
00078 
00079     void
00080     (*release)( PS_Table  table );
00081 
00082   } PS_Table_FuncsRec;
00083 
00084 
00085   /*************************************************************************/
00086   /*                                                                       */
00087   /* <Struct>                                                              */
00088   /*    PS_TableRec                                                        */
00089   /*                                                                       */
00090   /* <Description>                                                         */
00091   /*    A PS_Table is a simple object used to store an array of objects in */
00092   /*    a single memory block.                                             */
00093   /*                                                                       */
00094   /* <Fields>                                                              */
00095   /*    block     :: The address in memory of the growheap's block.  This  */
00096   /*                 can change between two object adds, due to            */
00097   /*                 reallocation.                                         */
00098   /*                                                                       */
00099   /*    cursor    :: The current top of the grow heap within its block.    */
00100   /*                                                                       */
00101   /*    capacity  :: The current size of the heap block.  Increments by    */
00102   /*                 1kByte chunks.                                        */
00103   /*                                                                       */
00104   /*    max_elems :: The maximum number of elements in table.              */
00105   /*                                                                       */
00106   /*    num_elems :: The current number of elements in table.              */
00107   /*                                                                       */
00108   /*    elements  :: A table of element addresses within the block.        */
00109   /*                                                                       */
00110   /*    lengths   :: A table of element sizes within the block.            */
00111   /*                                                                       */
00112   /*    memory    :: The object used for memory operations                 */
00113   /*                 (alloc/realloc).                                      */
00114   /*                                                                       */
00115   /*    funcs     :: A table of method pointers for this object.           */
00116   /*                                                                       */
00117   typedef struct  PS_TableRec_
00118   {
00119     FT_Byte*           block;          /* current memory block           */
00120     FT_Offset          cursor;         /* current cursor in memory block */
00121     FT_Offset          capacity;       /* current size of memory block   */
00122     FT_Long            init;
00123 
00124     FT_Int             max_elems;
00125     FT_Int             num_elems;
00126     FT_Byte**          elements;       /* addresses of table elements */
00127     FT_PtrDist*        lengths;        /* lengths of table elements   */
00128 
00129     FT_Memory          memory;
00130     PS_Table_FuncsRec  funcs;
00131 
00132   } PS_TableRec;
00133 
00134 
00135   /*************************************************************************/
00136   /*************************************************************************/
00137   /*****                                                               *****/
00138   /*****                       T1 FIELDS & TOKENS                      *****/
00139   /*****                                                               *****/
00140   /*************************************************************************/
00141   /*************************************************************************/
00142 
00143   typedef struct PS_ParserRec_*  PS_Parser;
00144 
00145   typedef struct T1_TokenRec_*   T1_Token;
00146 
00147   typedef struct T1_FieldRec_*   T1_Field;
00148 
00149 
00150   /* simple enumeration type used to identify token types */
00151   typedef enum  T1_TokenType_
00152   {
00153     T1_TOKEN_TYPE_NONE = 0,
00154     T1_TOKEN_TYPE_ANY,
00155     T1_TOKEN_TYPE_STRING,
00156     T1_TOKEN_TYPE_ARRAY,
00157     T1_TOKEN_TYPE_KEY, /* aka `name' */
00158 
00159     /* do not remove */
00160     T1_TOKEN_TYPE_MAX
00161 
00162   } T1_TokenType;
00163 
00164 
00165   /* a simple structure used to identify tokens */
00166   typedef struct  T1_TokenRec_
00167   {
00168     FT_Byte*      start;   /* first character of token in input stream */
00169     FT_Byte*      limit;   /* first character after the token          */
00170     T1_TokenType  type;    /* type of token                            */
00171 
00172   } T1_TokenRec;
00173 
00174 
00175   /* enumeration type used to identify object fields */
00176   typedef enum  T1_FieldType_
00177   {
00178     T1_FIELD_TYPE_NONE = 0,
00179     T1_FIELD_TYPE_BOOL,
00180     T1_FIELD_TYPE_INTEGER,
00181     T1_FIELD_TYPE_FIXED,
00182     T1_FIELD_TYPE_FIXED_1000,
00183     T1_FIELD_TYPE_STRING,
00184     T1_FIELD_TYPE_KEY,
00185     T1_FIELD_TYPE_BBOX,
00186     T1_FIELD_TYPE_INTEGER_ARRAY,
00187     T1_FIELD_TYPE_FIXED_ARRAY,
00188     T1_FIELD_TYPE_CALLBACK,
00189 
00190     /* do not remove */
00191     T1_FIELD_TYPE_MAX
00192 
00193   } T1_FieldType;
00194 
00195 
00196   typedef enum  T1_FieldLocation_
00197   {
00198     T1_FIELD_LOCATION_CID_INFO,
00199     T1_FIELD_LOCATION_FONT_DICT,
00200     T1_FIELD_LOCATION_FONT_EXTRA,
00201     T1_FIELD_LOCATION_FONT_INFO,
00202     T1_FIELD_LOCATION_PRIVATE,
00203     T1_FIELD_LOCATION_BBOX,
00204     T1_FIELD_LOCATION_LOADER,
00205     T1_FIELD_LOCATION_FACE,
00206     T1_FIELD_LOCATION_BLEND,
00207 
00208     /* do not remove */
00209     T1_FIELD_LOCATION_MAX
00210 
00211   } T1_FieldLocation;
00212 
00213 
00214   typedef void
00215   (*T1_Field_ParseFunc)( FT_Face     face,
00216                          FT_Pointer  parser );
00217 
00218 
00219   /* structure type used to model object fields */
00220   typedef struct  T1_FieldRec_
00221   {
00222     const char*         ident;        /* field identifier               */
00223     T1_FieldLocation    location;
00224     T1_FieldType        type;         /* type of field                  */
00225     T1_Field_ParseFunc  reader;
00226     FT_UInt             offset;       /* offset of field in object      */
00227     FT_Byte             size;         /* size of field in bytes         */
00228     FT_UInt             array_max;    /* maximal number of elements for */
00229                                       /* array                          */
00230     FT_UInt             count_offset; /* offset of element count for    */
00231                                       /* arrays; must not be zero if in */
00232                                       /* use -- in other words, a       */
00233                                       /* `num_FOO' element must not     */
00234                                       /* start the used structure if we */
00235                                       /* parse a `FOO' array            */
00236     FT_UInt             dict;         /* where we expect it             */
00237   } T1_FieldRec;
00238 
00239 #define T1_FIELD_DICT_FONTDICT ( 1 << 0 ) /* also FontInfo and FDArray */
00240 #define T1_FIELD_DICT_PRIVATE  ( 1 << 1 )
00241 
00242 
00243 
00244 #define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname, _dict ) \
00245           {                                                 \
00246             _ident, T1CODE, _type,                          \
00247             0,                                              \
00248             FT_FIELD_OFFSET( _fname ),                      \
00249             FT_FIELD_SIZE( _fname ),                        \
00250             0, 0,                                           \
00251             _dict                                           \
00252           },
00253 
00254 #define T1_NEW_CALLBACK_FIELD( _ident, _reader, _dict ) \
00255           {                                             \
00256             _ident, T1CODE, T1_FIELD_TYPE_CALLBACK,     \
00257             (T1_Field_ParseFunc)_reader,                \
00258             0, 0,                                       \
00259             0, 0,                                       \
00260             _dict                                       \
00261           },
00262 
00263 #define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max, _dict ) \
00264           {                                                      \
00265             _ident, T1CODE, _type,                               \
00266             0,                                                   \
00267             FT_FIELD_OFFSET( _fname ),                           \
00268             FT_FIELD_SIZE_DELTA( _fname ),                       \
00269             _max,                                                \
00270             FT_FIELD_OFFSET( num_ ## _fname ),                   \
00271             _dict                                                \
00272           },
00273 
00274 #define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max, _dict ) \
00275           {                                                       \
00276             _ident, T1CODE, _type,                                \
00277             0,                                                    \
00278             FT_FIELD_OFFSET( _fname ),                            \
00279             FT_FIELD_SIZE_DELTA( _fname ),                        \
00280             _max, 0,                                              \
00281             _dict                                                 \
00282           },
00283 
00284 
00285 #define T1_FIELD_BOOL( _ident, _fname, _dict )                             \
00286           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname, _dict )
00287 
00288 #define T1_FIELD_NUM( _ident, _fname, _dict )                                 \
00289           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname, _dict )
00290 
00291 #define T1_FIELD_FIXED( _ident, _fname, _dict )                             \
00292           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname, _dict )
00293 
00294 #define T1_FIELD_FIXED_1000( _ident, _fname, _dict )                     \
00295           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname, \
00296                                _dict )
00297 
00298 #define T1_FIELD_STRING( _ident, _fname, _dict )                             \
00299           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname, _dict )
00300 
00301 #define T1_FIELD_KEY( _ident, _fname, _dict )                             \
00302           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname, _dict )
00303 
00304 #define T1_FIELD_BBOX( _ident, _fname, _dict )                             \
00305           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname, _dict )
00306 
00307 
00308 #define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax, _dict )         \
00309           T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \
00310                               _fname, _fmax, _dict )
00311 
00312 #define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax, _dict )     \
00313           T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \
00314                               _fname, _fmax, _dict )
00315 
00316 #define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax, _dict )         \
00317           T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \
00318                                _fname, _fmax, _dict )
00319 
00320 #define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax, _dict )     \
00321           T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \
00322                                _fname, _fmax, _dict )
00323 
00324 #define T1_FIELD_CALLBACK( _ident, _name, _dict )       \
00325           T1_NEW_CALLBACK_FIELD( _ident, _name, _dict )
00326 
00327 
00328   /*************************************************************************/
00329   /*************************************************************************/
00330   /*****                                                               *****/
00331   /*****                            T1 PARSER                          *****/
00332   /*****                                                               *****/
00333   /*************************************************************************/
00334   /*************************************************************************/
00335 
00336   typedef const struct PS_Parser_FuncsRec_*  PS_Parser_Funcs;
00337 
00338   typedef struct  PS_Parser_FuncsRec_
00339   {
00340     void
00341     (*init)( PS_Parser  parser,
00342              FT_Byte*   base,
00343              FT_Byte*   limit,
00344              FT_Memory  memory );
00345 
00346     void
00347     (*done)( PS_Parser  parser );
00348 
00349     void
00350     (*skip_spaces)( PS_Parser  parser );
00351     void
00352     (*skip_PS_token)( PS_Parser  parser );
00353 
00354     FT_Long
00355     (*to_int)( PS_Parser  parser );
00356     FT_Fixed
00357     (*to_fixed)( PS_Parser  parser,
00358                  FT_Int     power_ten );
00359 
00360     FT_Error
00361     (*to_bytes)( PS_Parser  parser,
00362                  FT_Byte*   bytes,
00363                  FT_Offset  max_bytes,
00364                  FT_Long*   pnum_bytes,
00365                  FT_Bool    delimiters );
00366 
00367     FT_Int
00368     (*to_coord_array)( PS_Parser  parser,
00369                        FT_Int     max_coords,
00370                        FT_Short*  coords );
00371     FT_Int
00372     (*to_fixed_array)( PS_Parser  parser,
00373                        FT_Int     max_values,
00374                        FT_Fixed*  values,
00375                        FT_Int     power_ten );
00376 
00377     void
00378     (*to_token)( PS_Parser  parser,
00379                  T1_Token   token );
00380     void
00381     (*to_token_array)( PS_Parser  parser,
00382                        T1_Token   tokens,
00383                        FT_UInt    max_tokens,
00384                        FT_Int*    pnum_tokens );
00385 
00386     FT_Error
00387     (*load_field)( PS_Parser       parser,
00388                    const T1_Field  field,
00389                    void**          objects,
00390                    FT_UInt         max_objects,
00391                    FT_ULong*       pflags );
00392 
00393     FT_Error
00394     (*load_field_table)( PS_Parser       parser,
00395                          const T1_Field  field,
00396                          void**          objects,
00397                          FT_UInt         max_objects,
00398                          FT_ULong*       pflags );
00399 
00400   } PS_Parser_FuncsRec;
00401 
00402 
00403   /*************************************************************************/
00404   /*                                                                       */
00405   /* <Struct>                                                              */
00406   /*    PS_ParserRec                                                       */
00407   /*                                                                       */
00408   /* <Description>                                                         */
00409   /*    A PS_Parser is an object used to parse a Type 1 font very quickly. */
00410   /*                                                                       */
00411   /* <Fields>                                                              */
00412   /*    cursor :: The current position in the text.                        */
00413   /*                                                                       */
00414   /*    base   :: Start of the processed text.                             */
00415   /*                                                                       */
00416   /*    limit  :: End of the processed text.                               */
00417   /*                                                                       */
00418   /*    error  :: The last error returned.                                 */
00419   /*                                                                       */
00420   /*    memory :: The object used for memory operations (alloc/realloc).   */
00421   /*                                                                       */
00422   /*    funcs  :: A table of functions for the parser.                     */
00423   /*                                                                       */
00424   typedef struct  PS_ParserRec_
00425   {
00426     FT_Byte*   cursor;
00427     FT_Byte*   base;
00428     FT_Byte*   limit;
00429     FT_Error   error;
00430     FT_Memory  memory;
00431 
00432     PS_Parser_FuncsRec  funcs;
00433 
00434   } PS_ParserRec;
00435 
00436 
00437   /*************************************************************************/
00438   /*************************************************************************/
00439   /*****                                                               *****/
00440   /*****                         T1 BUILDER                            *****/
00441   /*****                                                               *****/
00442   /*************************************************************************/
00443   /*************************************************************************/
00444 
00445 
00446   typedef struct T1_BuilderRec_*  T1_Builder;
00447 
00448 
00449   typedef FT_Error
00450   (*T1_Builder_Check_Points_Func)( T1_Builder  builder,
00451                                    FT_Int      count );
00452 
00453   typedef void
00454   (*T1_Builder_Add_Point_Func)( T1_Builder  builder,
00455                                 FT_Pos      x,
00456                                 FT_Pos      y,
00457                                 FT_Byte     flag );
00458 
00459   typedef FT_Error
00460   (*T1_Builder_Add_Point1_Func)( T1_Builder  builder,
00461                                  FT_Pos      x,
00462                                  FT_Pos      y );
00463 
00464   typedef FT_Error
00465   (*T1_Builder_Add_Contour_Func)( T1_Builder  builder );
00466 
00467   typedef FT_Error
00468   (*T1_Builder_Start_Point_Func)( T1_Builder  builder,
00469                                   FT_Pos      x,
00470                                   FT_Pos      y );
00471 
00472   typedef void
00473   (*T1_Builder_Close_Contour_Func)( T1_Builder  builder );
00474 
00475 
00476   typedef const struct T1_Builder_FuncsRec_*  T1_Builder_Funcs;
00477 
00478   typedef struct  T1_Builder_FuncsRec_
00479   {
00480     void
00481     (*init)( T1_Builder    builder,
00482              FT_Face       face,
00483              FT_Size       size,
00484              FT_GlyphSlot  slot,
00485              FT_Bool       hinting );
00486 
00487     void
00488     (*done)( T1_Builder   builder );
00489 
00490     T1_Builder_Check_Points_Func   check_points;
00491     T1_Builder_Add_Point_Func      add_point;
00492     T1_Builder_Add_Point1_Func     add_point1;
00493     T1_Builder_Add_Contour_Func    add_contour;
00494     T1_Builder_Start_Point_Func    start_point;
00495     T1_Builder_Close_Contour_Func  close_contour;
00496 
00497   } T1_Builder_FuncsRec;
00498 
00499 
00500   /* an enumeration type to handle charstring parsing states */
00501   typedef enum  T1_ParseState_
00502   {
00503     T1_Parse_Start,
00504     T1_Parse_Have_Width,
00505     T1_Parse_Have_Moveto,
00506     T1_Parse_Have_Path
00507 
00508   } T1_ParseState;
00509 
00510 
00511   /*************************************************************************/
00512   /*                                                                       */
00513   /* <Structure>                                                           */
00514   /*    T1_BuilderRec                                                      */
00515   /*                                                                       */
00516   /* <Description>                                                         */
00517   /*     A structure used during glyph loading to store its outline.       */
00518   /*                                                                       */
00519   /* <Fields>                                                              */
00520   /*    memory       :: The current memory object.                         */
00521   /*                                                                       */
00522   /*    face         :: The current face object.                           */
00523   /*                                                                       */
00524   /*    glyph        :: The current glyph slot.                            */
00525   /*                                                                       */
00526   /*    loader       :: XXX                                                */
00527   /*                                                                       */
00528   /*    base         :: The base glyph outline.                            */
00529   /*                                                                       */
00530   /*    current      :: The current glyph outline.                         */
00531   /*                                                                       */
00532   /*    max_points   :: maximum points in builder outline                  */
00533   /*                                                                       */
00534   /*    max_contours :: Maximal number of contours in builder outline.     */
00535   /*                                                                       */
00536   /*    pos_x        :: The horizontal translation (if composite glyph).   */
00537   /*                                                                       */
00538   /*    pos_y        :: The vertical translation (if composite glyph).     */
00539   /*                                                                       */
00540   /*    left_bearing :: The left side bearing point.                       */
00541   /*                                                                       */
00542   /*    advance      :: The horizontal advance vector.                     */
00543   /*                                                                       */
00544   /*    bbox         :: Unused.                                            */
00545   /*                                                                       */
00546   /*    parse_state  :: An enumeration which controls the charstring       */
00547   /*                    parsing state.                                     */
00548   /*                                                                       */
00549   /*    load_points  :: If this flag is not set, no points are loaded.     */
00550   /*                                                                       */
00551   /*    no_recurse   :: Set but not used.                                  */
00552   /*                                                                       */
00553   /*    metrics_only :: A boolean indicating that we only want to compute  */
00554   /*                    the metrics of a given glyph, not load all of its  */
00555   /*                    points.                                            */
00556   /*                                                                       */
00557   /*    funcs        :: An array of function pointers for the builder.     */
00558   /*                                                                       */
00559   typedef struct  T1_BuilderRec_
00560   {
00561     FT_Memory       memory;
00562     FT_Face         face;
00563     FT_GlyphSlot    glyph;
00564     FT_GlyphLoader  loader;
00565     FT_Outline*     base;
00566     FT_Outline*     current;
00567 
00568     FT_Pos          pos_x;
00569     FT_Pos          pos_y;
00570 
00571     FT_Vector       left_bearing;
00572     FT_Vector       advance;
00573 
00574     FT_BBox         bbox;          /* bounding box */
00575     T1_ParseState   parse_state;
00576     FT_Bool         load_points;
00577     FT_Bool         no_recurse;
00578 
00579     FT_Bool         metrics_only;
00580 
00581     void*           hints_funcs;    /* hinter-specific */
00582     void*           hints_globals;  /* hinter-specific */
00583 
00584     T1_Builder_FuncsRec  funcs;
00585 
00586   } T1_BuilderRec;
00587 
00588 
00589   /*************************************************************************/
00590   /*************************************************************************/
00591   /*****                                                               *****/
00592   /*****                         T1 DECODER                            *****/
00593   /*****                                                               *****/
00594   /*************************************************************************/
00595   /*************************************************************************/
00596 
00597 #if 0
00598 
00599   /*************************************************************************/
00600   /*                                                                       */
00601   /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine   */
00602   /* calls during glyph loading.                                           */
00603   /*                                                                       */
00604 #define T1_MAX_SUBRS_CALLS  8
00605 
00606 
00607   /*************************************************************************/
00608   /*                                                                       */
00609   /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity.  A     */
00610   /* minimum of 16 is required.                                            */
00611   /*                                                                       */
00612 #define T1_MAX_CHARSTRINGS_OPERANDS  32
00613 
00614 #endif /* 0 */
00615 
00616 
00617   typedef struct  T1_Decoder_ZoneRec_
00618   {
00619     FT_Byte*  cursor;
00620     FT_Byte*  base;
00621     FT_Byte*  limit;
00622 
00623   } T1_Decoder_ZoneRec, *T1_Decoder_Zone;
00624 
00625 
00626   typedef struct T1_DecoderRec_*              T1_Decoder;
00627   typedef const struct T1_Decoder_FuncsRec_*  T1_Decoder_Funcs;
00628 
00629 
00630   typedef FT_Error
00631   (*T1_Decoder_Callback)( T1_Decoder  decoder,
00632                           FT_UInt     glyph_index );
00633 
00634 
00635   typedef struct  T1_Decoder_FuncsRec_
00636   {
00637     FT_Error
00638     (*init)( T1_Decoder           decoder,
00639              FT_Face              face,
00640              FT_Size              size,
00641              FT_GlyphSlot         slot,
00642              FT_Byte**            glyph_names,
00643              PS_Blend             blend,
00644              FT_Bool              hinting,
00645              FT_Render_Mode       hint_mode,
00646              T1_Decoder_Callback  callback );
00647 
00648     void
00649     (*done)( T1_Decoder  decoder );
00650 
00651     FT_Error
00652     (*parse_charstrings)( T1_Decoder  decoder,
00653                           FT_Byte*    base,
00654                           FT_UInt     len );
00655 
00656   } T1_Decoder_FuncsRec;
00657 
00658 
00659   typedef struct  T1_DecoderRec_
00660   {
00661     T1_BuilderRec        builder;
00662 
00663     FT_Long              stack[T1_MAX_CHARSTRINGS_OPERANDS];
00664     FT_Long*             top;
00665 
00666     T1_Decoder_ZoneRec   zones[T1_MAX_SUBRS_CALLS + 1];
00667     T1_Decoder_Zone      zone;
00668 
00669     FT_Service_PsCMaps   psnames;      /* for seac */
00670     FT_UInt              num_glyphs;
00671     FT_Byte**            glyph_names;
00672 
00673     FT_Int               lenIV;        /* internal for sub routine calls */
00674     FT_UInt              num_subrs;
00675     FT_Byte**            subrs;
00676     FT_PtrDist*          subrs_len;    /* array of subrs length (optional) */
00677 
00678     FT_Matrix            font_matrix;
00679     FT_Vector            font_offset;
00680 
00681     FT_Int               flex_state;
00682     FT_Int               num_flex_vectors;
00683     FT_Vector            flex_vectors[7];
00684 
00685     PS_Blend             blend;       /* for multiple master support */
00686 
00687     FT_Render_Mode       hint_mode;
00688 
00689     T1_Decoder_Callback  parse_callback;
00690     T1_Decoder_FuncsRec  funcs;
00691 
00692     FT_Long*             buildchar;
00693     FT_UInt              len_buildchar;
00694 
00695     FT_Bool              seac;
00696 
00697   } T1_DecoderRec;
00698 
00699 
00700   /*************************************************************************/
00701   /*************************************************************************/
00702   /*****                                                               *****/
00703   /*****                            AFM PARSER                         *****/
00704   /*****                                                               *****/
00705   /*************************************************************************/
00706   /*************************************************************************/
00707 
00708   typedef struct AFM_ParserRec_*  AFM_Parser;
00709 
00710   typedef struct  AFM_Parser_FuncsRec_
00711   {
00712     FT_Error
00713     (*init)( AFM_Parser  parser,
00714              FT_Memory   memory,
00715              FT_Byte*    base,
00716              FT_Byte*    limit );
00717 
00718     void
00719     (*done)( AFM_Parser  parser );
00720 
00721     FT_Error
00722     (*parse)( AFM_Parser  parser );
00723 
00724   } AFM_Parser_FuncsRec;
00725 
00726 
00727   typedef struct AFM_StreamRec_*  AFM_Stream;
00728 
00729 
00730   /*************************************************************************/
00731   /*                                                                       */
00732   /* <Struct>                                                              */
00733   /*    AFM_ParserRec                                                      */
00734   /*                                                                       */
00735   /* <Description>                                                         */
00736   /*    An AFM_Parser is a parser for the AFM files.                       */
00737   /*                                                                       */
00738   /* <Fields>                                                              */
00739   /*    memory    :: The object used for memory operations (alloc and      */
00740   /*                 realloc).                                             */
00741   /*                                                                       */
00742   /*    stream    :: This is an opaque object.                             */
00743   /*                                                                       */
00744   /*    FontInfo  :: The result will be stored here.                       */
00745   /*                                                                       */
00746   /*    get_index :: A user provided function to get a glyph index by its  */
00747   /*                 name.                                                 */
00748   /*                                                                       */
00749   typedef struct  AFM_ParserRec_
00750   {
00751     FT_Memory     memory;
00752     AFM_Stream    stream;
00753 
00754     AFM_FontInfo  FontInfo;
00755 
00756     FT_Int
00757     (*get_index)( const char*  name,
00758                   FT_Offset    len,
00759                   void*        user_data );
00760 
00761     void*         user_data;
00762 
00763   } AFM_ParserRec;
00764 
00765 
00766   /*************************************************************************/
00767   /*************************************************************************/
00768   /*****                                                               *****/
00769   /*****                     TYPE1 CHARMAPS                            *****/
00770   /*****                                                               *****/
00771   /*************************************************************************/
00772   /*************************************************************************/
00773 
00774   typedef const struct T1_CMap_ClassesRec_*  T1_CMap_Classes;
00775 
00776   typedef struct T1_CMap_ClassesRec_
00777   {
00778     FT_CMap_Class  standard;
00779     FT_CMap_Class  expert;
00780     FT_CMap_Class  custom;
00781     FT_CMap_Class  unicode;
00782 
00783   } T1_CMap_ClassesRec;
00784 
00785 
00786   /*************************************************************************/
00787   /*************************************************************************/
00788   /*****                                                               *****/
00789   /*****                        PSAux Module Interface                 *****/
00790   /*****                                                               *****/
00791   /*************************************************************************/
00792   /*************************************************************************/
00793 
00794   typedef struct  PSAux_ServiceRec_
00795   {
00796     /* don't use `PS_Table_Funcs' and friends to avoid compiler warnings */
00797     const PS_Table_FuncsRec*    ps_table_funcs;
00798     const PS_Parser_FuncsRec*   ps_parser_funcs;
00799     const T1_Builder_FuncsRec*  t1_builder_funcs;
00800     const T1_Decoder_FuncsRec*  t1_decoder_funcs;
00801 
00802     void
00803     (*t1_decrypt)( FT_Byte*   buffer,
00804                    FT_Offset  length,
00805                    FT_UShort  seed );
00806 
00807     T1_CMap_Classes  t1_cmap_classes;
00808 
00809     /* fields after this comment line were added after version 2.1.10 */
00810     const AFM_Parser_FuncsRec*  afm_parser_funcs;
00811 
00812   } PSAux_ServiceRec, *PSAux_Service;
00813 
00814   /* backwards-compatible type definition */
00815   typedef PSAux_ServiceRec   PSAux_Interface;
00816 
00817 
00818   /*************************************************************************/
00819   /*************************************************************************/
00820   /*****                                                               *****/
00821   /*****                 Some convenience functions                    *****/
00822   /*****                                                               *****/
00823   /*************************************************************************/
00824   /*************************************************************************/
00825 
00826 #define IS_PS_NEWLINE( ch ) \
00827   ( (ch) == '\r' ||         \
00828     (ch) == '\n' )
00829 
00830 #define IS_PS_SPACE( ch )  \
00831   ( (ch) == ' '         || \
00832     IS_PS_NEWLINE( ch ) || \
00833     (ch) == '\t'        || \
00834     (ch) == '\f'        || \
00835     (ch) == '\0' )
00836 
00837 #define IS_PS_SPECIAL( ch )       \
00838   ( (ch) == '/'                || \
00839     (ch) == '(' || (ch) == ')' || \
00840     (ch) == '<' || (ch) == '>' || \
00841     (ch) == '[' || (ch) == ']' || \
00842     (ch) == '{' || (ch) == '}' || \
00843     (ch) == '%'                )
00844 
00845 #define IS_PS_DELIM( ch )  \
00846   ( IS_PS_SPACE( ch )   || \
00847     IS_PS_SPECIAL( ch ) )
00848 
00849 #define IS_PS_DIGIT( ch )        \
00850   ( (ch) >= '0' && (ch) <= '9' )
00851 
00852 #define IS_PS_XDIGIT( ch )            \
00853   ( IS_PS_DIGIT( ch )              || \
00854     ( (ch) >= 'A' && (ch) <= 'F' ) || \
00855     ( (ch) >= 'a' && (ch) <= 'f' ) )
00856 
00857 #define IS_PS_BASE85( ch )       \
00858   ( (ch) >= '!' && (ch) <= 'u' )
00859 
00860 #define IS_PS_TOKEN( cur, limit, token )                                \
00861   ( (char)(cur)[0] == (token)[0]                                     && \
00862     ( (cur) + sizeof ( (token) ) == (limit) ||                          \
00863       ( (cur) + sizeof( (token) ) < (limit)          &&                 \
00864         IS_PS_DELIM( (cur)[sizeof ( (token) ) - 1] ) ) )             && \
00865     ft_strncmp( (char*)(cur), (token), sizeof ( (token) ) - 1 ) == 0 )
00866 
00867 
00868 FT_END_HEADER
00869 
00870 #endif /* __PSAUX_H__ */
00871 
00872 
00873 /* END */

Generated on Sun May 27 2012 04:33:32 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.