1 /****************************************************************************
5 * The FreeType private base classes (specification).
7 * Copyright (C) 1996-2023 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
10 * This file is part of the FreeType project, and may only be used,
11 * modified, and distributed under the terms of the FreeType project
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute
13 * this file you indicate that you have read the license and
14 * understand and accept it fully.
19 /**************************************************************************
21 * This file contains the definition of all internal FreeType classes.
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>
39 #ifdef FT_CONFIG_OPTION_INCREMENTAL
40 #include <freetype/ftincrem.h>
43 #include "compiler-macros.h"
48 /**************************************************************************
50 * Some generic definitions.
65 /**************************************************************************
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.
70 #define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) )
71 #define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )
73 #define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) )
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.
80 #define FT_HYPOT( x, y ) \
83 x > y ? x + ( 3 * y >> 3 ) \
84 : y + ( 3 * x >> 3 ) )
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 )
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 )
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 ), \
99 #define FT_PAD_CEIL_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) - 1 ), \
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 ) )
104 #define FT_PAD_ROUND_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) / 2 ), \
106 #define FT_PAD_CEIL_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) - 1 ), \
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 ) )
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
116 #define ft_isdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U )
118 #define ft_isxdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U || \
119 ( (unsigned)(x) - 'a' ) < 6U || \
120 ( (unsigned)(x) - 'A' ) < 6U )
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 )
126 #define ft_isalpha( x ) ( ft_isupper( x ) || ft_islower( x ) )
127 #define ft_isalnum( x ) ( ft_isdigit( x ) || ft_isalpha( x ) )
130 /*************************************************************************/
131 /*************************************************************************/
132 /*************************************************************************/
135 /**** C H A R M A P S ****/
138 /*************************************************************************/
139 /*************************************************************************/
140 /*************************************************************************/
142 /* handle to internal charmap object */
143 typedef struct FT_CMapRec_* FT_CMap;
145 /* handle to charmap class structure */
146 typedef const struct FT_CMap_ClassRec_* FT_CMap_Class;
148 /* internal charmap object structure */
149 typedef struct FT_CMapRec_
151 FT_CharMapRec charmap;
156 /* typecast any pointer to a charmap handle */
157 #define FT_CMAP( x ) ( (FT_CMap)( x ) )
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
166 /* class method definitions */
168 (*FT_CMap_InitFunc)( FT_CMap cmap,
169 FT_Pointer init_data );
172 (*FT_CMap_DoneFunc)( FT_CMap cmap );
175 (*FT_CMap_CharIndexFunc)( FT_CMap cmap,
176 FT_UInt32 char_code );
179 (*FT_CMap_CharNextFunc)( FT_CMap cmap,
180 FT_UInt32 *achar_code );
183 (*FT_CMap_CharVarIndexFunc)( FT_CMap cmap,
184 FT_CMap unicode_cmap,
186 FT_UInt32 variant_selector );
189 (*FT_CMap_CharVarIsDefaultFunc)( FT_CMap cmap,
191 FT_UInt32 variant_selector );
194 (*FT_CMap_VariantListFunc)( FT_CMap cmap,
198 (*FT_CMap_CharVariantListFunc)( FT_CMap cmap,
200 FT_UInt32 char_code );
203 (*FT_CMap_VariantCharListFunc)( FT_CMap cmap,
205 FT_UInt32 variant_selector );
208 typedef struct FT_CMap_ClassRec_
212 FT_CMap_InitFunc init;
213 FT_CMap_DoneFunc done;
214 FT_CMap_CharIndexFunc char_index;
215 FT_CMap_CharNextFunc char_next;
217 /* Subsequent entries are special ones for format 14 -- the variant */
218 /* selector subtable which behaves like no other */
220 FT_CMap_CharVarIndexFunc char_var_index;
221 FT_CMap_CharVarIsDefaultFunc char_var_default;
222 FT_CMap_VariantListFunc variant_list;
223 FT_CMap_CharVariantListFunc charvariant_list;
224 FT_CMap_VariantCharListFunc variantchar_list;
229 #define FT_DECLARE_CMAP_CLASS( class_ ) \
230 FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
232 #define FT_DEFINE_CMAP_CLASS( \
243 variantchar_list_ ) \
244 FT_CALLBACK_TABLE_DEF \
245 const FT_CMap_ClassRec class_ = \
260 /* create a new charmap and add it to charmap->face */
262 FT_CMap_New( FT_CMap_Class clazz,
263 FT_Pointer init_data,
267 /* destroy a charmap and remove it from face's list */
269 FT_CMap_Done( FT_CMap cmap );
272 /* add LCD padding to CBox */
274 ft_lcd_padding( FT_BBox* cbox,
276 FT_Render_Mode mode );
278 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
280 typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap,
284 /* This is the default LCD filter, an in-place, 5-tap FIR filter. */
286 ft_lcd_filter_fir( FT_Bitmap* bitmap,
287 FT_LcdFiveTapFilter weights );
289 #endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
291 /**************************************************************************
294 * FT_Face_InternalRec
297 * This structure contains the internal fields of each FT_Face object.
298 * These fields may change between different releases of FreeType.
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.
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.
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
319 * A translation vector used to transform glyph outlines after they are
320 * loaded from the font. Only used by the convenience functions.
323 * Some flags used to classify the transform. Only used by the
324 * convenience functions.
327 * A cache for frequently used services. It should be only accessed
328 * with the macro `FT_FACE_LOOKUP_SERVICE`.
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.
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.
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.
348 * These fields specify the LCD filtering weights and callback function
349 * for ClearType-style subpixel rendering.
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.
357 typedef struct FT_Face_InternalRec_
359 FT_Matrix transform_matrix;
360 FT_Vector transform_delta;
361 FT_Int transform_flags;
363 FT_ServiceCacheRec services;
365 #ifdef FT_CONFIG_OPTION_INCREMENTAL
366 FT_Incremental_InterfaceRec* incremental_interface;
369 FT_Char no_stem_darkening;
370 FT_Int32 random_seed;
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 */
379 } FT_Face_InternalRec;
382 /**************************************************************************
385 * FT_Slot_InternalRec
388 * This structure contains the internal fields of each FT_GlyphSlot
389 * object. These fields may change between different releases of
394 * The glyph loader object used to load outlines into the glyph slot.
397 * Possible values are zero or FT_GLYPH_OWN_BITMAP. The latter
398 * indicates that the FT_GlyphSlot structure owns the bitmap buffer.
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().
406 * The 2x2 matrix corresponding to the glyph transformation, if
410 * The 2d translation vector corresponding to the glyph transformation,
414 * Format-specific glyph hints management.
417 * The load flags passed as an argument to @FT_Load_Glyph while
418 * initializing the glyph slot.
421 #define FT_GLYPH_OWN_BITMAP 0x1U
422 #define FT_GLYPH_OWN_GZIP_SVG 0x2U
424 typedef struct FT_Slot_InternalRec_
426 FT_GlyphLoader loader;
428 FT_Bool glyph_transformed;
429 FT_Matrix glyph_matrix;
430 FT_Vector glyph_delta;
435 } FT_GlyphSlot_InternalRec;
438 /**************************************************************************
441 * FT_Size_InternalRec
444 * This structure contains the internal fields of each FT_Size object.
448 * Data specific to a driver module.
451 * The used auto-hinting mode.
453 * autohint_metrics ::
454 * Metrics used by the auto-hinter.
458 typedef struct FT_Size_InternalRec_
462 FT_Render_Mode autohint_mode;
463 FT_Size_Metrics autohint_metrics;
465 } FT_Size_InternalRec;
468 /*************************************************************************/
469 /*************************************************************************/
470 /*************************************************************************/
473 /**** M O D U L E S ****/
476 /*************************************************************************/
477 /*************************************************************************/
478 /*************************************************************************/
481 /**************************************************************************
487 * A module object instance.
491 * A pointer to the module's class.
494 * A handle to the parent library object.
497 * A handle to the memory manager.
499 typedef struct FT_ModuleRec_
501 FT_Module_Class* clazz;
508 /* typecast an object to an FT_Module */
509 #define FT_MODULE( x ) ( (FT_Module)(x) )
511 #define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz
512 #define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library
513 #define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory
516 #define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
517 FT_MODULE_FONT_DRIVER )
519 #define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
522 #define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
525 #define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
528 #define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \
529 FT_MODULE_DRIVER_SCALABLE )
531 #define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \
532 FT_MODULE_DRIVER_NO_OUTLINES )
534 #define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
535 FT_MODULE_DRIVER_HAS_HINTER )
537 #define FT_DRIVER_HINTS_LIGHTLY( x ) ( FT_MODULE_CLASS( x )->module_flags & \
538 FT_MODULE_DRIVER_HINTS_LIGHTLY )
541 /**************************************************************************
544 * FT_Get_Module_Interface
547 * Finds a module and returns its specific interface as a typeless
552 * A handle to the library object.
555 * The module's name (as an ASCII string).
558 * A module-specific interface if available, 0 otherwise.
561 * You should better be familiar with FreeType internals to know which
562 * module to look for, and what its interface is :-)
564 FT_BASE( const void* )
565 FT_Get_Module_Interface( FT_Library library,
566 const char* mod_name );
568 FT_BASE( FT_Pointer )
569 ft_module_get_service( FT_Module module,
570 const char* service_id,
573 #ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
575 ft_property_string_set( FT_Library library,
576 const FT_String* module_name,
577 const FT_String* property_name,
584 /*************************************************************************/
585 /*************************************************************************/
586 /*************************************************************************/
589 /**** F A C E, S I Z E & G L Y P H S L O T O B J E C T S ****/
592 /*************************************************************************/
593 /*************************************************************************/
594 /*************************************************************************/
596 /* a few macros used to perform easy typecasts with minimal brain damage */
598 #define FT_FACE( x ) ( (FT_Face)(x) )
599 #define FT_SIZE( x ) ( (FT_Size)(x) )
600 #define FT_SLOT( x ) ( (FT_GlyphSlot)(x) )
602 #define FT_FACE_DRIVER( x ) FT_FACE( x )->driver
603 #define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library
604 #define FT_FACE_MEMORY( x ) FT_FACE( x )->memory
605 #define FT_FACE_STREAM( x ) FT_FACE( x )->stream
607 #define FT_SIZE_FACE( x ) FT_SIZE( x )->face
608 #define FT_SLOT_FACE( x ) FT_SLOT( x )->face
610 #define FT_FACE_SLOT( x ) FT_FACE( x )->glyph
611 #define FT_FACE_SIZE( x ) FT_FACE( x )->size
614 /**************************************************************************
620 * It is sometimes useful to have more than one glyph slot for a given
621 * face object. This function is used to create additional slots. All
622 * of them are automatically discarded when the face is destroyed.
626 * A handle to a parent face object.
630 * A handle to a new glyph slot object.
633 * FreeType error code. 0 means success.
636 FT_New_GlyphSlot( FT_Face face,
637 FT_GlyphSlot *aslot );
640 /**************************************************************************
646 * Destroys a given glyph slot. Remember however that all slots are
647 * automatically destroyed with its parent. Using this function is not
652 * A handle to a target glyph slot.
655 FT_Done_GlyphSlot( FT_GlyphSlot slot );
659 #define FT_REQUEST_WIDTH( req ) \
660 ( (req)->horiResolution \
661 ? ( (req)->width * (FT_Pos)(req)->horiResolution + 36 ) / 72 \
664 #define FT_REQUEST_HEIGHT( req ) \
665 ( (req)->vertResolution \
666 ? ( (req)->height * (FT_Pos)(req)->vertResolution + 36 ) / 72 \
670 /* Set the metrics according to a bitmap strike. */
672 FT_Select_Metrics( FT_Face face,
673 FT_ULong strike_index );
676 /* Set the metrics according to a size request. */
678 FT_Request_Metrics( FT_Face face,
679 FT_Size_Request req );
682 /* Match a size request against `available_sizes'. */
684 FT_Match_Size( FT_Face face,
686 FT_Bool ignore_width,
687 FT_ULong* size_index );
690 /* Use the horizontal metrics to synthesize the vertical metrics. */
691 /* If `advance' is zero, it is also synthesized. */
693 ft_synthesize_vertical_metrics( FT_Glyph_Metrics* metrics,
697 /* Free the bitmap of a given glyphslot when needed (i.e., only when it */
698 /* was allocated with ft_glyphslot_alloc_bitmap). */
700 ft_glyphslot_free_bitmap( FT_GlyphSlot slot );
703 /* Preset bitmap metrics of an outline glyphslot prior to rendering */
704 /* and check whether the truncated bbox is too large for rendering. */
706 ft_glyphslot_preset_bitmap( FT_GlyphSlot slot,
708 const FT_Vector* origin );
710 /* Allocate a new bitmap buffer in a glyph slot. */
712 ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot,
716 /* Set the bitmap buffer in a glyph slot to a given pointer. The buffer */
717 /* will not be freed by a later call to ft_glyphslot_free_bitmap. */
719 ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
723 /*************************************************************************/
724 /*************************************************************************/
725 /*************************************************************************/
728 /**** R E N D E R E R S ****/
731 /*************************************************************************/
732 /*************************************************************************/
733 /*************************************************************************/
736 #define FT_RENDERER( x ) ( (FT_Renderer)(x) )
737 #define FT_GLYPH( x ) ( (FT_Glyph)(x) )
738 #define FT_BITMAP_GLYPH( x ) ( (FT_BitmapGlyph)(x) )
739 #define FT_OUTLINE_GLYPH( x ) ( (FT_OutlineGlyph)(x) )
742 typedef struct FT_RendererRec_
745 FT_Renderer_Class* clazz;
746 FT_Glyph_Format glyph_format;
747 FT_Glyph_Class glyph_class;
750 FT_Raster_Render_Func raster_render;
751 FT_Renderer_RenderFunc render;
756 /*************************************************************************/
757 /*************************************************************************/
758 /*************************************************************************/
761 /**** F O N T D R I V E R S ****/
764 /*************************************************************************/
765 /*************************************************************************/
766 /*************************************************************************/
769 /* typecast a module into a driver easily */
770 #define FT_DRIVER( x ) ( (FT_Driver)(x) )
772 /* typecast a module as a driver, and get its driver class */
773 #define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz
776 /**************************************************************************
782 * The root font driver class. A font driver is responsible for managing
783 * and loading font files of a given format.
787 * Contains the fields of the root module class.
790 * A pointer to the font driver's class. Note that this is NOT
791 * root.clazz. 'class' wasn't used as it is a reserved word in C++.
794 * The list of faces currently opened by this driver.
797 * Unused. Used to be glyph loader for all faces managed by this
800 typedef struct FT_DriverRec_
803 FT_Driver_Class clazz;
804 FT_ListRec faces_list;
805 FT_GlyphLoader glyph_loader;
810 /*************************************************************************/
811 /*************************************************************************/
812 /*************************************************************************/
815 /**** L I B R A R I E S ****/
818 /*************************************************************************/
819 /*************************************************************************/
820 /*************************************************************************/
823 /**************************************************************************
829 * The FreeType library class. This is the root of all FreeType data.
830 * Use FT_New_Library() to create a library object, and FT_Done_Library()
831 * to discard it and all child objects.
835 * The library's memory object. Manages memory allocation.
838 * The major version number of the library.
841 * The minor version number of the library.
844 * The current patch level of the library.
847 * The number of modules currently registered within this library.
848 * This is set to 0 for new libraries. New modules are added through
849 * the FT_Add_Module() API function.
852 * A table used to store handles to the currently registered
853 * modules. Note that each font driver contains a list of its opened
857 * The list of renderers currently registered within the library.
860 * The current outline renderer. This is a shortcut used to avoid
861 * parsing the list on each call to FT_Outline_Render(). It is a
862 * handle to the current renderer for the FT_GLYPH_FORMAT_OUTLINE
866 * The auto-hinter module interface.
869 * An array of four function pointers that allow debuggers to hook into
870 * a font format's interpreter. Currently, only the TrueType bytecode
871 * debugger uses this.
874 * The LCD filter weights for ClearType-style subpixel rendering.
877 * The LCD filtering callback function for for ClearType-style subpixel
881 * This array specifies LCD subpixel geometry and controls Harmony LCD
882 * rendering technique, alternative to ClearType.
885 * Contains global structs and tables, instead of defining them
889 * A counter initialized to~1 at the time an @FT_Library structure is
890 * created. @FT_Reference_Library increments this counter, and
891 * @FT_Done_Library only destroys a library if the counter is~1,
892 * otherwise it simply decrements it.
894 typedef struct FT_LibraryRec_
896 FT_Memory memory; /* library's memory manager */
898 FT_Int version_major;
899 FT_Int version_minor;
900 FT_Int version_patch;
903 FT_Module modules[FT_MAX_MODULES]; /* module objects */
905 FT_ListRec renderers; /* list of renderers */
906 FT_Renderer cur_renderer; /* current outline renderer */
907 FT_Module auto_hinter;
909 FT_DebugHook_Func debug_hooks[4];
911 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
912 FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */
913 FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
915 FT_Vector lcd_geometry[3]; /* RGB subpixel positions */
923 FT_BASE( FT_Renderer )
924 FT_Lookup_Renderer( FT_Library library,
925 FT_Glyph_Format format,
929 FT_Render_Glyph_Internal( FT_Library library,
931 FT_Render_Mode render_mode );
934 (*FT_Face_GetPostscriptNameFunc)( FT_Face face );
937 (*FT_Face_GetGlyphNameFunc)( FT_Face face,
940 FT_UInt buffer_max );
943 (*FT_Face_GetGlyphNameIndexFunc)( FT_Face face,
944 const FT_String* glyph_name );
947 #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
949 /**************************************************************************
955 * Creates a new memory object.
958 * A pointer to the new memory object. 0 in case of error.
961 FT_New_Memory( void );
964 /**************************************************************************
970 * Discards memory manager.
974 * A handle to the memory manager.
977 FT_Done_Memory( FT_Memory memory );
979 #endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
982 /* Define default raster's interface. The default raster is located in */
983 /* `src/base/ftraster.c'. */
985 /* Client applications can register new rasters through the */
986 /* FT_Set_Raster() API. */
988 #ifndef FT_NO_DEFAULT_RASTER
989 FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster;
993 /**************************************************************************
996 * FT_DEFINE_OUTLINE_FUNCS
999 * Used to initialize an instance of FT_Outline_Funcs struct. The struct
1000 * will be allocated in the global scope (or the scope where the macro is
1003 #define FT_DEFINE_OUTLINE_FUNCS( \
1011 static const FT_Outline_Funcs class_ = \
1022 /**************************************************************************
1025 * FT_DEFINE_RASTER_FUNCS
1028 * Used to initialize an instance of FT_Raster_Funcs struct. The struct
1029 * will be allocated in the global scope (or the scope where the macro is
1032 #define FT_DEFINE_RASTER_FUNCS( \
1040 const FT_Raster_Funcs class_ = \
1052 /**************************************************************************
1058 * The struct will be allocated in the global scope (or the scope where
1059 * the macro is used).
1061 #define FT_DECLARE_GLYPH( class_ ) \
1062 FT_CALLBACK_TABLE const FT_Glyph_Class class_;
1064 #define FT_DEFINE_GLYPH( \
1074 FT_CALLBACK_TABLE_DEF \
1075 const FT_Glyph_Class class_ = \
1088 /**************************************************************************
1091 * FT_DECLARE_RENDERER
1094 * Used to create a forward declaration of a FT_Renderer_Class struct
1098 * FT_DEFINE_RENDERER
1101 * Used to initialize an instance of FT_Renderer_Class struct.
1103 * The struct will be allocated in the global scope (or the scope where
1104 * the macro is used).
1106 #define FT_DECLARE_RENDERER( class_ ) \
1107 FT_EXPORT_VAR( const FT_Renderer_Class ) class_;
1109 #define FT_DEFINE_RENDERER( \
1126 FT_CALLBACK_TABLE_DEF \
1127 const FT_Renderer_Class class_ = \
1129 FT_DEFINE_ROOT_MODULE( flags_, \
1149 /**************************************************************************
1155 * Used to create a forward declaration of a FT_Module_Class struct
1162 * Used to initialize an instance of an FT_Module_Class struct.
1164 * The struct will be allocated in the global scope (or the scope where
1165 * the macro is used).
1168 * FT_DEFINE_ROOT_MODULE
1171 * Used to initialize an instance of an FT_Module_Class struct inside
1172 * another struct that contains it or in a function that initializes that
1173 * containing struct.
1175 #define FT_DECLARE_MODULE( class_ ) \
1177 const FT_Module_Class class_;
1179 #define FT_DEFINE_ROOT_MODULE( \
1204 #define FT_DEFINE_MODULE( \
1215 FT_CALLBACK_TABLE_DEF \
1216 const FT_Module_Class class_ = \
1235 #endif /* FTOBJS_H_ */