cffgload.h

Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  cffgload.h                                                             */
00004 /*                                                                         */
00005 /*    OpenType Glyph Loader (specification).                               */
00006 /*                                                                         */
00007 /*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by       */
00008 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00009 /*                                                                         */
00010 /*  This file is part of the FreeType project, and may only be used,       */
00011 /*  modified, and distributed under the terms of the FreeType project      */
00012 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00013 /*  this file you indicate that you have read the license and              */
00014 /*  understand and accept it fully.                                        */
00015 /*                                                                         */
00016 /***************************************************************************/
00017 
00018 
00019 #ifndef __CFFGLOAD_H__
00020 #define __CFFGLOAD_H__
00021 
00022 
00023 #include <ft2build.h>
00024 #include FT_FREETYPE_H
00025 #include "cffobjs.h"
00026 
00027 
00028 FT_BEGIN_HEADER
00029 
00030 
00031 #define CFF_MAX_OPERANDS        48
00032 #define CFF_MAX_SUBRS_CALLS     32
00033 #define CFF_MAX_TRANS_ELEMENTS  32
00034 
00035 
00036   /*************************************************************************/
00037   /*                                                                       */
00038   /* <Structure>                                                           */
00039   /*    CFF_Builder                                                        */
00040   /*                                                                       */
00041   /* <Description>                                                         */
00042   /*     A structure used during glyph loading to store its outline.       */
00043   /*                                                                       */
00044   /* <Fields>                                                              */
00045   /*    memory        :: The current memory object.                        */
00046   /*                                                                       */
00047   /*    face          :: The current face object.                          */
00048   /*                                                                       */
00049   /*    glyph         :: The current glyph slot.                           */
00050   /*                                                                       */
00051   /*    loader        :: The current glyph loader.                         */
00052   /*                                                                       */
00053   /*    base          :: The base glyph outline.                           */
00054   /*                                                                       */
00055   /*    current       :: The current glyph outline.                        */
00056   /*                                                                       */
00057   /*    pos_x         :: The horizontal translation (if composite glyph).  */
00058   /*                                                                       */
00059   /*    pos_y         :: The vertical translation (if composite glyph).    */
00060   /*                                                                       */
00061   /*    left_bearing  :: The left side bearing point.                      */
00062   /*                                                                       */
00063   /*    advance       :: The horizontal advance vector.                    */
00064   /*                                                                       */
00065   /*    bbox          :: Unused.                                           */
00066   /*                                                                       */
00067   /*    path_begun    :: A flag which indicates that a new path has begun. */
00068   /*                                                                       */
00069   /*    load_points   :: If this flag is not set, no points are loaded.    */
00070   /*                                                                       */
00071   /*    no_recurse    :: Set but not used.                                 */
00072   /*                                                                       */
00073   /*    metrics_only  :: A boolean indicating that we only want to compute */
00074   /*                     the metrics of a given glyph, not load all of its */
00075   /*                     points.                                           */
00076   /*                                                                       */
00077   /*    hints_funcs   :: Auxiliary pointer for hinting.                    */
00078   /*                                                                       */
00079   /*    hints_globals :: Auxiliary pointer for hinting.                    */
00080   /*                                                                       */
00081   typedef struct  CFF_Builder_
00082   {
00083     FT_Memory       memory;
00084     TT_Face         face;
00085     CFF_GlyphSlot   glyph;
00086     FT_GlyphLoader  loader;
00087     FT_Outline*     base;
00088     FT_Outline*     current;
00089 
00090     FT_Pos          pos_x;
00091     FT_Pos          pos_y;
00092 
00093     FT_Vector       left_bearing;
00094     FT_Vector       advance;
00095 
00096     FT_BBox         bbox;          /* bounding box */
00097     FT_Bool         path_begun;
00098     FT_Bool         load_points;
00099     FT_Bool         no_recurse;
00100 
00101     FT_Bool         metrics_only;
00102 
00103     void*           hints_funcs;    /* hinter-specific */
00104     void*           hints_globals;  /* hinter-specific */
00105 
00106   } CFF_Builder;
00107 
00108 
00109   /* execution context charstring zone */
00110 
00111   typedef struct  CFF_Decoder_Zone_
00112   {
00113     FT_Byte*  base;
00114     FT_Byte*  limit;
00115     FT_Byte*  cursor;
00116 
00117   } CFF_Decoder_Zone;
00118 
00119 
00120   typedef struct  CFF_Decoder_
00121   {
00122     CFF_Builder        builder;
00123     CFF_Font           cff;
00124 
00125     FT_Fixed           stack[CFF_MAX_OPERANDS + 1];
00126     FT_Fixed*          top;
00127 
00128     CFF_Decoder_Zone   zones[CFF_MAX_SUBRS_CALLS + 1];
00129     CFF_Decoder_Zone*  zone;
00130 
00131     FT_Int             flex_state;
00132     FT_Int             num_flex_vectors;
00133     FT_Vector          flex_vectors[7];
00134 
00135     FT_Pos             glyph_width;
00136     FT_Pos             nominal_width;
00137 
00138     FT_Bool            read_width;
00139     FT_Bool            width_only;
00140     FT_Int             num_hints;
00141     FT_Fixed           buildchar[CFF_MAX_TRANS_ELEMENTS];
00142 
00143     FT_UInt            num_locals;
00144     FT_UInt            num_globals;
00145 
00146     FT_Int             locals_bias;
00147     FT_Int             globals_bias;
00148 
00149     FT_Byte**          locals;
00150     FT_Byte**          globals;
00151 
00152     FT_Byte**          glyph_names;   /* for pure CFF fonts only  */
00153     FT_UInt            num_glyphs;    /* number of glyphs in font */
00154 
00155     FT_Render_Mode     hint_mode;
00156 
00157     FT_Bool            seac;
00158 
00159   } CFF_Decoder;
00160 
00161 
00162   FT_LOCAL( void )
00163   cff_decoder_init( CFF_Decoder*    decoder,
00164                     TT_Face         face,
00165                     CFF_Size        size,
00166                     CFF_GlyphSlot   slot,
00167                     FT_Bool         hinting,
00168                     FT_Render_Mode  hint_mode );
00169 
00170   FT_LOCAL( FT_Error )
00171   cff_decoder_prepare( CFF_Decoder*  decoder,
00172                        CFF_Size      size,
00173                        FT_UInt       glyph_index );
00174 
00175 #if 0  /* unused until we support pure CFF fonts */
00176 
00177   /* Compute the maximum advance width of a font through quick parsing */
00178   FT_LOCAL( FT_Error )
00179   cff_compute_max_advance( TT_Face  face,
00180                            FT_Int*  max_advance );
00181 
00182 #endif /* 0 */
00183 
00184   FT_LOCAL( FT_Error )
00185   cff_decoder_parse_charstrings( CFF_Decoder*  decoder,
00186                                  FT_Byte*      charstring_base,
00187                                  FT_ULong      charstring_len );
00188 
00189   FT_LOCAL( FT_Error )
00190   cff_slot_load( CFF_GlyphSlot  glyph,
00191                  CFF_Size       size,
00192                  FT_UInt        glyph_index,
00193                  FT_Int32       load_flags );
00194 
00195 
00196 FT_END_HEADER
00197 
00198 #endif /* __CFFGLOAD_H__ */
00199 
00200 
00201 /* END */

Generated on Tue Jul 5 14:13:46 2011 for ROOT_528-00b_version by  doxygen 1.5.1