1 /****************************************************************************
5 * The FreeType private base classes (specification).
7 * Copyright (C) 1996-2020 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
423 typedef struct FT_Slot_InternalRec_
425 FT_GlyphLoader loader;
427 FT_Bool glyph_transformed;
428 FT_Matrix glyph_matrix;
429 FT_Vector glyph_delta;
434 } FT_GlyphSlot_InternalRec;
437 /**************************************************************************
440 * FT_Size_InternalRec
443 * This structure contains the internal fields of each FT_Size object.
447 * Data specific to a driver module.
450 * The used auto-hinting mode.
452 * autohint_metrics ::
453 * Metrics used by the auto-hinter.
457 typedef struct FT_Size_InternalRec_
461 FT_Render_Mode autohint_mode;
462 FT_Size_Metrics autohint_metrics;
464 } FT_Size_InternalRec;
467 /*************************************************************************/
468 /*************************************************************************/
469 /*************************************************************************/
472 /**** M O D U L E S ****/
475 /*************************************************************************/
476 /*************************************************************************/
477 /*************************************************************************/
480 /**************************************************************************
486 * A module object instance.
490 * A pointer to the module's class.
493 * A handle to the parent library object.
496 * A handle to the memory manager.
498 typedef struct FT_ModuleRec_
500 FT_Module_Class* clazz;
507 /* typecast an object to an FT_Module */
508 #define FT_MODULE( x ) ( (FT_Module)(x) )
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
515 #define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
516 FT_MODULE_FONT_DRIVER )
518 #define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
521 #define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
524 #define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
527 #define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \
528 FT_MODULE_DRIVER_SCALABLE )
530 #define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \
531 FT_MODULE_DRIVER_NO_OUTLINES )
533 #define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
534 FT_MODULE_DRIVER_HAS_HINTER )
536 #define FT_DRIVER_HINTS_LIGHTLY( x ) ( FT_MODULE_CLASS( x )->module_flags & \
537 FT_MODULE_DRIVER_HINTS_LIGHTLY )
540 /**************************************************************************
543 * FT_Get_Module_Interface
546 * Finds a module and returns its specific interface as a typeless
551 * A handle to the library object.
554 * The module's name (as an ASCII string).
557 * A module-specific interface if available, 0 otherwise.
560 * You should better be familiar with FreeType internals to know which
561 * module to look for, and what its interface is :-)
563 FT_BASE( const void* )
564 FT_Get_Module_Interface( FT_Library library,
565 const char* mod_name );
567 FT_BASE( FT_Pointer )
568 ft_module_get_service( FT_Module module,
569 const char* service_id,
572 #ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
574 ft_property_string_set( FT_Library library,
575 const FT_String* module_name,
576 const FT_String* property_name,
583 /*************************************************************************/
584 /*************************************************************************/
585 /*************************************************************************/
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 ****/
591 /*************************************************************************/
592 /*************************************************************************/
593 /*************************************************************************/
595 /* a few macros used to perform easy typecasts with minimal brain damage */
597 #define FT_FACE( x ) ( (FT_Face)(x) )
598 #define FT_SIZE( x ) ( (FT_Size)(x) )
599 #define FT_SLOT( x ) ( (FT_GlyphSlot)(x) )
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
606 #define FT_SIZE_FACE( x ) FT_SIZE( x )->face
607 #define FT_SLOT_FACE( x ) FT_SLOT( x )->face
609 #define FT_FACE_SLOT( x ) FT_FACE( x )->glyph
610 #define FT_FACE_SIZE( x ) FT_FACE( x )->size
613 /**************************************************************************
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.
625 * A handle to a parent face object.
629 * A handle to a new glyph slot object.
632 * FreeType error code. 0 means success.
635 FT_New_GlyphSlot( FT_Face face,
636 FT_GlyphSlot *aslot );
639 /**************************************************************************
645 * Destroys a given glyph slot. Remember however that all slots are
646 * automatically destroyed with its parent. Using this function is not
651 * A handle to a target glyph slot.
654 FT_Done_GlyphSlot( FT_GlyphSlot slot );
658 #define FT_REQUEST_WIDTH( req ) \
659 ( (req)->horiResolution \
660 ? ( (req)->width * (FT_Pos)(req)->horiResolution + 36 ) / 72 \
663 #define FT_REQUEST_HEIGHT( req ) \
664 ( (req)->vertResolution \
665 ? ( (req)->height * (FT_Pos)(req)->vertResolution + 36 ) / 72 \
669 /* Set the metrics according to a bitmap strike. */
671 FT_Select_Metrics( FT_Face face,
672 FT_ULong strike_index );
675 /* Set the metrics according to a size request. */
677 FT_Request_Metrics( FT_Face face,
678 FT_Size_Request req );
681 /* Match a size request against `available_sizes'. */
683 FT_Match_Size( FT_Face face,
685 FT_Bool ignore_width,
686 FT_ULong* size_index );
689 /* Use the horizontal metrics to synthesize the vertical metrics. */
690 /* If `advance' is zero, it is also synthesized. */
692 ft_synthesize_vertical_metrics( FT_Glyph_Metrics* metrics,
696 /* Free the bitmap of a given glyphslot when needed (i.e., only when it */
697 /* was allocated with ft_glyphslot_alloc_bitmap). */
699 ft_glyphslot_free_bitmap( FT_GlyphSlot slot );
702 /* Preset bitmap metrics of an outline glyphslot prior to rendering */
703 /* and check whether the truncated bbox is too large for rendering. */
705 ft_glyphslot_preset_bitmap( FT_GlyphSlot slot,
707 const FT_Vector* origin );
709 /* Allocate a new bitmap buffer in a glyph slot. */
711 ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot,
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. */
718 ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
722 /*************************************************************************/
723 /*************************************************************************/
724 /*************************************************************************/
727 /**** R E N D E R E R S ****/
730 /*************************************************************************/
731 /*************************************************************************/
732 /*************************************************************************/
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) )
741 typedef struct FT_RendererRec_
744 FT_Renderer_Class* clazz;
745 FT_Glyph_Format glyph_format;
746 FT_Glyph_Class glyph_class;
749 FT_Raster_Render_Func raster_render;
750 FT_Renderer_RenderFunc render;
755 /*************************************************************************/
756 /*************************************************************************/
757 /*************************************************************************/
760 /**** F O N T D R I V E R S ****/
763 /*************************************************************************/
764 /*************************************************************************/
765 /*************************************************************************/
768 /* typecast a module into a driver easily */
769 #define FT_DRIVER( x ) ( (FT_Driver)(x) )
771 /* typecast a module as a driver, and get its driver class */
772 #define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz
775 /**************************************************************************
781 * The root font driver class. A font driver is responsible for managing
782 * and loading font files of a given format.
786 * Contains the fields of the root module class.
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++.
793 * The list of faces currently opened by this driver.
796 * Unused. Used to be glyph loader for all faces managed by this
799 typedef struct FT_DriverRec_
802 FT_Driver_Class clazz;
803 FT_ListRec faces_list;
804 FT_GlyphLoader glyph_loader;
809 /*************************************************************************/
810 /*************************************************************************/
811 /*************************************************************************/
814 /**** L I B R A R I E S ****/
817 /*************************************************************************/
818 /*************************************************************************/
819 /*************************************************************************/
822 /**************************************************************************
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.
834 * The library's memory object. Manages memory allocation.
837 * The major version number of the library.
840 * The minor version number of the library.
843 * The current patch level of the library.
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.
851 * A table used to store handles to the currently registered
852 * modules. Note that each font driver contains a list of its opened
856 * The list of renderers currently registered within the library.
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
865 * The auto-hinter module interface.
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.
873 * The LCD filter weights for ClearType-style subpixel rendering.
876 * The LCD filtering callback function for for ClearType-style subpixel
880 * This array specifies LCD subpixel geometry and controls Harmony LCD
881 * rendering technique, alternative to ClearType.
884 * Contains global structs and tables, instead of defining them
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.
893 typedef struct FT_LibraryRec_
895 FT_Memory memory; /* library's memory manager */
897 FT_Int version_major;
898 FT_Int version_minor;
899 FT_Int version_patch;
902 FT_Module modules[FT_MAX_MODULES]; /* module objects */
904 FT_ListRec renderers; /* list of renderers */
905 FT_Renderer cur_renderer; /* current outline renderer */
906 FT_Module auto_hinter;
908 FT_DebugHook_Func debug_hooks[4];
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 */
914 FT_Vector lcd_geometry[3]; /* RGB subpixel positions */
922 FT_BASE( FT_Renderer )
923 FT_Lookup_Renderer( FT_Library library,
924 FT_Glyph_Format format,
928 FT_Render_Glyph_Internal( FT_Library library,
930 FT_Render_Mode render_mode );
933 (*FT_Face_GetPostscriptNameFunc)( FT_Face face );
936 (*FT_Face_GetGlyphNameFunc)( FT_Face face,
939 FT_UInt buffer_max );
942 (*FT_Face_GetGlyphNameIndexFunc)( FT_Face face,
943 const FT_String* glyph_name );
946 #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
948 /**************************************************************************
954 * Creates a new memory object.
957 * A pointer to the new memory object. 0 in case of error.
960 FT_New_Memory( void );
963 /**************************************************************************
969 * Discards memory manager.
973 * A handle to the memory manager.
976 FT_Done_Memory( FT_Memory memory );
978 #endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
981 /* Define default raster's interface. The default raster is located in */
982 /* `src/base/ftraster.c'. */
984 /* Client applications can register new rasters through the */
985 /* FT_Set_Raster() API. */
987 #ifndef FT_NO_DEFAULT_RASTER
988 FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster;
992 /**************************************************************************
995 * FT_DEFINE_OUTLINE_FUNCS
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
1002 #define FT_DEFINE_OUTLINE_FUNCS( \
1010 static const FT_Outline_Funcs class_ = \
1021 /**************************************************************************
1024 * FT_DEFINE_RASTER_FUNCS
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
1031 #define FT_DEFINE_RASTER_FUNCS( \
1039 const FT_Raster_Funcs class_ = \
1051 /**************************************************************************
1057 * The struct will be allocated in the global scope (or the scope where
1058 * the macro is used).
1060 #define FT_DECLARE_GLYPH( class_ ) \
1061 FT_CALLBACK_TABLE const FT_Glyph_Class class_;
1063 #define FT_DEFINE_GLYPH( \
1073 FT_CALLBACK_TABLE_DEF \
1074 const FT_Glyph_Class class_ = \
1087 /**************************************************************************
1090 * FT_DECLARE_RENDERER
1093 * Used to create a forward declaration of a FT_Renderer_Class struct
1097 * FT_DEFINE_RENDERER
1100 * Used to initialize an instance of FT_Renderer_Class struct.
1102 * The struct will be allocated in the global scope (or the scope where
1103 * the macro is used).
1105 #define FT_DECLARE_RENDERER( class_ ) \
1106 FT_EXPORT_VAR( const FT_Renderer_Class ) class_;
1108 #define FT_DEFINE_RENDERER( \
1125 FT_CALLBACK_TABLE_DEF \
1126 const FT_Renderer_Class class_ = \
1128 FT_DEFINE_ROOT_MODULE( flags_, \
1148 /**************************************************************************
1154 * Used to create a forward declaration of a FT_Module_Class struct
1161 * Used to initialize an instance of an FT_Module_Class struct.
1163 * The struct will be allocated in the global scope (or the scope where
1164 * the macro is used).
1167 * FT_DEFINE_ROOT_MODULE
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.
1174 #define FT_DECLARE_MODULE( class_ ) \
1176 const FT_Module_Class class_;
1178 #define FT_DEFINE_ROOT_MODULE( \
1203 #define FT_DEFINE_MODULE( \
1214 FT_CALLBACK_TABLE_DEF \
1215 const FT_Module_Class class_ = \
1234 #endif /* FTOBJS_H_ */