ReactOS 0.4.16-dev-981-g80eb313
ftmodapi.h File Reference
#include <ft2build.h>
Include dependency graph for ftmodapi.h:

Go to the source code of this file.

Classes

struct  FT_Module_Class_
 

Macros

#define FT_MODULE_FONT_DRIVER   1 /* this module is a font driver */
 
#define FT_MODULE_RENDERER   2 /* this module is a renderer */
 
#define FT_MODULE_HINTER   4 /* this module is a glyph hinter */
 
#define FT_MODULE_STYLER   8 /* this module is a styler */
 
#define FT_MODULE_DRIVER_SCALABLE   0x100 /* the driver supports */
 
#define FT_MODULE_DRIVER_NO_OUTLINES   0x200 /* the driver does not */
 
#define FT_MODULE_DRIVER_HAS_HINTER   0x400 /* the driver provides its */
 
#define FT_MODULE_DRIVER_HINTS_LIGHTLY   0x800 /* the driver's hinter */
 
#define ft_module_font_driver   FT_MODULE_FONT_DRIVER
 
#define ft_module_renderer   FT_MODULE_RENDERER
 
#define ft_module_hinter   FT_MODULE_HINTER
 
#define ft_module_styler   FT_MODULE_STYLER
 
#define ft_module_driver_scalable   FT_MODULE_DRIVER_SCALABLE
 
#define ft_module_driver_no_outlines   FT_MODULE_DRIVER_NO_OUTLINES
 
#define ft_module_driver_has_hinter   FT_MODULE_DRIVER_HAS_HINTER
 
#define ft_module_driver_hints_lightly   FT_MODULE_DRIVER_HINTS_LIGHTLY
 
#define FT_DEBUG_HOOK_TRUETYPE   0
 

Typedefs

typedef FT_Pointer FT_Module_Interface
 
typedef FT_Error(* FT_Module_Constructor) (FT_Module module)
 
typedef void(* FT_Module_Destructor) (FT_Module module)
 
typedef FT_Module_Interface(* FT_Module_Requester) (FT_Module module, const char *name)
 
typedef struct FT_Module_Class_ FT_Module_Class
 
typedef void(* FT_DebugHook_Func) (void *arg)
 
typedef enum FT_TrueTypeEngineType_ FT_TrueTypeEngineType
 

Enumerations

enum  FT_TrueTypeEngineType_ { FT_TRUETYPE_ENGINE_TYPE_NONE = 0 , FT_TRUETYPE_ENGINE_TYPE_UNPATENTED , FT_TRUETYPE_ENGINE_TYPE_PATENTED }
 

Functions

 FT_Add_Module (FT_Library library, const FT_Module_Class *clazz)
 
 FT_Get_Module (FT_Library library, const char *module_name)
 
 FT_Remove_Module (FT_Library library, FT_Module module)
 
 FT_Property_Set (FT_Library library, const FT_String *module_name, const FT_String *property_name, const void *value)
 
 FT_Property_Get (FT_Library library, const FT_String *module_name, const FT_String *property_name, void *value)
 
 FT_Set_Default_Properties (FT_Library library)
 
 FT_Reference_Library (FT_Library library)
 
 FT_New_Library (FT_Memory memory, FT_Library *alibrary)
 
 FT_Done_Library (FT_Library library)
 
 FT_Set_Debug_Hook (FT_Library library, FT_UInt hook_index, FT_DebugHook_Func debug_hook)
 
 FT_Add_Default_Modules (FT_Library library)
 
 FT_Get_TrueType_Engine_Type (FT_Library library)
 

Macro Definition Documentation

◆ FT_DEBUG_HOOK_TRUETYPE

#define FT_DEBUG_HOOK_TRUETYPE   0

Definition at line 642 of file ftmodapi.h.

◆ FT_MODULE_DRIVER_HAS_HINTER

#define FT_MODULE_DRIVER_HAS_HINTER   0x400 /* the driver provides its */

Definition at line 119 of file ftmodapi.h.

◆ ft_module_driver_has_hinter

#define ft_module_driver_has_hinter   FT_MODULE_DRIVER_HAS_HINTER

Definition at line 133 of file ftmodapi.h.

◆ FT_MODULE_DRIVER_HINTS_LIGHTLY

#define FT_MODULE_DRIVER_HINTS_LIGHTLY   0x800 /* the driver's hinter */

Definition at line 121 of file ftmodapi.h.

◆ ft_module_driver_hints_lightly

#define ft_module_driver_hints_lightly   FT_MODULE_DRIVER_HINTS_LIGHTLY

Definition at line 134 of file ftmodapi.h.

◆ FT_MODULE_DRIVER_NO_OUTLINES

#define FT_MODULE_DRIVER_NO_OUTLINES   0x200 /* the driver does not */

Definition at line 117 of file ftmodapi.h.

◆ ft_module_driver_no_outlines

#define ft_module_driver_no_outlines   FT_MODULE_DRIVER_NO_OUTLINES

Definition at line 132 of file ftmodapi.h.

◆ FT_MODULE_DRIVER_SCALABLE

#define FT_MODULE_DRIVER_SCALABLE   0x100 /* the driver supports */

Definition at line 115 of file ftmodapi.h.

◆ ft_module_driver_scalable

#define ft_module_driver_scalable   FT_MODULE_DRIVER_SCALABLE

Definition at line 131 of file ftmodapi.h.

◆ FT_MODULE_FONT_DRIVER

#define FT_MODULE_FONT_DRIVER   1 /* this module is a font driver */

Definition at line 110 of file ftmodapi.h.

◆ ft_module_font_driver

#define ft_module_font_driver   FT_MODULE_FONT_DRIVER

Definition at line 126 of file ftmodapi.h.

◆ FT_MODULE_HINTER

#define FT_MODULE_HINTER   4 /* this module is a glyph hinter */

Definition at line 112 of file ftmodapi.h.

◆ ft_module_hinter

#define ft_module_hinter   FT_MODULE_HINTER

Definition at line 128 of file ftmodapi.h.

◆ FT_MODULE_RENDERER

#define FT_MODULE_RENDERER   2 /* this module is a renderer */

Definition at line 111 of file ftmodapi.h.

◆ ft_module_renderer

#define ft_module_renderer   FT_MODULE_RENDERER

Definition at line 127 of file ftmodapi.h.

◆ FT_MODULE_STYLER

#define FT_MODULE_STYLER   8 /* this module is a styler */

Definition at line 113 of file ftmodapi.h.

◆ ft_module_styler

#define ft_module_styler   FT_MODULE_STYLER

Definition at line 129 of file ftmodapi.h.

Typedef Documentation

◆ FT_DebugHook_Func

typedef void(* FT_DebugHook_Func) (void *arg)

Definition at line 626 of file ftmodapi.h.

◆ FT_Module_Class

◆ FT_Module_Constructor

typedef FT_Error(* FT_Module_Constructor) (FT_Module module)

Definition at line 152 of file ftmodapi.h.

◆ FT_Module_Destructor

typedef void(* FT_Module_Destructor) (FT_Module module)

Definition at line 168 of file ftmodapi.h.

◆ FT_Module_Interface

Definition at line 137 of file ftmodapi.h.

◆ FT_Module_Requester

typedef FT_Module_Interface(* FT_Module_Requester) (FT_Module module, const char *name)

Definition at line 187 of file ftmodapi.h.

◆ FT_TrueTypeEngineType

Enumeration Type Documentation

◆ FT_TrueTypeEngineType_

Enumerator
FT_TRUETYPE_ENGINE_TYPE_NONE 
FT_TRUETYPE_ENGINE_TYPE_UNPATENTED 
FT_TRUETYPE_ENGINE_TYPE_PATENTED 

Definition at line 745 of file ftmodapi.h.

746 {
750
@ FT_TRUETYPE_ENGINE_TYPE_NONE
Definition: ftmodapi.h:747
@ FT_TRUETYPE_ENGINE_TYPE_PATENTED
Definition: ftmodapi.h:749
@ FT_TRUETYPE_ENGINE_TYPE_UNPATENTED
Definition: ftmodapi.h:748
enum FT_TrueTypeEngineType_ FT_TrueTypeEngineType

Function Documentation

◆ FT_Add_Default_Modules()

FT_Add_Default_Modules ( FT_Library  library)

Definition at line 80 of file ftinit.c.

81 {
83 const FT_Module_Class* const* cur;
84
85
86 /* GCC 4.6 warns the type difference:
87 * FT_Module_Class** != const FT_Module_Class* const*
88 */
89 cur = (const FT_Module_Class* const*)ft_default_modules;
90
91 /* test for valid `library' delayed to FT_Add_Module() */
92 while ( *cur )
93 {
95 /* notify errors, but don't stop */
96 if ( error )
97 FT_TRACE0(( "FT_Add_Default_Module:"
98 " Cannot install `%s', error = 0x%x\n",
99 (*cur)->module_name, error ));
100 cur++;
101 }
102 }
FT_Library library
Definition: cffdrivr.c:661
#define FT_TRACE0(varformat)
Definition: ftdebug.h:185
static const FT_Module_Class *const ft_default_modules[]
Definition: ftinit.c:70
FT_Add_Module(FT_Library library, const FT_Module_Class *clazz)
Definition: ftobjs.c:4851
int FT_Error
Definition: fttypes.h:299
FxCollectionEntry * cur
#define error(str)
Definition: mkdosfs.c:1605

Referenced by FT_Init_FreeType().

◆ FT_Add_Module()

FT_Add_Module ( FT_Library  library,
const FT_Module_Class clazz 
)

Definition at line 4851 of file ftobjs.c.

4853 {
4857 FT_UInt nn;
4858
4859
4860#define FREETYPE_VER_FIXED ( ( (FT_Long)FREETYPE_MAJOR << 16 ) | \
4861 FREETYPE_MINOR )
4862
4863 if ( !library )
4864 return FT_THROW( Invalid_Library_Handle );
4865
4866 if ( !clazz )
4867 return FT_THROW( Invalid_Argument );
4868
4869 /* check FreeType version */
4870 if ( clazz->module_requires > FREETYPE_VER_FIXED )
4871 return FT_THROW( Invalid_Version );
4872
4873 /* look for a module with the same name in the library's table */
4874 for ( nn = 0; nn < library->num_modules; nn++ )
4875 {
4876 module = library->modules[nn];
4877 if ( ft_strcmp( module->clazz->module_name, clazz->module_name ) == 0 )
4878 {
4879 /* this installed module has the same name, compare their versions */
4880 if ( clazz->module_version <= module->clazz->module_version )
4881 return FT_THROW( Lower_Module_Version );
4882
4883 /* remove the module from our list, then exit the loop to replace */
4884 /* it by our new version.. */
4886 break;
4887 }
4888 }
4889
4891 error = FT_Err_Ok;
4892
4894 {
4895 error = FT_THROW( Too_Many_Drivers );
4896 goto Exit;
4897 }
4898
4899 /* allocate module object */
4900 if ( FT_ALLOC( module, clazz->module_size ) )
4901 goto Exit;
4902
4903 /* base initialization */
4904 module->library = library;
4905 module->memory = memory;
4906 module->clazz = (FT_Module_Class*)clazz;
4907
4908 /* check whether the module is a renderer - this must be performed */
4909 /* before the normal module initialization */
4911 {
4912 /* add to the renderers list */
4914 if ( error )
4915 goto Fail;
4916 }
4917
4918 /* is the module a auto-hinter? */
4919 if ( FT_MODULE_IS_HINTER( module ) )
4921
4922 /* if the module is a font driver */
4923 if ( FT_MODULE_IS_DRIVER( module ) )
4924 {
4926
4927
4928 driver->clazz = (FT_Driver_Class)module->clazz;
4929 }
4930
4931 if ( clazz->module_init )
4932 {
4933 error = clazz->module_init( module );
4934 if ( error )
4935 goto Fail;
4936 }
4937
4938 /* add module to the library's table */
4940
4941 Exit:
4942 return error;
4943
4944 Fail:
4946 {
4947 FT_Renderer renderer = FT_RENDERER( module );
4948
4949
4950 if ( renderer->clazz &&
4952 renderer->raster )
4953 renderer->clazz->raster_class->raster_done( renderer->raster );
4954 }
4955
4956 FT_FREE( module );
4957 goto Exit;
4958 }
#define NULL
Definition: types.h:112
int Fail
Definition: ehthrow.cxx:24
return FT_Err_Ok
Definition: ftbbox.c:527
#define FT_THROW(e)
Definition: ftdebug.h:241
struct FT_Driver_ClassRec_ * FT_Driver_Class
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:302
#define FT_FREE(ptr)
Definition: ftmemory.h:328
FT_Remove_Module(FT_Library library, FT_Module module)
Definition: ftobjs.c:5054
static FT_Error ft_add_renderer(FT_Module module)
Definition: ftobjs.c:4375
#define FREETYPE_VER_FIXED
#define FT_MODULE_IS_RENDERER(x)
Definition: ftobjs.h:520
#define FT_DRIVER(x)
Definition: ftobjs.h:771
#define FT_MODULE_IS_DRIVER(x)
Definition: ftobjs.h:517
#define FT_MODULE_IS_HINTER(x)
Definition: ftobjs.h:523
#define FT_RENDERER(x)
Definition: ftobjs.h:737
#define FT_MAX_MODULES
Definition: ftoption.h:403
smooth FT_Module_Constructor FT_Module_Destructor FT_Module_Requester FT_GLYPH_FORMAT_OUTLINE
Definition: ftsmooth.c:465
#define ft_strcmp
Definition: ftstdlib.h:86
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:65
unsigned int FT_UInt
Definition: fttypes.h:231
static char memory[1024 *256]
Definition: process.c:116
struct @1709::@1710 driver
static void Exit(void)
Definition: sock.c:1330
FT_Module auto_hinter
Definition: ftobjs.h:908
FT_Module modules[FT_MAX_MODULES]
Definition: ftobjs.h:904
FT_UInt num_modules
Definition: ftobjs.h:903
FT_Memory memory
Definition: ftobjs.h:897
FT_Fixed module_requires
Definition: ftmodapi.h:239
FT_Long module_size
Definition: ftmodapi.h:236
FT_Fixed module_version
Definition: ftmodapi.h:238
FT_Module_Constructor module_init
Definition: ftmodapi.h:243
const FT_String * module_name
Definition: ftmodapi.h:237
FT_Raster_DoneFunc raster_done
Definition: ftimage.h:1223
FT_Renderer_Class * clazz
Definition: ftobjs.h:746
FT_Raster raster
Definition: ftobjs.h:750
FT_Glyph_Format glyph_format
Definition: ftrender.h:155
FT_Raster_Funcs * raster_class
Definition: ftrender.h:162

Referenced by FT_Add_Default_Modules().

◆ FT_Done_Library()

FT_Done_Library ( FT_Library  library)

Definition at line 5333 of file ftobjs.c.

5334 {
5336
5337
5338 if ( !library )
5339 return FT_THROW( Invalid_Library_Handle );
5340
5341 library->refcount--;
5342 if ( library->refcount > 0 )
5343 goto Exit;
5344
5346
5347 /*
5348 * Close all faces in the library. If we don't do this, we can have
5349 * some subtle memory leaks.
5350 *
5351 * Example:
5352 *
5353 * - the cff font driver uses the pshinter module in cff_size_done
5354 * - if the pshinter module is destroyed before the cff font driver,
5355 * opened FT_Face objects managed by the driver are not properly
5356 * destroyed, resulting in a memory leak
5357 *
5358 * Some faces are dependent on other faces, like Type42 faces that
5359 * depend on TrueType faces synthesized internally.
5360 *
5361 * The order of drivers should be specified in driver_name[].
5362 */
5363 {
5364 FT_UInt m, n;
5365 const char* driver_name[] = { "type42", NULL };
5366
5367
5368 for ( m = 0;
5369 m < sizeof ( driver_name ) / sizeof ( driver_name[0] );
5370 m++ )
5371 {
5372 for ( n = 0; n < library->num_modules; n++ )
5373 {
5375 const char* module_name = module->clazz->module_name;
5376 FT_List faces;
5377
5378
5379 if ( driver_name[m] &&
5380 ft_strcmp( module_name, driver_name[m] ) != 0 )
5381 continue;
5382
5383 if ( ( module->clazz->module_flags & FT_MODULE_FONT_DRIVER ) == 0 )
5384 continue;
5385
5386 FT_TRACE7(( "FT_Done_Library: close faces for %s\n", module_name ));
5387
5388 faces = &FT_DRIVER( module )->faces_list;
5389 while ( faces->head )
5390 {
5391 FT_Done_Face( FT_FACE( faces->head->data ) );
5392 if ( faces->head )
5393 FT_TRACE0(( "FT_Done_Library: failed to free some faces\n" ));
5394 }
5395 }
5396 }
5397 }
5398
5399 /* Close all other modules in the library */
5400#if 1
5401 /* XXX Modules are removed in the reversed order so that */
5402 /* type42 module is removed before truetype module. This */
5403 /* avoids double free in some occasions. It is a hack. */
5404 while ( library->num_modules > 0 )
5407#else
5408 {
5409 FT_UInt n;
5410
5411
5412 for ( n = 0; n < library->num_modules; n++ )
5413 {
5415
5416
5417 if ( module )
5418 {
5420 library->modules[n] = NULL;
5421 }
5422 }
5423 }
5424#endif
5425
5426 FT_FREE( library );
5427
5428 Exit:
5429 return FT_Err_Ok;
5430 }
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:170
#define FT_TRACE7(varformat)
Definition: ftdebug.h:192
#define FT_MODULE_FONT_DRIVER
Definition: ftmodapi.h:110
FT_Done_Face(FT_Face face)
Definition: ftobjs.c:2765
static void Destroy_Module(FT_Module module)
Definition: ftobjs.c:4821
#define FT_FACE(x)
Definition: ftobjs.h:599
GLdouble n
Definition: glext.h:7729
const GLfloat * m
Definition: glext.h:10848
FT_Int refcount
Definition: ftobjs.h:919
void * data
Definition: fttypes.h:559
FT_ListNode head
Definition: fttypes.h:582

Referenced by FreeFontSupport(), and FT_Done_FreeType().

◆ FT_Get_Module()

FT_Get_Module ( FT_Library  library,
const char module_name 
)

Definition at line 4964 of file ftobjs.c.

4966 {
4968 FT_Module* cur;
4970
4971
4972 if ( !library || !module_name )
4973 return result;
4974
4975 cur = library->modules;
4977
4978 for ( ; cur < limit; cur++ )
4979 if ( ft_strcmp( cur[0]->clazz->module_name, module_name ) == 0 )
4980 {
4981 result = cur[0];
4982 break;
4983 }
4984
4985 return result;
4986 }
GLint limit
Definition: glext.h:10326
GLuint64EXT * result
Definition: glext.h:11304

Referenced by cff_get_glyph_name(), cff_get_interface(), cff_get_name_index(), cff_size_get_globals_funcs(), cff_slot_init(), cid_size_get_globals_funcs(), cid_slot_init(), FT_DEFINE_SERVICE_PSINFOREC(), FT_Get_Module_Interface(), FT_Get_TrueType_Engine_Type(), if(), sfnt_init_face(), T1_GlyphSlot_Init(), T1_Size_Get_Globals_Funcs(), T42_Driver_Init(), T42_Face_Init(), and tt_get_interface().

◆ FT_Get_TrueType_Engine_Type()

FT_Get_TrueType_Engine_Type ( FT_Library  library)

Definition at line 5450 of file ftobjs.c.

5451 {
5453
5454
5455 if ( library )
5456 {
5457 FT_Module module = FT_Get_Module( library, "truetype" );
5458
5459
5460 if ( module )
5461 {
5462 FT_Service_TrueTypeEngine service;
5463
5464
5465 service = (FT_Service_TrueTypeEngine)
5468 0 );
5469 if ( service )
5470 result = service->engine_type;
5471 }
5472 }
5473
5474 return result;
5475 }
ft_module_get_service(FT_Module module, const char *service_id, FT_Bool global)
Definition: ftobjs.c:5007
FT_Get_Module(FT_Library library, const char *module_name)
Definition: ftobjs.c:4964
#define FT_SERVICE_ID_TRUETYPE_ENGINE
Definition: svtteng.h:33

◆ FT_New_Library()

FT_New_Library ( FT_Memory  memory,
FT_Library alibrary 
)

Definition at line 5265 of file ftobjs.c.

5267 {
5270
5271
5272 if ( !memory || !alibrary )
5273 return FT_THROW( Invalid_Argument );
5274
5275#ifdef FT_DEBUG_LEVEL_ERROR
5276 /* init debugging support */
5277 ft_debug_init();
5278#endif
5279
5280 /* first of all, allocate the library object */
5281 if ( FT_NEW( library ) )
5282 return error;
5283
5285
5289
5290 library->refcount = 1;
5291
5292 /* That's ok now */
5293 *alibrary = library;
5294
5295 return FT_Err_Ok;
5296 }
#define FREETYPE_PATCH
Definition: freetype.h:4777
#define FREETYPE_MAJOR
Definition: freetype.h:4775
#define FREETYPE_MINOR
Definition: freetype.h:4776
ft_debug_init(void)
Definition: ftdebug.c:282
#define FT_NEW(ptr)
Definition: ftmemory.h:330
FT_Int version_minor
Definition: ftobjs.h:900
FT_Int version_major
Definition: ftobjs.h:899
FT_Int version_patch
Definition: ftobjs.h:901

Referenced by FT_Init_FreeType().

◆ FT_Property_Get()

FT_Property_Get ( FT_Library  library,
const FT_String module_name,
const FT_String property_name,
void value 
)

Definition at line 5199 of file ftobjs.c.

5203 {
5204 return ft_property_do( library,
5206 property_name,
5207 value,
5208 FALSE,
5209 FALSE );
5210 }
#define FALSE
Definition: types.h:117
static FT_Error ft_property_do(FT_Library library, const FT_String *module_name, const FT_String *property_name, void *value, FT_Bool set, FT_Bool value_is_string)
Definition: ftobjs.c:5094
Definition: pdh_main.c:96

◆ FT_Property_Set()

FT_Property_Set ( FT_Library  library,
const FT_String module_name,
const FT_String property_name,
const void value 
)

Definition at line 5182 of file ftobjs.c.

5186 {
5187 return ft_property_do( library,
5189 property_name,
5190 (void*)value,
5191 TRUE,
5192 FALSE );
5193 }
#define TRUE
Definition: types.h:120

◆ FT_Reference_Library()

FT_Reference_Library ( FT_Library  library)

Definition at line 5251 of file ftobjs.c.

5252 {
5253 if ( !library )
5254 return FT_THROW( Invalid_Library_Handle );
5255
5256 library->refcount++;
5257
5258 return FT_Err_Ok;
5259 }

◆ FT_Remove_Module()

FT_Remove_Module ( FT_Library  library,
FT_Module  module 
)

Definition at line 5054 of file ftobjs.c.

5056 {
5057 /* try to find the module from the table, then remove it from there */
5058
5059 if ( !library )
5060 return FT_THROW( Invalid_Library_Handle );
5061
5062 if ( module )
5063 {
5066
5067
5068 for ( ; cur < limit; cur++ )
5069 {
5070 if ( cur[0] == module )
5071 {
5072 /* remove it from the table */
5074 limit--;
5075 while ( cur < limit )
5076 {
5077 cur[0] = cur[1];
5078 cur++;
5079 }
5080 limit[0] = NULL;
5081
5082 /* destroy the module */
5084
5085 return FT_Err_Ok;
5086 }
5087 }
5088 }
5089 return FT_THROW( Invalid_Driver_Handle );
5090 }

Referenced by FT_Add_Module(), and FT_Done_Library().

◆ FT_Set_Debug_Hook()

FT_Set_Debug_Hook ( FT_Library  library,
FT_UInt  hook_index,
FT_DebugHook_Func  debug_hook 
)

Definition at line 5436 of file ftobjs.c.

5439 {
5440 if ( library && debug_hook &&
5441 hook_index <
5442 ( sizeof ( library->debug_hooks ) / sizeof ( void* ) ) )
5443 library->debug_hooks[hook_index] = debug_hook;
5444 }
FT_DebugHook_Func debug_hooks[4]
Definition: ftobjs.h:910
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

◆ FT_Set_Default_Properties()

FT_Set_Default_Properties ( FT_Library  library)

Definition at line 185 of file ftinit.c.

186 {
188 }
#define FT_UNUSED(arg)
Definition: ftconfig.h:100

Referenced by FT_Init_FreeType().