1 /***************************************************************************/
5 /* OpenType Glyph Loader (specification). */
7 /* Copyright 1996-2001 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 /***************************************************************************/
19 #ifndef __CFFGLOAD_H__
20 #define __CFFGLOAD_H__
24 #include FT_FREETYPE_H
31 #define CFF_MAX_OPERANDS 48
32 #define CFF_MAX_SUBRS_CALLS 32
35 /*************************************************************************/
41 /* A structure used during glyph loading to store its outline. */
44 /* memory :: The current memory object. */
46 /* face :: The current face object. */
48 /* glyph :: The current glyph slot. */
50 /* current :: The current glyph outline. */
52 /* base :: The base glyph outline. */
54 /* max_points :: maximum points in builder outline */
56 /* max_contours :: Maximal number of contours in builder outline. */
58 /* last :: The last point position. */
60 /* scale_x :: The horizontal scale (FUnits to sub-pixels). */
62 /* scale_y :: The vertical scale (FUnits to sub-pixels). */
64 /* pos_x :: The horizontal translation (if composite glyph). */
66 /* pos_y :: The vertical translation (if composite glyph). */
68 /* left_bearing :: The left side bearing point. */
70 /* advance :: The horizontal advance vector. */
74 /* path_begun :: A flag which indicates that a new path has begun. */
76 /* load_points :: If this flag is not set, no points are loaded. */
78 /* no_recurse :: Set but not used. */
80 /* error :: An error code that is only used to report memory */
81 /* allocation problems. */
83 /* metrics_only :: A boolean indicating that we only want to compute */
84 /* the metrics of a given glyph, not load all of its */
87 typedef struct CFF_Builder_
92 FT_GlyphLoader* loader;
104 FT_Vector left_bearing;
107 FT_BBox bbox; /* bounding box */
112 FT_Error error; /* only used for memory errors */
113 FT_Bool metrics_only;
118 /* execution context charstring zone */
120 typedef struct CFF_Decoder_Zone_
129 typedef struct CFF_Decoder_
134 FT_Fixed stack[CFF_MAX_OPERANDS + 1];
137 CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1];
138 CFF_Decoder_Zone* zone;
141 FT_Int num_flex_vectors;
142 FT_Vector flex_vectors[7];
145 FT_Pos nominal_width;
150 FT_Int len_buildchar;
161 FT_Byte** glyph_names; /* for pure CFF fonts only */
162 FT_UInt num_glyphs; /* number of glyphs in font */
168 CFF_Init_Decoder( CFF_Decoder* decoder,
171 CFF_GlyphSlot slot );
174 CFF_Prepare_Decoder( CFF_Decoder* decoder,
175 FT_UInt glyph_index );
177 #if 0 /* unused until we support pure CFF fonts */
179 /* Compute the maximum advance width of a font through quick parsing */
181 CFF_Compute_Max_Advance( TT_Face face,
182 FT_Int* max_advance );
187 CFF_Parse_CharStrings( CFF_Decoder* decoder,
188 FT_Byte* charstring_base,
189 FT_Int charstring_len );
192 CFF_Load_Glyph( CFF_GlyphSlot glyph,
200 #endif /* __CFFGLOAD_H__ */