w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

ftobjs.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * ftobjs.h
4  *
5  * The FreeType private base classes (specification).
6  *
7  * Copyright (C) 1996-2020 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 <freetype/ftrender.h>
30 #include <freetype/ftsizes.h>
31 #include <freetype/ftlcdfil.h>
32 #include <freetype/internal/ftmemory.h>
33 #include <freetype/internal/ftgloadr.h>
34 #include <freetype/internal/ftdrv.h>
35 #include <freetype/internal/autohint.h>
36 #include <freetype/internal/ftserv.h>
37 #include <freetype/internal/ftcalc.h>
38 
39 #ifdef FT_CONFIG_OPTION_INCREMENTAL
40 #include <freetype/ftincrem.h>
41 #endif
42 
43 #include "compiler-macros.h"
44 
46 
47 
48  /**************************************************************************
49  *
50  * Some generic definitions.
51  */
52 #ifndef TRUE
53 #define TRUE 1
54 #endif
55 
56 #ifndef FALSE
57 #define FALSE 0
58 #endif
59 
60 #ifndef NULL
61 #define NULL (void*)0
62 #endif
63 
64 
65  /**************************************************************************
66  *
67  * The min and max functions missing in C. As usual, be careful not to
68  * write things like FT_MIN( a++, b++ ) to avoid side effects.
69  */
70 #define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) )
71 #define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )
72 
73 #define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) )
74 
75  /*
76  * Approximate sqrt(x*x+y*y) using the `alpha max plus beta min' algorithm.
77  * We use alpha = 1, beta = 3/8, giving us results with a largest error
78  * less than 7% compared to the exact value.
79  */
80 #define FT_HYPOT( x, y ) \
81  ( x = FT_ABS( x ), \
82  y = FT_ABS( y ), \
83  x > y ? x + ( 3 * y >> 3 ) \
84  : y + ( 3 * x >> 3 ) )
85 
86  /* we use FT_TYPEOF to suppress signedness compilation warnings */
87 #define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n) - 1 ) )
88 #define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n) / 2, n )
89 #define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n) - 1, n )
90 
91 #define FT_PIX_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 )
92 #define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 )
93 #define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 )
94 
95  /* specialized versions (for signed values) */
96  /* that don't produce run-time errors due to integer overflow */
97 #define FT_PAD_ROUND_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) / 2 ), \
98  n )
99 #define FT_PAD_CEIL_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) - 1 ), \
100  n )
101 #define FT_PIX_ROUND_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 32 ) )
102 #define FT_PIX_CEIL_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 63 ) )
103 
104 #define FT_PAD_ROUND_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) / 2 ), \
105  n )
106 #define FT_PAD_CEIL_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) - 1 ), \
107  n )
108 #define FT_PIX_ROUND_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 32 ) )
109 #define FT_PIX_CEIL_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 63 ) )
110 
111 
112  /*
113  * character classification functions -- since these are used to parse font
114  * files, we must not use those in <ctypes.h> which are locale-dependent
115  */
116 #define ft_isdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U )
117 
118 #define ft_isxdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U || \
119  ( (unsigned)(x) - 'a' ) < 6U || \
120  ( (unsigned)(x) - 'A' ) < 6U )
121 
122  /* the next two macros assume ASCII representation */
123 #define ft_isupper( x ) ( ( (unsigned)(x) - 'A' ) < 26U )
124 #define ft_islower( x ) ( ( (unsigned)(x) - 'a' ) < 26U )
125 
126 #define ft_isalpha( x ) ( ft_isupper( x ) || ft_islower( x ) )
127 #define ft_isalnum( x ) ( ft_isdigit( x ) || ft_isalpha( x ) )
128 
129 
130  /*************************************************************************/
131  /*************************************************************************/
132  /*************************************************************************/
133  /**** ****/
134  /**** ****/
135  /**** C H A R M A P S ****/
136  /**** ****/
137  /**** ****/
138  /*************************************************************************/
139  /*************************************************************************/
140  /*************************************************************************/
141 
142  /* handle to internal charmap object */
143  typedef struct FT_CMapRec_* FT_CMap;
144 
145  /* handle to charmap class structure */
146  typedef const struct FT_CMap_ClassRec_* FT_CMap_Class;
147 
148  /* internal charmap object structure */
149  typedef struct FT_CMapRec_
150  {
153 
155 
156  /* typecast any pointer to a charmap handle */
157 #define FT_CMAP( x ) ( (FT_CMap)( x ) )
158 
159  /* obvious macros */
160 #define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id
161 #define FT_CMAP_ENCODING_ID( x ) FT_CMAP( x )->charmap.encoding_id
162 #define FT_CMAP_ENCODING( x ) FT_CMAP( x )->charmap.encoding
163 #define FT_CMAP_FACE( x ) FT_CMAP( x )->charmap.face
164 
165 
166  /* class method definitions */
167  typedef FT_Error
169  FT_Pointer init_data );
170 
171  typedef void
173 
174  typedef FT_UInt
176  FT_UInt32 char_code );
177 
178  typedef FT_UInt
180  FT_UInt32 *achar_code );
181 
182  typedef FT_UInt
184  FT_CMap unicode_cmap,
185  FT_UInt32 char_code,
186  FT_UInt32 variant_selector );
187 
188  typedef FT_Int
190  FT_UInt32 char_code,
191  FT_UInt32 variant_selector );
192 
193  typedef FT_UInt32 *
194  (*FT_CMap_VariantListFunc)( FT_CMap cmap,
195  FT_Memory mem );
196 
197  typedef FT_UInt32 *
198  (*FT_CMap_CharVariantListFunc)( FT_CMap cmap,
199  FT_Memory mem,
200  FT_UInt32 char_code );
201 
202  typedef FT_UInt32 *
203  (*FT_CMap_VariantCharListFunc)( FT_CMap cmap,
204  FT_Memory mem,
205  FT_UInt32 variant_selector );
206 
207 
208  typedef struct FT_CMap_ClassRec_
209  {
211 
216 
217  /* Subsequent entries are special ones for format 14 -- the variant */
218  /* selector subtable which behaves like no other */
219 
225 
227 
228 
229 #define FT_DECLARE_CMAP_CLASS( class_ ) \
230  FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
231 
232 #define FT_DEFINE_CMAP_CLASS( \
233  class_, \
234  size_, \
235  init_, \
236  done_, \
237  char_index_, \
238  char_next_, \
239  char_var_index_, \
240  char_var_default_, \
241  variant_list_, \
242  charvariant_list_, \
243  variantchar_list_ ) \
244  FT_CALLBACK_TABLE_DEF \
245  const FT_CMap_ClassRec class_ = \
246  { \
247  size_, \
248  init_, \
249  done_, \
250  char_index_, \
251  char_next_, \
252  char_var_index_, \
253  char_var_default_, \
254  variant_list_, \
255  charvariant_list_, \
256  variantchar_list_ \
257  };
258 
259 
260  /* create a new charmap and add it to charmap->face */
261  FT_BASE( FT_Error )
262  FT_CMap_New( FT_CMap_Class clazz,
263  FT_Pointer init_data,
265  FT_CMap *acmap );
266 
267  /* destroy a charmap and remove it from face's list */
268  FT_BASE( void )
270 
271 
272  /* add LCD padding to CBox */
273  FT_BASE( void )
274  ft_lcd_padding( FT_BBox* cbox,
277 
278 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
279 
280  typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap,
281  FT_Byte* weights );
282 
283 
284  /* This is the default LCD filter, an in-place, 5-tap FIR filter. */
285  FT_BASE( void )
286  ft_lcd_filter_fir( FT_Bitmap* bitmap,
287  FT_LcdFiveTapFilter weights );
288 
289 #endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
290 
291  /**************************************************************************
292  *
293  * @struct:
294  * FT_Face_InternalRec
295  *
296  * @description:
297  * This structure contains the internal fields of each FT_Face object.
298  * These fields may change between different releases of FreeType.
299  *
300  * @fields:
301  * max_points ::
302  * The maximum number of points used to store the vectorial outline of
303  * any glyph in this face. If this value cannot be known in advance,
304  * or if the face isn't scalable, this should be set to 0. Only
305  * relevant for scalable formats.
306  *
307  * max_contours ::
308  * The maximum number of contours used to store the vectorial outline
309  * of any glyph in this face. If this value cannot be known in
310  * advance, or if the face isn't scalable, this should be set to 0.
311  * Only relevant for scalable formats.
312  *
313  * transform_matrix ::
314  * A 2x2 matrix of 16.16 coefficients used to transform glyph outlines
315  * after they are loaded from the font. Only used by the convenience
316  * functions.
317  *
318  * transform_delta ::
319  * A translation vector used to transform glyph outlines after they are
320  * loaded from the font. Only used by the convenience functions.
321  *
322  * transform_flags ::
323  * Some flags used to classify the transform. Only used by the
324  * convenience functions.
325  *
326  * services ::
327  * A cache for frequently used services. It should be only accessed
328  * with the macro `FT_FACE_LOOKUP_SERVICE`.
329  *
330  * incremental_interface ::
331  * If non-null, the interface through which glyph data and metrics are
332  * loaded incrementally for faces that do not provide all of this data
333  * when first opened. This field exists only if
334  * @FT_CONFIG_OPTION_INCREMENTAL is defined.
335  *
336  * no_stem_darkening ::
337  * Overrides the module-level default, see @stem-darkening[cff], for
338  * example. FALSE and TRUE toggle stem darkening on and off,
339  * respectively, value~-1 means to use the module/driver default.
340  *
341  * random_seed ::
342  * If positive, override the seed value for the CFF 'random' operator.
343  * Value~0 means to use the font's value. Value~-1 means to use the
344  * CFF driver's default.
345  *
346  * lcd_weights ::
347  * lcd_filter_func ::
348  * These fields specify the LCD filtering weights and callback function
349  * for ClearType-style subpixel rendering.
350  *
351  * refcount ::
352  * A counter initialized to~1 at the time an @FT_Face structure is
353  * created. @FT_Reference_Face increments this counter, and
354  * @FT_Done_Face only destroys a face if the counter is~1, otherwise it
355  * simply decrements it.
356  */
357  typedef struct FT_Face_InternalRec_
358  {
362 
364 
365 #ifdef FT_CONFIG_OPTION_INCREMENTAL
366  FT_Incremental_InterfaceRec* incremental_interface;
367 #endif
368 
370  FT_Int32 random_seed;
371 
372 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
373  FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */
374  FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
375 #endif
376 
378 
380 
381 
382  /**************************************************************************
383  *
384  * @struct:
385  * FT_Slot_InternalRec
386  *
387  * @description:
388  * This structure contains the internal fields of each FT_GlyphSlot
389  * object. These fields may change between different releases of
390  * FreeType.
391  *
392  * @fields:
393  * loader ::
394  * The glyph loader object used to load outlines into the glyph slot.
395  *
396  * flags ::
397  * Possible values are zero or FT_GLYPH_OWN_BITMAP. The latter
398  * indicates that the FT_GlyphSlot structure owns the bitmap buffer.
399  *
400  * glyph_transformed ::
401  * Boolean. Set to TRUE when the loaded glyph must be transformed
402  * through a specific font transformation. This is _not_ the same as
403  * the face transform set through FT_Set_Transform().
404  *
405  * glyph_matrix ::
406  * The 2x2 matrix corresponding to the glyph transformation, if
407  * necessary.
408  *
409  * glyph_delta ::
410  * The 2d translation vector corresponding to the glyph transformation,
411  * if necessary.
412  *
413  * glyph_hints ::
414  * Format-specific glyph hints management.
415  *
416  * load_flags ::
417  * The load flags passed as an argument to @FT_Load_Glyph while
418  * initializing the glyph slot.
419  */
420 
421 #define FT_GLYPH_OWN_BITMAP 0x1U
422 
423  typedef struct FT_Slot_InternalRec_
424  {
430  void* glyph_hints;
431 
432  FT_Int32 load_flags;
433 
435 
436 
437  /**************************************************************************
438  *
439  * @struct:
440  * FT_Size_InternalRec
441  *
442  * @description:
443  * This structure contains the internal fields of each FT_Size object.
444  *
445  * @fields:
446  * module_data ::
447  * Data specific to a driver module.
448  *
449  * autohint_mode ::
450  * The used auto-hinting mode.
451  *
452  * autohint_metrics ::
453  * Metrics used by the auto-hinter.
454  *
455  */
456 
457  typedef struct FT_Size_InternalRec_
458  {
459  void* module_data;
460 
463 
465 
466 
467  /*************************************************************************/
468  /*************************************************************************/
469  /*************************************************************************/
470  /**** ****/
471  /**** ****/
472  /**** M O D U L E S ****/
473  /**** ****/
474  /**** ****/
475  /*************************************************************************/
476  /*************************************************************************/
477  /*************************************************************************/
478 
479 
480  /**************************************************************************
481  *
482  * @struct:
483  * FT_ModuleRec
484  *
485  * @description:
486  * A module object instance.
487  *
488  * @fields:
489  * clazz ::
490  * A pointer to the module's class.
491  *
492  * library ::
493  * A handle to the parent library object.
494  *
495  * memory ::
496  * A handle to the memory manager.
497  */
498  typedef struct FT_ModuleRec_
499  {
503 
505 
506 
507  /* typecast an object to an FT_Module */
508 #define FT_MODULE( x ) ( (FT_Module)(x) )
509 
510 #define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz
511 #define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library
512 #define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory
513 
514 
515 #define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
516  FT_MODULE_FONT_DRIVER )
517 
518 #define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
519  FT_MODULE_RENDERER )
520 
521 #define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
522  FT_MODULE_HINTER )
523 
524 #define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
525  FT_MODULE_STYLER )
526 
527 #define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \
528  FT_MODULE_DRIVER_SCALABLE )
529 
530 #define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \
531  FT_MODULE_DRIVER_NO_OUTLINES )
532 
533 #define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
534  FT_MODULE_DRIVER_HAS_HINTER )
535 
536 #define FT_DRIVER_HINTS_LIGHTLY( x ) ( FT_MODULE_CLASS( x )->module_flags & \
537  FT_MODULE_DRIVER_HINTS_LIGHTLY )
538 
539 
540  /**************************************************************************
541  *
542  * @function:
543  * FT_Get_Module_Interface
544  *
545  * @description:
546  * Finds a module and returns its specific interface as a typeless
547  * pointer.
548  *
549  * @input:
550  * library ::
551  * A handle to the library object.
552  *
553  * module_name ::
554  * The module's name (as an ASCII string).
555  *
556  * @return:
557  * A module-specific interface if available, 0 otherwise.
558  *
559  * @note:
560  * You should better be familiar with FreeType internals to know which
561  * module to look for, and what its interface is :-)
562  */
563  FT_BASE( const void* )
565  const char* mod_name );
566 
569  const char* service_id,
570  FT_Bool global );
571 
572 #ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
573  FT_BASE( FT_Error )
574  ft_property_string_set( FT_Library library,
575  const FT_String* module_name,
576  const FT_String* property_name,
577  FT_String* value );
578 #endif
579 
580  /* */
581 
582 
583  /*************************************************************************/
584  /*************************************************************************/
585  /*************************************************************************/
586  /**** ****/
587  /**** ****/
588  /**** F A C E, S I Z E & G L Y P H S L O T O B J E C T S ****/
589  /**** ****/
590  /**** ****/
591  /*************************************************************************/
592  /*************************************************************************/
593  /*************************************************************************/
594 
595  /* a few macros used to perform easy typecasts with minimal brain damage */
596 
597 #define FT_FACE( x ) ( (FT_Face)(x) )
598 #define FT_SIZE( x ) ( (FT_Size)(x) )
599 #define FT_SLOT( x ) ( (FT_GlyphSlot)(x) )
600 
601 #define FT_FACE_DRIVER( x ) FT_FACE( x )->driver
602 #define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library
603 #define FT_FACE_MEMORY( x ) FT_FACE( x )->memory
604 #define FT_FACE_STREAM( x ) FT_FACE( x )->stream
605 
606 #define FT_SIZE_FACE( x ) FT_SIZE( x )->face
607 #define FT_SLOT_FACE( x ) FT_SLOT( x )->face
608 
609 #define FT_FACE_SLOT( x ) FT_FACE( x )->glyph
610 #define FT_FACE_SIZE( x ) FT_FACE( x )->size
611 
612 
613  /**************************************************************************
614  *
615  * @function:
616  * FT_New_GlyphSlot
617  *
618  * @description:
619  * It is sometimes useful to have more than one glyph slot for a given
620  * face object. This function is used to create additional slots. All
621  * of them are automatically discarded when the face is destroyed.
622  *
623  * @input:
624  * face ::
625  * A handle to a parent face object.
626  *
627  * @output:
628  * aslot ::
629  * A handle to a new glyph slot object.
630  *
631  * @return:
632  * FreeType error code. 0 means success.
633  */
634  FT_BASE( FT_Error )
636  FT_GlyphSlot *aslot );
637 
638 
639  /**************************************************************************
640  *
641  * @function:
642  * FT_Done_GlyphSlot
643  *
644  * @description:
645  * Destroys a given glyph slot. Remember however that all slots are
646  * automatically destroyed with its parent. Using this function is not
647  * always mandatory.
648  *
649  * @input:
650  * slot ::
651  * A handle to a target glyph slot.
652  */
653  FT_BASE( void )
655 
656  /* */
657 
658 #define FT_REQUEST_WIDTH( req ) \
659  ( (req)->horiResolution \
660  ? ( (req)->width * (FT_Pos)(req)->horiResolution + 36 ) / 72 \
661  : (req)->width )
662 
663 #define FT_REQUEST_HEIGHT( req ) \
664  ( (req)->vertResolution \
665  ? ( (req)->height * (FT_Pos)(req)->vertResolution + 36 ) / 72 \
666  : (req)->height )
667 
668 
669  /* Set the metrics according to a bitmap strike. */
670  FT_BASE( void )
672  FT_ULong strike_index );
673 
674 
675  /* Set the metrics according to a size request. */
676  FT_BASE( void )
678  FT_Size_Request req );
679 
680 
681  /* Match a size request against `available_sizes'. */
682  FT_BASE( FT_Error )
684  FT_Size_Request req,
685  FT_Bool ignore_width,
686  FT_ULong* size_index );
687 
688 
689  /* Use the horizontal metrics to synthesize the vertical metrics. */
690  /* If `advance' is zero, it is also synthesized. */
691  FT_BASE( void )
693  FT_Pos advance );
694 
695 
696  /* Free the bitmap of a given glyphslot when needed (i.e., only when it */
697  /* was allocated with ft_glyphslot_alloc_bitmap). */
698  FT_BASE( void )
700 
701 
702  /* Preset bitmap metrics of an outline glyphslot prior to rendering */
703  /* and check whether the truncated bbox is too large for rendering. */
704  FT_BASE( FT_Bool )
707  const FT_Vector* origin );
708 
709  /* Allocate a new bitmap buffer in a glyph slot. */
710  FT_BASE( FT_Error )
712  FT_ULong size );
713 
714 
715  /* Set the bitmap buffer in a glyph slot to a given pointer. The buffer */
716  /* will not be freed by a later call to ft_glyphslot_free_bitmap. */
717  FT_BASE( void )
719  FT_Byte* buffer );
720 
721 
722  /*************************************************************************/
723  /*************************************************************************/
724  /*************************************************************************/
725  /**** ****/
726  /**** ****/
727  /**** R E N D E R E R S ****/
728  /**** ****/
729  /**** ****/
730  /*************************************************************************/
731  /*************************************************************************/
732  /*************************************************************************/
733 
734 
735 #define FT_RENDERER( x ) ( (FT_Renderer)(x) )
736 #define FT_GLYPH( x ) ( (FT_Glyph)(x) )
737 #define FT_BITMAP_GLYPH( x ) ( (FT_BitmapGlyph)(x) )
738 #define FT_OUTLINE_GLYPH( x ) ( (FT_OutlineGlyph)(x) )
739 
740 
741  typedef struct FT_RendererRec_
742  {
747 
751 
753 
754 
755  /*************************************************************************/
756  /*************************************************************************/
757  /*************************************************************************/
758  /**** ****/
759  /**** ****/
760  /**** F O N T D R I V E R S ****/
761  /**** ****/
762  /**** ****/
763  /*************************************************************************/
764  /*************************************************************************/
765  /*************************************************************************/
766 
767 
768  /* typecast a module into a driver easily */
769 #define FT_DRIVER( x ) ( (FT_Driver)(x) )
770 
771  /* typecast a module as a driver, and get its driver class */
772 #define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz
773 
774 
775  /**************************************************************************
776  *
777  * @struct:
778  * FT_DriverRec
779  *
780  * @description:
781  * The root font driver class. A font driver is responsible for managing
782  * and loading font files of a given format.
783  *
784  * @fields:
785  * root ::
786  * Contains the fields of the root module class.
787  *
788  * clazz ::
789  * A pointer to the font driver's class. Note that this is NOT
790  * root.clazz. 'class' wasn't used as it is a reserved word in C++.
791  *
792  * faces_list ::
793  * The list of faces currently opened by this driver.
794  *
795  * glyph_loader ::
796  * Unused. Used to be glyph loader for all faces managed by this
797  * driver.
798  */
799  typedef struct FT_DriverRec_
800  {
805 
807 
808 
809  /*************************************************************************/
810  /*************************************************************************/
811  /*************************************************************************/
812  /**** ****/
813  /**** ****/
814  /**** L I B R A R I E S ****/
815  /**** ****/
816  /**** ****/
817  /*************************************************************************/
818  /*************************************************************************/
819  /*************************************************************************/
820 
821 
822  /**************************************************************************
823  *
824  * @struct:
825  * FT_LibraryRec
826  *
827  * @description:
828  * The FreeType library class. This is the root of all FreeType data.
829  * Use FT_New_Library() to create a library object, and FT_Done_Library()
830  * to discard it and all child objects.
831  *
832  * @fields:
833  * memory ::
834  * The library's memory object. Manages memory allocation.
835  *
836  * version_major ::
837  * The major version number of the library.
838  *
839  * version_minor ::
840  * The minor version number of the library.
841  *
842  * version_patch ::
843  * The current patch level of the library.
844  *
845  * num_modules ::
846  * The number of modules currently registered within this library.
847  * This is set to 0 for new libraries. New modules are added through
848  * the FT_Add_Module() API function.
849  *
850  * modules ::
851  * A table used to store handles to the currently registered
852  * modules. Note that each font driver contains a list of its opened
853  * faces.
854  *
855  * renderers ::
856  * The list of renderers currently registered within the library.
857  *
858  * cur_renderer ::
859  * The current outline renderer. This is a shortcut used to avoid
860  * parsing the list on each call to FT_Outline_Render(). It is a
861  * handle to the current renderer for the FT_GLYPH_FORMAT_OUTLINE
862  * format.
863  *
864  * auto_hinter ::
865  * The auto-hinter module interface.
866  *
867  * debug_hooks ::
868  * An array of four function pointers that allow debuggers to hook into
869  * a font format's interpreter. Currently, only the TrueType bytecode
870  * debugger uses this.
871  *
872  * lcd_weights ::
873  * The LCD filter weights for ClearType-style subpixel rendering.
874  *
875  * lcd_filter_func ::
876  * The LCD filtering callback function for for ClearType-style subpixel
877  * rendering.
878  *
879  * lcd_geometry ::
880  * This array specifies LCD subpixel geometry and controls Harmony LCD
881  * rendering technique, alternative to ClearType.
882  *
883  * pic_container ::
884  * Contains global structs and tables, instead of defining them
885  * globally.
886  *
887  * refcount ::
888  * A counter initialized to~1 at the time an @FT_Library structure is
889  * created. @FT_Reference_Library increments this counter, and
890  * @FT_Done_Library only destroys a library if the counter is~1,
891  * otherwise it simply decrements it.
892  */
893  typedef struct FT_LibraryRec_
894  {
895  FT_Memory memory; /* library's memory manager */
896 
900 
902  FT_Module modules[FT_MAX_MODULES]; /* module objects */
903 
904  FT_ListRec renderers; /* list of renderers */
905  FT_Renderer cur_renderer; /* current outline renderer */
907 
909 
910 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
911  FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */
912  FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
913 #else
914  FT_Vector lcd_geometry[3]; /* RGB subpixel positions */
915 #endif
916 
918 
920 
921 
925  FT_ListNode* node );
926 
927  FT_BASE( FT_Error )
930  FT_Render_Mode render_mode );
931 
932  typedef const char*
933  (*FT_Face_GetPostscriptNameFunc)( FT_Face face );
934 
935  typedef FT_Error
939  FT_UInt buffer_max );
940 
941  typedef FT_UInt
943  const FT_String* glyph_name );
944 
945 
946 #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
947 
948  /**************************************************************************
949  *
950  * @function:
951  * FT_New_Memory
952  *
953  * @description:
954  * Creates a new memory object.
955  *
956  * @return:
957  * A pointer to the new memory object. 0 in case of error.
958  */
959  FT_BASE( FT_Memory )
960  FT_New_Memory( void );
961 
962 
963  /**************************************************************************
964  *
965  * @function:
966  * FT_Done_Memory
967  *
968  * @description:
969  * Discards memory manager.
970  *
971  * @input:
972  * memory ::
973  * A handle to the memory manager.
974  */
975  FT_BASE( void )
976  FT_Done_Memory( FT_Memory memory );
977 
978 #endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
979 
980 
981  /* Define default raster's interface. The default raster is located in */
982  /* `src/base/ftraster.c'. */
983  /* */
984  /* Client applications can register new rasters through the */
985  /* FT_Set_Raster() API. */
986 
987 #ifndef FT_NO_DEFAULT_RASTER
989 #endif
990 
991 
992  /**************************************************************************
993  *
994  * @macro:
995  * FT_DEFINE_OUTLINE_FUNCS
996  *
997  * @description:
998  * Used to initialize an instance of FT_Outline_Funcs struct. The struct
999  * will be allocated in the global scope (or the scope where the macro is
1000  * used).
1001  */
1002 #define FT_DEFINE_OUTLINE_FUNCS( \
1003  class_, \
1004  move_to_, \
1005  line_to_, \
1006  conic_to_, \
1007  cubic_to_, \
1008  shift_, \
1009  delta_ ) \
1010  static const FT_Outline_Funcs class_ = \
1011  { \
1012  move_to_, \
1013  line_to_, \
1014  conic_to_, \
1015  cubic_to_, \
1016  shift_, \
1017  delta_ \
1018  };
1019 
1020 
1021  /**************************************************************************
1022  *
1023  * @macro:
1024  * FT_DEFINE_RASTER_FUNCS
1025  *
1026  * @description:
1027  * Used to initialize an instance of FT_Raster_Funcs struct. The struct
1028  * will be allocated in the global scope (or the scope where the macro is
1029  * used).
1030  */
1031 #define FT_DEFINE_RASTER_FUNCS( \
1032  class_, \
1033  glyph_format_, \
1034  raster_new_, \
1035  raster_reset_, \
1036  raster_set_mode_, \
1037  raster_render_, \
1038  raster_done_ ) \
1039  const FT_Raster_Funcs class_ = \
1040  { \
1041  glyph_format_, \
1042  raster_new_, \
1043  raster_reset_, \
1044  raster_set_mode_, \
1045  raster_render_, \
1046  raster_done_ \
1047  };
1048 
1049 
1050 
1051  /**************************************************************************
1052  *
1053  * @macro:
1054  * FT_DEFINE_GLYPH
1055  *
1056  * @description:
1057  * The struct will be allocated in the global scope (or the scope where
1058  * the macro is used).
1059  */
1060 #define FT_DECLARE_GLYPH( class_ ) \
1061  FT_CALLBACK_TABLE const FT_Glyph_Class class_;
1062 
1063 #define FT_DEFINE_GLYPH( \
1064  class_, \
1065  size_, \
1066  format_, \
1067  init_, \
1068  done_, \
1069  copy_, \
1070  transform_, \
1071  bbox_, \
1072  prepare_ ) \
1073  FT_CALLBACK_TABLE_DEF \
1074  const FT_Glyph_Class class_ = \
1075  { \
1076  size_, \
1077  format_, \
1078  init_, \
1079  done_, \
1080  copy_, \
1081  transform_, \
1082  bbox_, \
1083  prepare_ \
1084  };
1085 
1086 
1087  /**************************************************************************
1088  *
1089  * @macro:
1090  * FT_DECLARE_RENDERER
1091  *
1092  * @description:
1093  * Used to create a forward declaration of a FT_Renderer_Class struct
1094  * instance.
1095  *
1096  * @macro:
1097  * FT_DEFINE_RENDERER
1098  *
1099  * @description:
1100  * Used to initialize an instance of FT_Renderer_Class struct.
1101  *
1102  * The struct will be allocated in the global scope (or the scope where
1103  * the macro is used).
1104  */
1105 #define FT_DECLARE_RENDERER( class_ ) \
1106  FT_EXPORT_VAR( const FT_Renderer_Class ) class_;
1107 
1108 #define FT_DEFINE_RENDERER( \
1109  class_, \
1110  flags_, \
1111  size_, \
1112  name_, \
1113  version_, \
1114  requires_, \
1115  interface_, \
1116  init_, \
1117  done_, \
1118  get_interface_, \
1119  glyph_format_, \
1120  render_glyph_, \
1121  transform_glyph_, \
1122  get_glyph_cbox_, \
1123  set_mode_, \
1124  raster_class_ ) \
1125  FT_CALLBACK_TABLE_DEF \
1126  const FT_Renderer_Class class_ = \
1127  { \
1128  FT_DEFINE_ROOT_MODULE( flags_, \
1129  size_, \
1130  name_, \
1131  version_, \
1132  requires_, \
1133  interface_, \
1134  init_, \
1135  done_, \
1136  get_interface_ ) \
1137  glyph_format_, \
1138  \
1139  render_glyph_, \
1140  transform_glyph_, \
1141  get_glyph_cbox_, \
1142  set_mode_, \
1143  \
1144  raster_class_ \
1145  };
1146 
1147 
1148  /**************************************************************************
1149  *
1150  * @macro:
1151  * FT_DECLARE_MODULE
1152  *
1153  * @description:
1154  * Used to create a forward declaration of a FT_Module_Class struct
1155  * instance.
1156  *
1157  * @macro:
1158  * FT_DEFINE_MODULE
1159  *
1160  * @description:
1161  * Used to initialize an instance of an FT_Module_Class struct.
1162  *
1163  * The struct will be allocated in the global scope (or the scope where
1164  * the macro is used).
1165  *
1166  * @macro:
1167  * FT_DEFINE_ROOT_MODULE
1168  *
1169  * @description:
1170  * Used to initialize an instance of an FT_Module_Class struct inside
1171  * another struct that contains it or in a function that initializes that
1172  * containing struct.
1173  */
1174 #define FT_DECLARE_MODULE( class_ ) \
1175  FT_CALLBACK_TABLE \
1176  const FT_Module_Class class_;
1177 
1178 #define FT_DEFINE_ROOT_MODULE( \
1179  flags_, \
1180  size_, \
1181  name_, \
1182  version_, \
1183  requires_, \
1184  interface_, \
1185  init_, \
1186  done_, \
1187  get_interface_ ) \
1188  { \
1189  flags_, \
1190  size_, \
1191  \
1192  name_, \
1193  version_, \
1194  requires_, \
1195  \
1196  interface_, \
1197  \
1198  init_, \
1199  done_, \
1200  get_interface_, \
1201  },
1202 
1203 #define FT_DEFINE_MODULE( \
1204  class_, \
1205  flags_, \
1206  size_, \
1207  name_, \
1208  version_, \
1209  requires_, \
1210  interface_, \
1211  init_, \
1212  done_, \
1213  get_interface_ ) \
1214  FT_CALLBACK_TABLE_DEF \
1215  const FT_Module_Class class_ = \
1216  { \
1217  flags_, \
1218  size_, \
1219  \
1220  name_, \
1221  version_, \
1222  requires_, \
1223  \
1224  interface_, \
1225  \
1226  init_, \
1227  done_, \
1228  get_interface_, \
1229  };
1230 
1231 
1233 
1234 #endif /* FTOBJS_H_ */
1235 
1236 
1237 /* END */
#define advance
Definition: aptex-macros.h:464
#define global
#define mode
Definition: aptex-macros.h:510
static void
Definition: fpif.c:118
#define FT_MAX_MODULES
Definition: ftoption.h:411
#define FT_END_HEADER
Definition: ftheader.h:57
enum FT_Render_Mode_ FT_Render_Mode
typedefFT_BEGIN_HEADER struct FT_Glyph_Class_ FT_Glyph_Class
Definition: ftglyph.h:69
#define FT_Raster_Render_Func
Definition: ftimage.h:1199
struct FT_RasterRec_ * FT_Raster
Definition: ftimage.h:828
enum FT_Glyph_Format_ FT_Glyph_Format
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:57
FT_Byte FT_LcdFiveTapFilter[5]
Definition: ftlcdfil.h:266
FT_Error(* FT_DebugHook_Func)(void *arg)
Definition: ftmodapi.h:626
FT_Error(* FT_Renderer_RenderFunc)(FT_Renderer renderer, FT_GlyphSlot slot, FT_Render_Mode mode, const FT_Vector *origin)
Definition: ftrender.h:88
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:64
void * FT_Pointer
Definition: fttypes.h:310
signed char FT_Char
Definition: fttypes.h:143
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
unsigned long FT_ULong
Definition: fttypes.h:253
unsigned char FT_Byte
Definition: fttypes.h:154
int FT_Error
Definition: fttypes.h:299
char FT_String
Definition: fttypes.h:187
unsigned int FT_UInt
Definition: fttypes.h:231
signed int FT_Int
Definition: fttypes.h:220
#define FT_EXPORT_VAR(x)
#define FT_BASE(x)
FT_UInt(* FT_CMap_CharNextFunc)(FT_CMap cmap, FT_UInt32 *achar_code)
Definition: ftobjs.h:179
struct FT_ModuleRec_ FT_ModuleRec
struct FT_Slot_InternalRec_ FT_GlyphSlot_InternalRec
struct FT_LibraryRec_ FT_LibraryRec
FT_Error FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
Definition: ftobjs.c:3677
void FT_CMap_Done(FT_CMap cmap)
Definition: ftobjs.c:3631
FT_UInt(* FT_CMap_CharVarIndexFunc)(FT_CMap cmap, FT_CMap unicode_cmap, FT_UInt32 char_code, FT_UInt32 variant_selector)
Definition: ftobjs.h:183
FT_UInt32 *(* FT_CMap_VariantListFunc)(FT_CMap cmap, FT_Memory mem)
Definition: ftobjs.h:194
FT_Error FT_New_GlyphSlot(FT_Face face, FT_GlyphSlot *aslot)
Definition: ftobjs.c:595
void FT_Select_Metrics(FT_Face face, FT_ULong strike_index)
Definition: ftobjs.c:3057
struct FT_DriverRec_ FT_DriverRec
FT_UInt(* FT_Face_GetGlyphNameIndexFunc)(FT_Face face, const FT_String *glyph_name)
Definition: ftobjs.h:942
FT_Error ft_glyphslot_alloc_bitmap(FT_GlyphSlot slot, FT_ULong size)
Definition: ftobjs.c:514
struct FT_Size_InternalRec_ FT_Size_InternalRec
void FT_Request_Metrics(FT_Face face, FT_Size_Request req)
Definition: ftobjs.c:3092
FT_Pointer ft_module_get_service(FT_Module module, const char *service_id, FT_Bool global)
Definition: ftobjs.c:5027
FT_Int(* FT_CMap_CharVarIsDefaultFunc)(FT_CMap cmap, FT_UInt32 char_code, FT_UInt32 variant_selector)
Definition: ftobjs.h:189
struct FT_CMap_ClassRec_ FT_CMap_ClassRec
struct FT_CMapRec_ FT_CMapRec
FT_UInt32 *(* FT_CMap_VariantCharListFunc)(FT_CMap cmap, FT_Memory mem, FT_UInt32 variant_selector)
Definition: ftobjs.h:203
FT_Bool ft_glyphslot_preset_bitmap(FT_GlyphSlot slot, FT_Render_Mode mode, const FT_Vector *origin)
Definition: ftobjs.c:347
void FT_Done_GlyphSlot(FT_GlyphSlot slot)
Definition: ftobjs.c:648
FT_Error FT_Render_Glyph_Internal(FT_Library library, FT_GlyphSlot slot, FT_Render_Mode render_mode)
Definition: ftobjs.c:4548
struct FT_CMapRec_ * FT_CMap
Definition: ftobjs.h:143
const void * FT_Get_Module_Interface(FT_Library library, const char *mod_name)
Definition: ftobjs.c:5012
FT_Error FT_Match_Size(FT_Face face, FT_Size_Request req, FT_Bool ignore_width, FT_ULong *size_index)
Definition: ftobjs.c:2939
void ft_lcd_padding(FT_BBox *cbox, FT_GlyphSlot slot, FT_Render_Mode mode)
Definition: ftlcdfil.c:372
FT_UInt32 *(* FT_CMap_CharVariantListFunc)(FT_CMap cmap, FT_Memory mem, FT_UInt32 char_code)
Definition: ftobjs.h:198
void FT_Done_Memory(FT_Memory memory)
Definition: ftsystem.c:515
struct FT_Face_InternalRec_ FT_Face_InternalRec
FT_Error(* FT_CMap_InitFunc)(FT_CMap cmap, FT_Pointer init_data)
Definition: ftobjs.h:168
void ft_glyphslot_set_bitmap(FT_GlyphSlot slot, FT_Byte *buffer)
Definition: ftobjs.c:502
struct FT_RendererRec_ FT_RendererRec
void ft_synthesize_vertical_metrics(FT_Glyph_Metrics *metrics, FT_Pos advance)
Definition: ftobjs.c:2997
FT_Memory FT_New_Memory(void)
Definition: ftsystem.c:475
void(* FT_CMap_DoneFunc)(FT_CMap cmap)
Definition: ftobjs.h:172
const struct FT_CMap_ClassRec_ * FT_CMap_Class
Definition: ftobjs.h:146
FT_UInt(* FT_CMap_CharIndexFunc)(FT_CMap cmap, FT_UInt32 char_code)
Definition: ftobjs.h:175
FT_Error(* FT_Face_GetGlyphNameFunc)(FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max)
Definition: ftobjs.h:936
FT_Renderer FT_Lookup_Renderer(FT_Library library, FT_Glyph_Format format, FT_ListNode *node)
Definition: ftobjs.c:4327
FT_Raster_Funcs ft_default_raster
void ft_glyphslot_free_bitmap(FT_GlyphSlot slot)
Definition: ftobjs.c:325
FT_Face face
Definition: cffdrivr.c:659
FT_Library library
Definition: cffdrivr.c:660
#define mem
Definition: synctex.c:171
#define char_code
Definition: mfluac.c:331
static int format
Definition: pbmclean.c:15
char * bitmap
Definition: pbmpage.c:35
static int size
Definition: ppmlabel.c:24
slotref slot
Definition: opcodes.h:237
#define glyph_index()
FT_CharMapRec charmap
Definition: ftobjs.h:151
FT_CMap_Class clazz
Definition: ftobjs.h:152
FT_CMap_DoneFunc done
Definition: ftobjs.h:213
FT_CMap_CharNextFunc char_next
Definition: ftobjs.h:215
FT_CMap_CharVariantListFunc charvariant_list
Definition: ftobjs.h:223
FT_CMap_CharVarIndexFunc char_var_index
Definition: ftobjs.h:220
FT_ULong size
Definition: ftobjs.h:210
FT_CMap_VariantCharListFunc variantchar_list
Definition: ftobjs.h:224
FT_CMap_CharVarIsDefaultFunc char_var_default
Definition: ftobjs.h:221
FT_CMap_CharIndexFunc char_index
Definition: ftobjs.h:214
FT_CMap_VariantListFunc variant_list
Definition: ftobjs.h:222
FT_CMap_InitFunc init
Definition: ftobjs.h:212
FT_ListRec faces_list
Definition: ftobjs.h:803
FT_Driver_Class clazz
Definition: ftobjs.h:802
FT_ModuleRec root
Definition: ftobjs.h:801
FT_GlyphLoader glyph_loader
Definition: ftobjs.h:804
FT_Int transform_flags
Definition: ftobjs.h:361
FT_Char no_stem_darkening
Definition: ftobjs.h:369
FT_Int32 random_seed
Definition: ftobjs.h:370
FT_Matrix transform_matrix
Definition: ftobjs.h:359
FT_Vector transform_delta
Definition: ftobjs.h:360
FT_ServiceCacheRec services
Definition: ftobjs.h:363
FT_Int version_minor
Definition: ftobjs.h:898
FT_Int version_major
Definition: ftobjs.h:897
FT_Int version_patch
Definition: ftobjs.h:899
FT_Renderer cur_renderer
Definition: ftobjs.h:905
FT_Vector lcd_geometry[3]
Definition: ftobjs.h:914
FT_Module modules[FT_MAX_MODULES]
Definition: ftobjs.h:902
FT_Int refcount
Definition: ftobjs.h:917
FT_DebugHook_Func debug_hooks[4]
Definition: ftobjs.h:908
FT_ListRec renderers
Definition: ftobjs.h:904
FT_Module auto_hinter
Definition: ftobjs.h:906
FT_UInt num_modules
Definition: ftobjs.h:901
FT_Memory memory
Definition: ftobjs.h:895
FT_Memory memory
Definition: ftobjs.h:502
FT_Module_Class * clazz
Definition: ftobjs.h:500
FT_Library library
Definition: ftobjs.h:501
FT_Renderer_RenderFunc render
Definition: ftobjs.h:750
FT_Glyph_Class glyph_class
Definition: ftobjs.h:746
FT_Glyph_Format glyph_format
Definition: ftobjs.h:745
FT_Raster_Render_Func raster_render
Definition: ftobjs.h:749
FT_ModuleRec root
Definition: ftobjs.h:743
FT_Raster raster
Definition: ftobjs.h:748
FT_Renderer_Class * clazz
Definition: ftobjs.h:744
void * module_data
Definition: ftobjs.h:459
FT_Size_Metrics autohint_metrics
Definition: ftobjs.h:462
FT_Render_Mode autohint_mode
Definition: ftobjs.h:461
FT_Vector glyph_delta
Definition: ftobjs.h:429
FT_Matrix glyph_matrix
Definition: ftobjs.h:428
void * glyph_hints
Definition: ftobjs.h:430
FT_Bool glyph_transformed
Definition: ftobjs.h:427
FT_GlyphLoader loader
Definition: ftobjs.h:425
FT_Int32 load_flags
Definition: ftobjs.h:432
Definition: obx.h:117
Definition: gf2pbm.c:137
Definition: utils.c:300
TT_CharMap cmap
Definition: ttf2pfb.c:163
Definition: obx.h:51
#define buffer
Definition: xmlparse.c:611