1 /***************************************************************************/
5 /* OpenType Glyph Loader (specification). */
7 /* Copyright 1996-2004, 2006-2009, 2013 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__
23 #include "../../include/ft2build.h"
24 #include "../../include/freetype/freetype.h"
31 #define CFF_MAX_OPERANDS 48
32 #define CFF_MAX_SUBRS_CALLS 32
33 #define CFF_MAX_TRANS_ELEMENTS 32
36 /*************************************************************************/
42 /* A structure used during glyph loading to store its outline. */
45 /* memory :: The current memory object. */
47 /* face :: The current face object. */
49 /* glyph :: The current glyph slot. */
51 /* loader :: The current glyph loader. */
53 /* base :: The base glyph outline. */
55 /* current :: The current glyph outline. */
57 /* pos_x :: The horizontal translation (if composite glyph). */
59 /* pos_y :: The vertical translation (if composite glyph). */
61 /* left_bearing :: The left side bearing point. */
63 /* advance :: The horizontal advance vector. */
67 /* path_begun :: A flag which indicates that a new path has begun. */
69 /* load_points :: If this flag is not set, no points are loaded. */
71 /* no_recurse :: Set but not used. */
73 /* metrics_only :: A boolean indicating that we only want to compute */
74 /* the metrics of a given glyph, not load all of its */
77 /* hints_funcs :: Auxiliary pointer for hinting. */
79 /* hints_globals :: Auxiliary pointer for hinting. */
81 typedef struct CFF_Builder_
86 FT_GlyphLoader loader;
93 FT_Vector left_bearing;
96 FT_BBox bbox; /* bounding box */
101 FT_Bool metrics_only;
103 void* hints_funcs; /* hinter-specific */
104 void* hints_globals; /* hinter-specific */
110 cff_check_points( CFF_Builder* builder,
114 cff_builder_add_point( CFF_Builder* builder,
119 cff_builder_add_point1( CFF_Builder* builder,
123 cff_builder_start_point( CFF_Builder* builder,
127 cff_builder_close_contour( CFF_Builder* builder );
131 cff_lookup_glyph_by_stdcharcode( CFF_Font cff,
134 cff_get_glyph_data( TT_Face face,
139 cff_free_glyph_data( TT_Face face,
144 /* execution context charstring zone */
146 typedef struct CFF_Decoder_Zone_
155 typedef struct CFF_Decoder_
160 FT_Fixed stack[CFF_MAX_OPERANDS + 1];
163 CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1];
164 CFF_Decoder_Zone* zone;
167 FT_Int num_flex_vectors;
168 FT_Vector flex_vectors[7];
171 FT_Pos nominal_width;
176 FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS];
187 FT_Byte** glyph_names; /* for pure CFF fonts only */
188 FT_UInt num_glyphs; /* number of glyphs in font */
190 FT_Render_Mode hint_mode;
194 CFF_SubFont current_subfont; /* for current glyph_index */
200 cff_decoder_init( CFF_Decoder* decoder,
205 FT_Render_Mode hint_mode );
208 cff_decoder_prepare( CFF_Decoder* decoder,
210 FT_UInt glyph_index );
212 #if 0 /* unused until we support pure CFF fonts */
214 /* Compute the maximum advance width of a font through quick parsing */
216 cff_compute_max_advance( TT_Face face,
217 FT_Int* max_advance );
221 #ifdef CFF_CONFIG_OPTION_OLD_ENGINE
223 cff_decoder_parse_charstrings( CFF_Decoder* decoder,
224 FT_Byte* charstring_base,
225 FT_ULong charstring_len );
229 cff_slot_load( CFF_GlyphSlot glyph,
232 FT_Int32 load_flags );
237 #endif /* __CFFGLOAD_H__ */