|
1 /***************************************************************************/ |
|
2 /* */ |
|
3 /* ftobjs.h */ |
|
4 /* */ |
|
5 /* The FreeType private base classes (specification). */ |
|
6 /* */ |
|
7 /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */ |
|
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
|
9 /* */ |
|
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, FTL.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. */ |
|
15 /* */ |
|
16 /***************************************************************************/ |
|
17 |
|
18 |
|
19 /*************************************************************************/ |
|
20 /* */ |
|
21 /* This file contains the definition of all internal FreeType classes. */ |
|
22 /* */ |
|
23 /*************************************************************************/ |
|
24 |
|
25 |
|
26 #ifndef __FTOBJS_H__ |
|
27 #define __FTOBJS_H__ |
|
28 |
|
29 #include <ft2build.h> |
|
30 #include FT_RENDER_H |
|
31 #include FT_SIZES_H |
|
32 #include FT_INTERNAL_MEMORY_H |
|
33 #include FT_INTERNAL_GLYPH_LOADER_H |
|
34 #include FT_INTERNAL_DRIVER_H |
|
35 #include FT_INTERNAL_AUTOHINT_H |
|
36 #include FT_INTERNAL_SERVICE_H |
|
37 |
|
38 #ifdef FT_CONFIG_OPTION_INCREMENTAL |
|
39 #include FT_INCREMENTAL_H |
|
40 #endif |
|
41 |
|
42 |
|
43 FT_BEGIN_HEADER |
|
44 |
|
45 |
|
46 /*************************************************************************/ |
|
47 /* */ |
|
48 /* Some generic definitions. */ |
|
49 /* */ |
|
50 #ifndef TRUE |
|
51 #define TRUE 1 |
|
52 #endif |
|
53 |
|
54 #ifndef FALSE |
|
55 #define FALSE 0 |
|
56 #endif |
|
57 |
|
58 #ifndef NULL |
|
59 #define NULL (void*)0 |
|
60 #endif |
|
61 |
|
62 |
|
63 /*************************************************************************/ |
|
64 /* */ |
|
65 /* The min and max functions missing in C. As usual, be careful not to */ |
|
66 /* write things like FT_MIN( a++, b++ ) to avoid side effects. */ |
|
67 /* */ |
|
68 #define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) ) |
|
69 #define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) ) |
|
70 |
|
71 #define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) ) |
|
72 |
|
73 |
|
74 #define FT_PAD_FLOOR( x, n ) ( (x) & ~((n)-1) ) |
|
75 #define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n ) |
|
76 #define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n ) |
|
77 |
|
78 #define FT_PIX_FLOOR( x ) ( (x) & ~63 ) |
|
79 #define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 ) |
|
80 #define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 ) |
|
81 |
|
82 |
|
83 /* |
|
84 * Return the highest power of 2 that is <= value; this correspond to |
|
85 * the highest bit in a given 32-bit value. |
|
86 */ |
|
87 FT_BASE( FT_UInt32 ) |
|
88 ft_highpow2( FT_UInt32 value ); |
|
89 |
|
90 |
|
91 /*************************************************************************/ |
|
92 /*************************************************************************/ |
|
93 /*************************************************************************/ |
|
94 /**** ****/ |
|
95 /**** ****/ |
|
96 /**** C H A R M A P S ****/ |
|
97 /**** ****/ |
|
98 /**** ****/ |
|
99 /*************************************************************************/ |
|
100 /*************************************************************************/ |
|
101 /*************************************************************************/ |
|
102 |
|
103 /* handle to internal charmap object */ |
|
104 typedef struct FT_CMapRec_* FT_CMap; |
|
105 |
|
106 /* handle to charmap class structure */ |
|
107 typedef const struct FT_CMap_ClassRec_* FT_CMap_Class; |
|
108 |
|
109 /* internal charmap object structure */ |
|
110 typedef struct FT_CMapRec_ |
|
111 { |
|
112 FT_CharMapRec charmap; |
|
113 FT_CMap_Class clazz; |
|
114 |
|
115 } FT_CMapRec; |
|
116 |
|
117 /* typecase any pointer to a charmap handle */ |
|
118 #define FT_CMAP( x ) ((FT_CMap)( x )) |
|
119 |
|
120 /* obvious macros */ |
|
121 #define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id |
|
122 #define FT_CMAP_ENCODING_ID( x ) FT_CMAP( x )->charmap.encoding_id |
|
123 #define FT_CMAP_ENCODING( x ) FT_CMAP( x )->charmap.encoding |
|
124 #define FT_CMAP_FACE( x ) FT_CMAP( x )->charmap.face |
|
125 |
|
126 |
|
127 /* class method definitions */ |
|
128 typedef FT_Error |
|
129 (*FT_CMap_InitFunc)( FT_CMap cmap, |
|
130 FT_Pointer init_data ); |
|
131 |
|
132 typedef void |
|
133 (*FT_CMap_DoneFunc)( FT_CMap cmap ); |
|
134 |
|
135 typedef FT_UInt |
|
136 (*FT_CMap_CharIndexFunc)( FT_CMap cmap, |
|
137 FT_UInt32 char_code ); |
|
138 |
|
139 typedef FT_UInt |
|
140 (*FT_CMap_CharNextFunc)( FT_CMap cmap, |
|
141 FT_UInt32 *achar_code ); |
|
142 |
|
143 |
|
144 typedef struct FT_CMap_ClassRec_ |
|
145 { |
|
146 FT_ULong size; |
|
147 FT_CMap_InitFunc init; |
|
148 FT_CMap_DoneFunc done; |
|
149 FT_CMap_CharIndexFunc char_index; |
|
150 FT_CMap_CharNextFunc char_next; |
|
151 |
|
152 } FT_CMap_ClassRec; |
|
153 |
|
154 |
|
155 /* create a new charmap and add it to charmap->face */ |
|
156 FT_BASE( FT_Error ) |
|
157 FT_CMap_New( FT_CMap_Class clazz, |
|
158 FT_Pointer init_data, |
|
159 FT_CharMap charmap, |
|
160 FT_CMap *acmap ); |
|
161 |
|
162 /* destroy a charmap and remove it from face's list */ |
|
163 FT_BASE( void ) |
|
164 FT_CMap_Done( FT_CMap cmap ); |
|
165 |
|
166 |
|
167 /*************************************************************************/ |
|
168 /* */ |
|
169 /* <Struct> */ |
|
170 /* FT_Face_InternalRec */ |
|
171 /* */ |
|
172 /* <Description> */ |
|
173 /* This structure contains the internal fields of each FT_Face */ |
|
174 /* object. These fields may change between different releases of */ |
|
175 /* FreeType. */ |
|
176 /* */ |
|
177 /* <Fields> */ |
|
178 /* max_points :: */ |
|
179 /* The maximal number of points used to store the vectorial outline */ |
|
180 /* of any glyph in this face. If this value cannot be known in */ |
|
181 /* advance, or if the face isn't scalable, this should be set to 0. */ |
|
182 /* Only relevant for scalable formats. */ |
|
183 /* */ |
|
184 /* max_contours :: */ |
|
185 /* The maximal number of contours used to store the vectorial */ |
|
186 /* outline of any glyph in this face. If this value cannot be */ |
|
187 /* known in advance, or if the face isn't scalable, this should be */ |
|
188 /* set to 0. Only relevant for scalable formats. */ |
|
189 /* */ |
|
190 /* transform_matrix :: */ |
|
191 /* A 2x2 matrix of 16.16 coefficients used to transform glyph */ |
|
192 /* outlines after they are loaded from the font. Only used by the */ |
|
193 /* convenience functions. */ |
|
194 /* */ |
|
195 /* transform_delta :: */ |
|
196 /* A translation vector used to transform glyph outlines after they */ |
|
197 /* are loaded from the font. Only used by the convenience */ |
|
198 /* functions. */ |
|
199 /* */ |
|
200 /* transform_flags :: */ |
|
201 /* Some flags used to classify the transform. Only used by the */ |
|
202 /* convenience functions. */ |
|
203 /* */ |
|
204 /* services :: */ |
|
205 /* A cache for frequently used services. It should be only */ |
|
206 /* accessed with the macro `FT_FACE_LOOKUP_SERVICE'. */ |
|
207 /* */ |
|
208 /* incremental_interface :: */ |
|
209 /* If non-null, the interface through which glyph data and metrics */ |
|
210 /* are loaded incrementally for faces that do not provide all of */ |
|
211 /* this data when first opened. This field exists only if */ |
|
212 /* @FT_CONFIG_OPTION_INCREMENTAL is defined. */ |
|
213 /* */ |
|
214 typedef struct FT_Face_InternalRec_ |
|
215 { |
|
216 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS |
|
217 FT_UShort reserved1; |
|
218 FT_Short reserved2; |
|
219 #endif |
|
220 FT_Matrix transform_matrix; |
|
221 FT_Vector transform_delta; |
|
222 FT_Int transform_flags; |
|
223 |
|
224 FT_ServiceCacheRec services; |
|
225 |
|
226 #ifdef FT_CONFIG_OPTION_INCREMENTAL |
|
227 FT_Incremental_InterfaceRec* incremental_interface; |
|
228 #endif |
|
229 |
|
230 } FT_Face_InternalRec; |
|
231 |
|
232 |
|
233 /*************************************************************************/ |
|
234 /* */ |
|
235 /* <Struct> */ |
|
236 /* FT_Slot_InternalRec */ |
|
237 /* */ |
|
238 /* <Description> */ |
|
239 /* This structure contains the internal fields of each FT_GlyphSlot */ |
|
240 /* object. These fields may change between different releases of */ |
|
241 /* FreeType. */ |
|
242 /* */ |
|
243 /* <Fields> */ |
|
244 /* loader :: The glyph loader object used to load outlines */ |
|
245 /* into the glyph slot. */ |
|
246 /* */ |
|
247 /* flags :: Possible values are zero or */ |
|
248 /* FT_GLYPH_OWN_BITMAP. The latter indicates */ |
|
249 /* that the FT_GlyphSlot structure owns the */ |
|
250 /* bitmap buffer. */ |
|
251 /* */ |
|
252 /* glyph_transformed :: Boolean. Set to TRUE when the loaded glyph */ |
|
253 /* must be transformed through a specific */ |
|
254 /* font transformation. This is _not_ the same */ |
|
255 /* as the face transform set through */ |
|
256 /* FT_Set_Transform(). */ |
|
257 /* */ |
|
258 /* glyph_matrix :: The 2x2 matrix corresponding to the glyph */ |
|
259 /* transformation, if necessary. */ |
|
260 /* */ |
|
261 /* glyph_delta :: The 2d translation vector corresponding to */ |
|
262 /* the glyph transformation, if necessary. */ |
|
263 /* */ |
|
264 /* glyph_hints :: Format-specific glyph hints management. */ |
|
265 /* */ |
|
266 |
|
267 #define FT_GLYPH_OWN_BITMAP 0x1 |
|
268 |
|
269 typedef struct FT_Slot_InternalRec_ |
|
270 { |
|
271 FT_GlyphLoader loader; |
|
272 FT_UInt flags; |
|
273 FT_Bool glyph_transformed; |
|
274 FT_Matrix glyph_matrix; |
|
275 FT_Vector glyph_delta; |
|
276 void* glyph_hints; |
|
277 |
|
278 } FT_GlyphSlot_InternalRec; |
|
279 |
|
280 |
|
281 /*************************************************************************/ |
|
282 /*************************************************************************/ |
|
283 /*************************************************************************/ |
|
284 /**** ****/ |
|
285 /**** ****/ |
|
286 /**** M O D U L E S ****/ |
|
287 /**** ****/ |
|
288 /**** ****/ |
|
289 /*************************************************************************/ |
|
290 /*************************************************************************/ |
|
291 /*************************************************************************/ |
|
292 |
|
293 |
|
294 /*************************************************************************/ |
|
295 /* */ |
|
296 /* <Struct> */ |
|
297 /* FT_ModuleRec */ |
|
298 /* */ |
|
299 /* <Description> */ |
|
300 /* A module object instance. */ |
|
301 /* */ |
|
302 /* <Fields> */ |
|
303 /* clazz :: A pointer to the module's class. */ |
|
304 /* */ |
|
305 /* library :: A handle to the parent library object. */ |
|
306 /* */ |
|
307 /* memory :: A handle to the memory manager. */ |
|
308 /* */ |
|
309 /* generic :: A generic structure for user-level extensibility (?). */ |
|
310 /* */ |
|
311 typedef struct FT_ModuleRec_ |
|
312 { |
|
313 FT_Module_Class* clazz; |
|
314 FT_Library library; |
|
315 FT_Memory memory; |
|
316 FT_Generic generic; |
|
317 |
|
318 } FT_ModuleRec; |
|
319 |
|
320 |
|
321 /* typecast an object to a FT_Module */ |
|
322 #define FT_MODULE( x ) ((FT_Module)( x )) |
|
323 #define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz |
|
324 #define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library |
|
325 #define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory |
|
326 |
|
327 |
|
328 #define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ |
|
329 FT_MODULE_FONT_DRIVER ) |
|
330 |
|
331 #define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ |
|
332 FT_MODULE_RENDERER ) |
|
333 |
|
334 #define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ |
|
335 FT_MODULE_HINTER ) |
|
336 |
|
337 #define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ |
|
338 FT_MODULE_STYLER ) |
|
339 |
|
340 #define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \ |
|
341 FT_MODULE_DRIVER_SCALABLE ) |
|
342 |
|
343 #define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \ |
|
344 FT_MODULE_DRIVER_NO_OUTLINES ) |
|
345 |
|
346 #define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ |
|
347 FT_MODULE_DRIVER_HAS_HINTER ) |
|
348 |
|
349 |
|
350 /*************************************************************************/ |
|
351 /* */ |
|
352 /* <Function> */ |
|
353 /* FT_Get_Module_Interface */ |
|
354 /* */ |
|
355 /* <Description> */ |
|
356 /* Finds a module and returns its specific interface as a typeless */ |
|
357 /* pointer. */ |
|
358 /* */ |
|
359 /* <Input> */ |
|
360 /* library :: A handle to the library object. */ |
|
361 /* */ |
|
362 /* module_name :: The module's name (as an ASCII string). */ |
|
363 /* */ |
|
364 /* <Return> */ |
|
365 /* A module-specific interface if available, 0 otherwise. */ |
|
366 /* */ |
|
367 /* <Note> */ |
|
368 /* You should better be familiar with FreeType internals to know */ |
|
369 /* which module to look for, and what its interface is :-) */ |
|
370 /* */ |
|
371 FT_BASE( const void* ) |
|
372 FT_Get_Module_Interface( FT_Library library, |
|
373 const char* mod_name ); |
|
374 |
|
375 FT_BASE( FT_Pointer ) |
|
376 ft_module_get_service( FT_Module module, |
|
377 const char* service_id ); |
|
378 |
|
379 /* */ |
|
380 |
|
381 |
|
382 /*************************************************************************/ |
|
383 /*************************************************************************/ |
|
384 /*************************************************************************/ |
|
385 /**** ****/ |
|
386 /**** ****/ |
|
387 /**** FACE, SIZE & GLYPH SLOT OBJECTS ****/ |
|
388 /**** ****/ |
|
389 /**** ****/ |
|
390 /*************************************************************************/ |
|
391 /*************************************************************************/ |
|
392 /*************************************************************************/ |
|
393 |
|
394 /* a few macros used to perform easy typecasts with minimal brain damage */ |
|
395 |
|
396 #define FT_FACE( x ) ((FT_Face)(x)) |
|
397 #define FT_SIZE( x ) ((FT_Size)(x)) |
|
398 #define FT_SLOT( x ) ((FT_GlyphSlot)(x)) |
|
399 |
|
400 #define FT_FACE_DRIVER( x ) FT_FACE( x )->driver |
|
401 #define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library |
|
402 #define FT_FACE_MEMORY( x ) FT_FACE( x )->memory |
|
403 #define FT_FACE_STREAM( x ) FT_FACE( x )->stream |
|
404 |
|
405 #define FT_SIZE_FACE( x ) FT_SIZE( x )->face |
|
406 #define FT_SLOT_FACE( x ) FT_SLOT( x )->face |
|
407 |
|
408 #define FT_FACE_SLOT( x ) FT_FACE( x )->glyph |
|
409 #define FT_FACE_SIZE( x ) FT_FACE( x )->size |
|
410 |
|
411 |
|
412 /*************************************************************************/ |
|
413 /* */ |
|
414 /* <Function> */ |
|
415 /* FT_New_GlyphSlot */ |
|
416 /* */ |
|
417 /* <Description> */ |
|
418 /* It is sometimes useful to have more than one glyph slot for a */ |
|
419 /* given face object. This function is used to create additional */ |
|
420 /* slots. All of them are automatically discarded when the face is */ |
|
421 /* destroyed. */ |
|
422 /* */ |
|
423 /* <Input> */ |
|
424 /* face :: A handle to a parent face object. */ |
|
425 /* */ |
|
426 /* <Output> */ |
|
427 /* aslot :: A handle to a new glyph slot object. */ |
|
428 /* */ |
|
429 /* <Return> */ |
|
430 /* FreeType error code. 0 means success. */ |
|
431 /* */ |
|
432 FT_BASE( FT_Error ) |
|
433 FT_New_GlyphSlot( FT_Face face, |
|
434 FT_GlyphSlot *aslot ); |
|
435 |
|
436 |
|
437 /*************************************************************************/ |
|
438 /* */ |
|
439 /* <Function> */ |
|
440 /* FT_Done_GlyphSlot */ |
|
441 /* */ |
|
442 /* <Description> */ |
|
443 /* Destroys a given glyph slot. Remember however that all slots are */ |
|
444 /* automatically destroyed with its parent. Using this function is */ |
|
445 /* not always mandatory. */ |
|
446 /* */ |
|
447 /* <Input> */ |
|
448 /* slot :: A handle to a target glyph slot. */ |
|
449 /* */ |
|
450 FT_BASE( void ) |
|
451 FT_Done_GlyphSlot( FT_GlyphSlot slot ); |
|
452 |
|
453 /* */ |
|
454 |
|
455 #define FT_REQUEST_WIDTH( req ) \ |
|
456 ( (req)->horiResolution \ |
|
457 ? (FT_Pos)( (req)->width * (req)->horiResolution + 36 ) / 72 \ |
|
458 : (req)->width ) |
|
459 |
|
460 #define FT_REQUEST_HEIGHT( req ) \ |
|
461 ( (req)->vertResolution \ |
|
462 ? (FT_Pos)( (req)->height * (req)->vertResolution + 36 ) / 72 \ |
|
463 : (req)->height ) |
|
464 |
|
465 |
|
466 /* Set the metrics according to a bitmap strike. */ |
|
467 FT_BASE( void ) |
|
468 FT_Select_Metrics( FT_Face face, |
|
469 FT_ULong strike_index ); |
|
470 |
|
471 |
|
472 /* Set the metrics according to a size request. */ |
|
473 FT_BASE( void ) |
|
474 FT_Request_Metrics( FT_Face face, |
|
475 FT_Size_Request req ); |
|
476 |
|
477 |
|
478 /* Match a size request against `available_sizes'. */ |
|
479 FT_BASE( FT_Error ) |
|
480 FT_Match_Size( FT_Face face, |
|
481 FT_Size_Request req, |
|
482 FT_Bool ignore_width, |
|
483 FT_ULong* size_index ); |
|
484 |
|
485 |
|
486 /* Use the horizontal metrics to synthesize the vertical metrics. */ |
|
487 /* If `advance' is zero, it is also synthesized. */ |
|
488 FT_BASE( void ) |
|
489 ft_synthesize_vertical_metrics( FT_Glyph_Metrics* metrics, |
|
490 FT_Pos advance ); |
|
491 |
|
492 |
|
493 /* Free the bitmap of a given glyphslot when needed (i.e., only when it */ |
|
494 /* was allocated with ft_glyphslot_alloc_bitmap). */ |
|
495 FT_BASE( void ) |
|
496 ft_glyphslot_free_bitmap( FT_GlyphSlot slot ); |
|
497 |
|
498 |
|
499 /* Allocate a new bitmap buffer in a glyph slot. */ |
|
500 FT_BASE( FT_Error ) |
|
501 ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot, |
|
502 FT_ULong size ); |
|
503 |
|
504 |
|
505 /* Set the bitmap buffer in a glyph slot to a given pointer. The buffer */ |
|
506 /* will not be freed by a later call to ft_glyphslot_free_bitmap. */ |
|
507 FT_BASE( void ) |
|
508 ft_glyphslot_set_bitmap( FT_GlyphSlot slot, |
|
509 FT_Byte* buffer ); |
|
510 |
|
511 |
|
512 /*************************************************************************/ |
|
513 /*************************************************************************/ |
|
514 /*************************************************************************/ |
|
515 /**** ****/ |
|
516 /**** ****/ |
|
517 /**** R E N D E R E R S ****/ |
|
518 /**** ****/ |
|
519 /**** ****/ |
|
520 /*************************************************************************/ |
|
521 /*************************************************************************/ |
|
522 /*************************************************************************/ |
|
523 |
|
524 |
|
525 #define FT_RENDERER( x ) ((FT_Renderer)( x )) |
|
526 #define FT_GLYPH( x ) ((FT_Glyph)( x )) |
|
527 #define FT_BITMAP_GLYPH( x ) ((FT_BitmapGlyph)( x )) |
|
528 #define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x )) |
|
529 |
|
530 |
|
531 typedef struct FT_RendererRec_ |
|
532 { |
|
533 FT_ModuleRec root; |
|
534 FT_Renderer_Class* clazz; |
|
535 FT_Glyph_Format glyph_format; |
|
536 FT_Glyph_Class glyph_class; |
|
537 |
|
538 FT_Raster raster; |
|
539 FT_Raster_Render_Func raster_render; |
|
540 FT_Renderer_RenderFunc render; |
|
541 |
|
542 } FT_RendererRec; |
|
543 |
|
544 |
|
545 /*************************************************************************/ |
|
546 /*************************************************************************/ |
|
547 /*************************************************************************/ |
|
548 /**** ****/ |
|
549 /**** ****/ |
|
550 /**** F O N T D R I V E R S ****/ |
|
551 /**** ****/ |
|
552 /**** ****/ |
|
553 /*************************************************************************/ |
|
554 /*************************************************************************/ |
|
555 /*************************************************************************/ |
|
556 |
|
557 |
|
558 /* typecast a module into a driver easily */ |
|
559 #define FT_DRIVER( x ) ((FT_Driver)(x)) |
|
560 |
|
561 /* typecast a module as a driver, and get its driver class */ |
|
562 #define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz |
|
563 |
|
564 |
|
565 /*************************************************************************/ |
|
566 /* */ |
|
567 /* <Struct> */ |
|
568 /* FT_DriverRec */ |
|
569 /* */ |
|
570 /* <Description> */ |
|
571 /* The root font driver class. A font driver is responsible for */ |
|
572 /* managing and loading font files of a given format. */ |
|
573 /* */ |
|
574 /* <Fields> */ |
|
575 /* root :: Contains the fields of the root module class. */ |
|
576 /* */ |
|
577 /* clazz :: A pointer to the font driver's class. Note that */ |
|
578 /* this is NOT root.clazz. `class' wasn't used */ |
|
579 /* as it is a reserved word in C++. */ |
|
580 /* */ |
|
581 /* faces_list :: The list of faces currently opened by this */ |
|
582 /* driver. */ |
|
583 /* */ |
|
584 /* extensions :: A typeless pointer to the driver's extensions */ |
|
585 /* registry, if they are supported through the */ |
|
586 /* configuration macro FT_CONFIG_OPTION_EXTENSIONS. */ |
|
587 /* */ |
|
588 /* glyph_loader :: The glyph loader for all faces managed by this */ |
|
589 /* driver. This object isn't defined for unscalable */ |
|
590 /* formats. */ |
|
591 /* */ |
|
592 typedef struct FT_DriverRec_ |
|
593 { |
|
594 FT_ModuleRec root; |
|
595 FT_Driver_Class clazz; |
|
596 |
|
597 FT_ListRec faces_list; |
|
598 void* extensions; |
|
599 |
|
600 FT_GlyphLoader glyph_loader; |
|
601 |
|
602 } FT_DriverRec; |
|
603 |
|
604 |
|
605 /*************************************************************************/ |
|
606 /*************************************************************************/ |
|
607 /*************************************************************************/ |
|
608 /**** ****/ |
|
609 /**** ****/ |
|
610 /**** L I B R A R I E S ****/ |
|
611 /**** ****/ |
|
612 /**** ****/ |
|
613 /*************************************************************************/ |
|
614 /*************************************************************************/ |
|
615 /*************************************************************************/ |
|
616 |
|
617 |
|
618 /* This hook is used by the TrueType debugger. It must be set to an */ |
|
619 /* alternate truetype bytecode interpreter function. */ |
|
620 #define FT_DEBUG_HOOK_TRUETYPE 0 |
|
621 |
|
622 |
|
623 /* Set this debug hook to a non-null pointer to force unpatented hinting */ |
|
624 /* for all faces when both TT_CONFIG_OPTION_BYTECODE_INTERPRETER and */ |
|
625 /* TT_CONFIG_OPTION_UNPATENTED_HINTING are defined. this is only used */ |
|
626 /* during debugging. */ |
|
627 #define FT_DEBUG_HOOK_UNPATENTED_HINTING 1 |
|
628 |
|
629 |
|
630 /*************************************************************************/ |
|
631 /* */ |
|
632 /* <Struct> */ |
|
633 /* FT_LibraryRec */ |
|
634 /* */ |
|
635 /* <Description> */ |
|
636 /* The FreeType library class. This is the root of all FreeType */ |
|
637 /* data. Use FT_New_Library() to create a library object, and */ |
|
638 /* FT_Done_Library() to discard it and all child objects. */ |
|
639 /* */ |
|
640 /* <Fields> */ |
|
641 /* memory :: The library's memory object. Manages memory */ |
|
642 /* allocation. */ |
|
643 /* */ |
|
644 /* generic :: Client data variable. Used to extend the */ |
|
645 /* Library class by higher levels and clients. */ |
|
646 /* */ |
|
647 /* version_major :: The major version number of the library. */ |
|
648 /* */ |
|
649 /* version_minor :: The minor version number of the library. */ |
|
650 /* */ |
|
651 /* version_patch :: The current patch level of the library. */ |
|
652 /* */ |
|
653 /* num_modules :: The number of modules currently registered */ |
|
654 /* within this library. This is set to 0 for new */ |
|
655 /* libraries. New modules are added through the */ |
|
656 /* FT_Add_Module() API function. */ |
|
657 /* */ |
|
658 /* modules :: A table used to store handles to the currently */ |
|
659 /* registered modules. Note that each font driver */ |
|
660 /* contains a list of its opened faces. */ |
|
661 /* */ |
|
662 /* renderers :: The list of renderers currently registered */ |
|
663 /* within the library. */ |
|
664 /* */ |
|
665 /* cur_renderer :: The current outline renderer. This is a */ |
|
666 /* shortcut used to avoid parsing the list on */ |
|
667 /* each call to FT_Outline_Render(). It is a */ |
|
668 /* handle to the current renderer for the */ |
|
669 /* FT_GLYPH_FORMAT_OUTLINE format. */ |
|
670 /* */ |
|
671 /* auto_hinter :: XXX */ |
|
672 /* */ |
|
673 /* raster_pool :: The raster object's render pool. This can */ |
|
674 /* ideally be changed dynamically at run-time. */ |
|
675 /* */ |
|
676 /* raster_pool_size :: The size of the render pool in bytes. */ |
|
677 /* */ |
|
678 /* debug_hooks :: XXX */ |
|
679 /* */ |
|
680 typedef struct FT_LibraryRec_ |
|
681 { |
|
682 FT_Memory memory; /* library's memory manager */ |
|
683 |
|
684 FT_Generic generic; |
|
685 |
|
686 FT_Int version_major; |
|
687 FT_Int version_minor; |
|
688 FT_Int version_patch; |
|
689 |
|
690 FT_UInt num_modules; |
|
691 FT_Module modules[FT_MAX_MODULES]; /* module objects */ |
|
692 |
|
693 FT_ListRec renderers; /* list of renderers */ |
|
694 FT_Renderer cur_renderer; /* current outline renderer */ |
|
695 FT_Module auto_hinter; |
|
696 |
|
697 FT_Byte* raster_pool; /* scan-line conversion */ |
|
698 /* render pool */ |
|
699 FT_ULong raster_pool_size; /* size of render pool in bytes */ |
|
700 |
|
701 FT_DebugHook_Func debug_hooks[4]; |
|
702 |
|
703 } FT_LibraryRec; |
|
704 |
|
705 |
|
706 FT_BASE( FT_Renderer ) |
|
707 FT_Lookup_Renderer( FT_Library library, |
|
708 FT_Glyph_Format format, |
|
709 FT_ListNode* node ); |
|
710 |
|
711 FT_BASE( FT_Error ) |
|
712 FT_Render_Glyph_Internal( FT_Library library, |
|
713 FT_GlyphSlot slot, |
|
714 FT_Render_Mode render_mode ); |
|
715 |
|
716 typedef const char* |
|
717 (*FT_Face_GetPostscriptNameFunc)( FT_Face face ); |
|
718 |
|
719 typedef FT_Error |
|
720 (*FT_Face_GetGlyphNameFunc)( FT_Face face, |
|
721 FT_UInt glyph_index, |
|
722 FT_Pointer buffer, |
|
723 FT_UInt buffer_max ); |
|
724 |
|
725 typedef FT_UInt |
|
726 (*FT_Face_GetGlyphNameIndexFunc)( FT_Face face, |
|
727 FT_String* glyph_name ); |
|
728 |
|
729 |
|
730 #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM |
|
731 |
|
732 /*************************************************************************/ |
|
733 /* */ |
|
734 /* <Function> */ |
|
735 /* FT_New_Memory */ |
|
736 /* */ |
|
737 /* <Description> */ |
|
738 /* Creates a new memory object. */ |
|
739 /* */ |
|
740 /* <Return> */ |
|
741 /* A pointer to the new memory object. 0 in case of error. */ |
|
742 /* */ |
|
743 FT_BASE( FT_Memory ) |
|
744 FT_New_Memory( void ); |
|
745 |
|
746 |
|
747 /*************************************************************************/ |
|
748 /* */ |
|
749 /* <Function> */ |
|
750 /* FT_Done_Memory */ |
|
751 /* */ |
|
752 /* <Description> */ |
|
753 /* Discards memory manager. */ |
|
754 /* */ |
|
755 /* <Input> */ |
|
756 /* memory :: A handle to the memory manager. */ |
|
757 /* */ |
|
758 FT_BASE( void ) |
|
759 FT_Done_Memory( FT_Memory memory ); |
|
760 |
|
761 #endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */ |
|
762 |
|
763 |
|
764 /* Define default raster's interface. The default raster is located in */ |
|
765 /* `src/base/ftraster.c'. */ |
|
766 /* */ |
|
767 /* Client applications can register new rasters through the */ |
|
768 /* FT_Set_Raster() API. */ |
|
769 |
|
770 #ifndef FT_NO_DEFAULT_RASTER |
|
771 FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster; |
|
772 #endif |
|
773 |
|
774 |
|
775 FT_END_HEADER |
|
776 |
|
777 #endif /* __FTOBJS_H__ */ |
|
778 |
|
779 |
|
780 /* END */ |