1 /***************************************************************************/
5 /* Type 1 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 /***************************************************************************/
23 #ifdef FT_FLAT_COMPILE
29 #include <type1/t1objs.h>
39 typedef struct T1_Builder_ T1_Builder
;
41 typedef FT_Error (*T1_Builder_EndChar
)( T1_Builder
* loader
);
43 typedef FT_Error (*T1_Builder_Sbw
)( T1_Builder
* loader
,
49 typedef FT_Error (*T1_Builder_ClosePath
)( T1_Builder
* loader
);
51 typedef FT_Error (*T1_Builder_RLineTo
)( T1_Builder
* loader
,
55 typedef FT_Error (*T1_Builder_RMoveTo
)( T1_Builder
* loader
,
59 typedef FT_Error (*T1_Builder_RCurveTo
)( T1_Builder
* loader
,
68 /*************************************************************************/
71 /* T1_Builder_Funcs */
74 /* A structure to store the address of various functions used by a */
75 /* glyph builder to implement the outline's `path construction'. */
77 typedef struct T1_Builder_Funcs_
79 T1_Builder_EndChar end_char
;
80 T1_Builder_Sbw set_bearing_point
;
81 T1_Builder_ClosePath close_path
;
82 T1_Builder_RLineTo rline_to
;
83 T1_Builder_RMoveTo rmove_to
;
84 T1_Builder_RCurveTo rcurve_to
;
89 /*************************************************************************/
95 /* A structure used during glyph loading to store its outline. */
98 /* memory :: The current memory object. */
100 /* face :: The current face object. */
102 /* size :: The current size object. */
104 /* glyph :: The current glyph slot. */
106 /* loader :: The current glyph loader. */
108 /* current :: The current glyph outline. */
110 /* base :: The base glyph outline. */
112 /* last :: The last point position. */
114 /* scale_x :: The horizontal scale (FUnits to sub-pixels). */
116 /* scale_y :: The vertical scale (FUnits to sub-pixels). */
118 /* pos_x :: The horizontal translation (for composite glyphs). */
120 /* pos_y :: The vertical translation (for composite glyphs). */
122 /* left_bearing :: The left side bearing point. */
124 /* advance :: The horizontal advance vector. */
128 /* bbox :: The glyph's bounding box. */
130 /* path_begun :: A flag which indicates that a new path has begun. */
132 /* load_points :: A flag which indicates, if not set, that no points */
135 /* pass :: The pass number for multi-pass hinters. */
137 /* hint_point :: The index of the next point to hint. */
139 /* funcs :: A table of builder functions used to perform the */
140 /* outline's path construction. */
148 FT_GlyphLoader
* loader
;
150 FT_Outline
* current
; /* the current glyph outline */
151 FT_Outline
* base
; /* the composite glyph outline */
161 FT_Vector left_bearing
;
165 FT_BBox bbox
; /* bounding box */
172 /* path construction function interface */
173 T1_Builder_Funcs funcs
;
177 typedef FT_Error (*T1_Hinter_ChangeHints
)( T1_Builder
* builder
);
179 typedef FT_Error (*T1_Hinter_DotSection
)( T1_Builder
* builder
);
181 typedef FT_Error (*T1_Hinter_Stem
)( T1_Builder
* builder
,
186 typedef FT_Error (*T1_Hinter_Stem3
)( T1_Builder
* builder
,
196 /*************************************************************************/
199 /* T1_Hinter_Funcs */
202 /* A structure to store the address of various functions used by a */
203 /* Type 1 hinter to perform outline hinting. */
205 typedef struct T1_Hinter_Func_
207 T1_Hinter_ChangeHints change_hints
;
208 T1_Hinter_DotSection dot_section
;
210 T1_Hinter_Stem3 stem3
;
215 typedef enum T1_Operator_
244 op_max
/* never remove this one */
249 /* execution context charstring zone */
250 typedef struct T1_Decoder_Zone_
259 typedef struct T1_Decoder_
262 T1_Hinter_Funcs hinter
;
264 FT_Int stack
[T1_MAX_CHARSTRINGS_OPERANDS
];
267 T1_Decoder_Zone zones
[T1_MAX_SUBRS_CALLS
+ 1];
268 T1_Decoder_Zone
* zone
;
271 FT_Int num_flex_vectors
;
272 FT_Vector flex_vectors
[7];
278 void T1_Init_Builder( T1_Builder
* builder
,
282 const T1_Builder_Funcs
* funcs
);
285 void T1_Done_Builder( T1_Builder
* builder
);
288 void T1_Init_Decoder( T1_Decoder
* decoder
,
289 const T1_Hinter_Funcs
* funcs
);
292 FT_Error
T1_Compute_Max_Advance( T1_Face face
,
293 FT_Int
* max_advance
);
296 FT_Error
T1_Parse_CharStrings( T1_Decoder
* decoder
,
297 FT_Byte
* charstring_base
,
298 FT_Int charstring_len
,
300 FT_Byte
** subrs_base
,
304 FT_Error
T1_Add_Points( T1_Builder
* builder
,
308 FT_Error
T1_Add_Contours( T1_Builder
* builder
,
309 FT_Int num_contours
);
312 FT_Error
T1_Load_Glyph( T1_GlyphSlot glyph
,
323 #endif /* T1GLOAD_H */