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