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