1 /***************************************************************************/
5 /* OpenType Glyph Loader (specification). */
7 /* Copyright 1996-2000 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
16 /***************************************************************************/
22 #include <freetype/freetype.h>
25 #ifdef FT_FLAT_COMPILE
31 #include <freetype/src/cff/t2objs.h>
41 #define T2_MAX_OPERANDS 48
42 #define T2_MAX_SUBRS_CALLS 32
45 /*************************************************************************/
51 /* A structure used during glyph loading to store its outline. */
54 /* memory :: The current memory object. */
56 /* face :: The current face object. */
58 /* glyph :: The current glyph slot. */
60 /* current :: The current glyph outline. */
62 /* base :: The base glyph outline. */
64 /* max_points :: maximum points in builder outline */
66 /* max_contours :: Maximal number of contours in builder outline. */
68 /* last :: The last point position. */
70 /* scale_x :: The horizontal scale (FUnits to sub-pixels). */
72 /* scale_y :: The vertical scale (FUnits to sub-pixels). */
74 /* pos_x :: The horizontal translation (if composite glyph). */
76 /* pos_y :: The vertical translation (if composite glyph). */
78 /* left_bearing :: The left side bearing point. */
80 /* advance :: The horizontal advance vector. */
84 /* path_begun :: A flag which indicates that a new path has begun. */
86 /* load_points :: If this flag is not set, no points are loaded. */
88 /* no_recurse :: Set but not used. */
90 /* error :: An error code that is only used to report memory */
91 /* allocation problems. */
93 /* metrics_only :: A boolean indicating that we only want to compute */
94 /* the metrics of a given glyph, not load all of its */
97 typedef struct T2_Builder_
102 FT_GlyphLoader* loader;
114 FT_Vector left_bearing;
117 FT_BBox bbox; /* bounding box */
122 FT_Error error; /* only used for memory errors */
123 FT_Bool metrics_only;
128 /* execution context charstring zone */
130 typedef struct T2_Decoder_Zone_
139 typedef struct T2_Decoder_
144 FT_Fixed stack[T2_MAX_OPERANDS + 1];
147 T2_Decoder_Zone zones[T2_MAX_SUBRS_CALLS + 1];
148 T2_Decoder_Zone* zone;
151 FT_Int num_flex_vectors;
152 FT_Vector flex_vectors[7];
155 FT_Pos nominal_width;
160 FT_Int len_buildchar;
175 void T2_Init_Decoder( T2_Decoder* decoder,
181 void T2_Prepare_Decoder( T2_Decoder* decoder,
182 FT_UInt glyph_index );
184 #if 0 /* unused until we support pure CFF fonts */
186 /* Compute the maximum advance width of a font through quick parsing */
188 FT_Error T2_Compute_Max_Advance( TT_Face face,
189 FT_Int* max_advance );
194 FT_Error T2_Parse_CharStrings( T2_Decoder* decoder,
195 FT_Byte* charstring_base,
196 FT_Int charstring_len );
199 FT_Error T2_Load_Glyph( T2_GlyphSlot glyph,
210 #endif /* T2GLOAD_H */