ReactOS 0.4.16-dev-2332-g4cba65d
ftmodapi.h File Reference
Include dependency graph for ftmodapi.h:
This graph shows which files directly or indirectly include this file:

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 FT_Error(* 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 641 of file ftmodapi.h.

◆ FT_MODULE_DRIVER_HAS_HINTER

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

Definition at line 118 of file ftmodapi.h.

◆ ft_module_driver_has_hinter

#define ft_module_driver_has_hinter   FT_MODULE_DRIVER_HAS_HINTER

Definition at line 132 of file ftmodapi.h.

◆ FT_MODULE_DRIVER_HINTS_LIGHTLY

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

Definition at line 120 of file ftmodapi.h.

◆ ft_module_driver_hints_lightly

#define ft_module_driver_hints_lightly   FT_MODULE_DRIVER_HINTS_LIGHTLY

Definition at line 133 of file ftmodapi.h.

◆ FT_MODULE_DRIVER_NO_OUTLINES

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

Definition at line 116 of file ftmodapi.h.

◆ ft_module_driver_no_outlines

#define ft_module_driver_no_outlines   FT_MODULE_DRIVER_NO_OUTLINES

Definition at line 131 of file ftmodapi.h.

◆ FT_MODULE_DRIVER_SCALABLE

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

Definition at line 114 of file ftmodapi.h.

◆ ft_module_driver_scalable

#define ft_module_driver_scalable   FT_MODULE_DRIVER_SCALABLE

Definition at line 130 of file ftmodapi.h.

◆ FT_MODULE_FONT_DRIVER

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

Definition at line 109 of file ftmodapi.h.

◆ ft_module_font_driver

#define ft_module_font_driver   FT_MODULE_FONT_DRIVER

Definition at line 125 of file ftmodapi.h.

◆ FT_MODULE_HINTER

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

Definition at line 111 of file ftmodapi.h.

◆ ft_module_hinter

#define ft_module_hinter   FT_MODULE_HINTER

Definition at line 127 of file ftmodapi.h.

◆ FT_MODULE_RENDERER

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

Definition at line 110 of file ftmodapi.h.

◆ ft_module_renderer

#define ft_module_renderer   FT_MODULE_RENDERER

Definition at line 126 of file ftmodapi.h.

◆ FT_MODULE_STYLER

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

Definition at line 112 of file ftmodapi.h.

◆ ft_module_styler

#define ft_module_styler   FT_MODULE_STYLER

Definition at line 128 of file ftmodapi.h.

Typedef Documentation

◆ FT_DebugHook_Func

typedef FT_Error(* FT_DebugHook_Func) (void *arg)

Definition at line 625 of file ftmodapi.h.

◆ FT_Module_Class

◆ FT_Module_Constructor

typedef FT_Error(* FT_Module_Constructor) (FT_Module module)

Definition at line 151 of file ftmodapi.h.

◆ FT_Module_Destructor

typedef void(* FT_Module_Destructor) (FT_Module module)

Definition at line 167 of file ftmodapi.h.

◆ FT_Module_Interface

Definition at line 136 of file ftmodapi.h.

◆ FT_Module_Requester

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

Definition at line 186 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 744 of file ftmodapi.h.

745 {
749
@ FT_TRUETYPE_ENGINE_TYPE_NONE
Definition: ftmodapi.h:746
@ FT_TRUETYPE_ENGINE_TYPE_PATENTED
Definition: ftmodapi.h:748
@ FT_TRUETYPE_ENGINE_TYPE_UNPATENTED
Definition: ftmodapi.h:747
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:660
#define FT_TRACE0(varformat)
Definition: ftdebug.h:187
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:4871
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 4871 of file ftobjs.c.

4873 {
4877 FT_UInt nn;
4878
4879
4880#define FREETYPE_VER_FIXED ( ( (FT_Long)FREETYPE_MAJOR << 16 ) | \
4881 FREETYPE_MINOR )
4882
4883 if ( !library )
4884 return FT_THROW( Invalid_Library_Handle );
4885
4886 if ( !clazz )
4887 return FT_THROW( Invalid_Argument );
4888
4889 /* check FreeType version */
4890 if ( clazz->module_requires > FREETYPE_VER_FIXED )
4891 return FT_THROW( Invalid_Version );
4892
4893 /* look for a module with the same name in the library's table */
4894 for ( nn = 0; nn < library->num_modules; nn++ )
4895 {
4896 module = library->modules[nn];
4897 if ( ft_strcmp( module->clazz->module_name, clazz->module_name ) == 0 )
4898 {
4899 /* this installed module has the same name, compare their versions */
4900 if ( clazz->module_version <= module->clazz->module_version )
4901 return FT_THROW( Lower_Module_Version );
4902
4903 /* remove the module from our list, then exit the loop to replace */
4904 /* it by our new version.. */
4906 break;
4907 }
4908 }
4909
4911 error = FT_Err_Ok;
4912
4914 {
4915 error = FT_THROW( Too_Many_Drivers );
4916 goto Exit;
4917 }
4918
4919 /* allocate module object */
4920 if ( FT_ALLOC( module, clazz->module_size ) )
4921 goto Exit;
4922
4923 /* base initialization */
4924 module->library = library;
4925 module->memory = memory;
4926 module->clazz = (FT_Module_Class*)clazz;
4927
4928 /* check whether the module is a renderer - this must be performed */
4929 /* before the normal module initialization */
4931 {
4932 /* add to the renderers list */
4934 if ( error )
4935 goto Fail;
4936 }
4937
4938 /* is the module a auto-hinter? */
4939 if ( FT_MODULE_IS_HINTER( module ) )
4941
4942 /* if the module is a font driver */
4943 if ( FT_MODULE_IS_DRIVER( module ) )
4944 {
4946
4947
4948 driver->clazz = (FT_Driver_Class)module->clazz;
4949 }
4950
4951 if ( clazz->module_init )
4952 {
4953 error = clazz->module_init( module );
4954 if ( error )
4955 goto Fail;
4956 }
4957
4958 /* add module to the library's table */
4960
4961 Exit:
4962 return error;
4963
4964 Fail:
4966 {
4967 FT_Renderer renderer = FT_RENDERER( module );
4968
4969
4970 if ( renderer->clazz &&
4971 renderer->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE &&
4972 renderer->raster )
4973 renderer->clazz->raster_class->raster_done( renderer->raster );
4974 }
4975
4976 FT_FREE( module );
4977 goto Exit;
4978 }
#define NULL
Definition: types.h:112
int Fail
Definition: ehthrow.cxx:24
return FT_Err_Ok
Definition: ftbbox.c:526
#define FT_THROW(e)
Definition: ftdebug.h:243
struct FT_Driver_ClassRec_ * FT_Driver_Class
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:311
#define FT_FREE(ptr)
Definition: ftmemory.h:337
FT_Remove_Module(FT_Library library, FT_Module module)
Definition: ftobjs.c:5074
static FT_Error ft_add_renderer(FT_Module module)
Definition: ftobjs.c:4395
#define FREETYPE_VER_FIXED
#define FT_MODULE_IS_RENDERER(x)
Definition: ftobjs.h:518
#define FT_DRIVER(x)
Definition: ftobjs.h:769
#define FT_MODULE_IS_DRIVER(x)
Definition: ftobjs.h:515
#define FT_MODULE_IS_HINTER(x)
Definition: ftobjs.h:521
#define FT_RENDERER(x)
Definition: ftobjs.h:735
#define FT_MAX_MODULES
Definition: ftoption.h:417
#define ft_strcmp
Definition: ftstdlib.h:86
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:64
unsigned int FT_UInt
Definition: fttypes.h:231
static char memory[1024 *256]
Definition: process.c:122
struct @1789::@1790 driver
static void Exit(void)
Definition: sock.c:1330
FT_Module auto_hinter
Definition: ftobjs.h:906
FT_Module modules[FT_MAX_MODULES]
Definition: ftobjs.h:902
FT_UInt num_modules
Definition: ftobjs.h:901
FT_Memory memory
Definition: ftobjs.h:895
FT_Fixed module_requires
Definition: ftmodapi.h:238
FT_Long module_size
Definition: ftmodapi.h:235
FT_Fixed module_version
Definition: ftmodapi.h:237
FT_Module_Constructor module_init
Definition: ftmodapi.h:242
const FT_String * module_name
Definition: ftmodapi.h:236
FT_Raster_DoneFunc raster_done
Definition: ftimage.h:1234
FT_Renderer_Class * clazz
Definition: ftobjs.h:744
FT_Raster raster
Definition: ftobjs.h:748
FT_Glyph_Format glyph_format
Definition: ftrender.h:154
FT_Raster_Funcs * raster_class
Definition: ftrender.h:161

Referenced by FT_Add_Default_Modules().

◆ FT_Done_Library()

FT_Done_Library ( FT_Library  library)

Definition at line 5353 of file ftobjs.c.

5354 {
5356
5357
5358 if ( !library )
5359 return FT_THROW( Invalid_Library_Handle );
5360
5361 library->refcount--;
5362 if ( library->refcount > 0 )
5363 goto Exit;
5364
5366
5367 /*
5368 * Close all faces in the library. If we don't do this, we can have
5369 * some subtle memory leaks.
5370 *
5371 * Example:
5372 *
5373 * - the cff font driver uses the pshinter module in cff_size_done
5374 * - if the pshinter module is destroyed before the cff font driver,
5375 * opened FT_Face objects managed by the driver are not properly
5376 * destroyed, resulting in a memory leak
5377 *
5378 * Some faces are dependent on other faces, like Type42 faces that
5379 * depend on TrueType faces synthesized internally.
5380 *
5381 * The order of drivers should be specified in driver_name[].
5382 */
5383 {
5384 FT_UInt m, n;
5385 const char* driver_name[] = { "type42", NULL };
5386
5387
5388 for ( m = 0;
5389 m < sizeof ( driver_name ) / sizeof ( driver_name[0] );
5390 m++ )
5391 {
5392 for ( n = 0; n < library->num_modules; n++ )
5393 {
5395 const char* module_name = module->clazz->module_name;
5396 FT_List faces;
5397
5398
5399 if ( driver_name[m] &&
5400 ft_strcmp( module_name, driver_name[m] ) != 0 )
5401 continue;
5402
5403 if ( ( module->clazz->module_flags & FT_MODULE_FONT_DRIVER ) == 0 )
5404 continue;
5405
5406 FT_TRACE7(( "FT_Done_Library: close faces for %s\n", module_name ));
5407
5408 faces = &FT_DRIVER( module )->faces_list;
5409 while ( faces->head )
5410 {
5411 FT_Done_Face( FT_FACE( faces->head->data ) );
5412 if ( faces->head )
5413 FT_TRACE0(( "FT_Done_Library: failed to free some faces\n" ));
5414 }
5415 }
5416 }
5417 }
5418
5419 /* Close all other modules in the library */
5420#if 1
5421 /* XXX Modules are removed in the reversed order so that */
5422 /* type42 module is removed before truetype module. This */
5423 /* avoids double free in some occasions. It is a hack. */
5424 while ( library->num_modules > 0 )
5427#else
5428 {
5429 FT_UInt n;
5430
5431
5432 for ( n = 0; n < library->num_modules; n++ )
5433 {
5435
5436
5437 if ( module )
5438 {
5440 library->modules[n] = NULL;
5441 }
5442 }
5443 }
5444#endif
5445
5446 FT_FREE( library );
5447
5448 Exit:
5449 return FT_Err_Ok;
5450 }
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:171
#define FT_TRACE7(varformat)
Definition: ftdebug.h:194
#define FT_MODULE_FONT_DRIVER
Definition: ftmodapi.h:109
FT_Done_Face(FT_Face face)
Definition: ftobjs.c:2783
static void Destroy_Module(FT_Module module)
Definition: ftobjs.c:4841
#define FT_FACE(x)
Definition: ftobjs.h:597
GLdouble n
Definition: glext.h:7729
const GLfloat * m
Definition: glext.h:10848
FT_Int refcount
Definition: ftobjs.h:917
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 4984 of file ftobjs.c.

4986 {
4988 FT_Module* cur;
4990
4991
4992 if ( !library || !module_name )
4993 return result;
4994
4995 cur = library->modules;
4997
4998 for ( ; cur < limit; cur++ )
4999 if ( ft_strcmp( cur[0]->clazz->module_name, module_name ) == 0 )
5000 {
5001 result = cur[0];
5002 break;
5003 }
5004
5005 return result;
5006 }
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 5470 of file ftobjs.c.

5471 {
5473
5474
5475 if ( library )
5476 {
5477 FT_Module module = FT_Get_Module( library, "truetype" );
5478
5479
5480 if ( module )
5481 {
5482 FT_Service_TrueTypeEngine service;
5483
5484
5485 service = (FT_Service_TrueTypeEngine)
5488 0 );
5489 if ( service )
5490 result = service->engine_type;
5491 }
5492 }
5493
5494 return result;
5495 }
ft_module_get_service(FT_Module module, const char *service_id, FT_Bool global)
Definition: ftobjs.c:5027
FT_Get_Module(FT_Library library, const char *module_name)
Definition: ftobjs.c:4984
#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 5285 of file ftobjs.c.

5287 {
5290
5291
5292 if ( !memory || !alibrary )
5293 return FT_THROW( Invalid_Argument );
5294
5295#ifdef FT_DEBUG_LEVEL_ERROR
5296 /* init debugging support */
5297 ft_debug_init();
5298#endif
5299
5300 /* first of all, allocate the library object */
5301 if ( FT_NEW( library ) )
5302 return error;
5303
5305
5309
5310 library->refcount = 1;
5311
5312 /* That's ok now */
5313 *alibrary = library;
5314
5315 return FT_Err_Ok;
5316 }
#define FREETYPE_PATCH
Definition: freetype.h:4770
#define FREETYPE_MAJOR
Definition: freetype.h:4768
#define FREETYPE_MINOR
Definition: freetype.h:4769
ft_debug_init(void)
Definition: ftdebug.c:292
#define FT_NEW(ptr)
Definition: ftmemory.h:339
FT_Int version_minor
Definition: ftobjs.h:898
FT_Int version_major
Definition: ftobjs.h:897
FT_Int version_patch
Definition: ftobjs.h:899

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 5219 of file ftobjs.c.

5223 {
5224 return ft_property_do( library,
5226 property_name,
5227 value,
5228 FALSE,
5229 FALSE );
5230 }
#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:5114
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 5202 of file ftobjs.c.

5206 {
5207 return ft_property_do( library,
5209 property_name,
5210 (void*)value,
5211 TRUE,
5212 FALSE );
5213 }
#define TRUE
Definition: types.h:120

◆ FT_Reference_Library()

FT_Reference_Library ( FT_Library  library)

Definition at line 5271 of file ftobjs.c.

5272 {
5273 if ( !library )
5274 return FT_THROW( Invalid_Library_Handle );
5275
5276 library->refcount++;
5277
5278 return FT_Err_Ok;
5279 }

◆ FT_Remove_Module()

FT_Remove_Module ( FT_Library  library,
FT_Module  module 
)

Definition at line 5074 of file ftobjs.c.

5076 {
5077 /* try to find the module from the table, then remove it from there */
5078
5079 if ( !library )
5080 return FT_THROW( Invalid_Library_Handle );
5081
5082 if ( module )
5083 {
5086
5087
5088 for ( ; cur < limit; cur++ )
5089 {
5090 if ( cur[0] == module )
5091 {
5092 /* remove it from the table */
5094 limit--;
5095 while ( cur < limit )
5096 {
5097 cur[0] = cur[1];
5098 cur++;
5099 }
5100 limit[0] = NULL;
5101
5102 /* destroy the module */
5104
5105 return FT_Err_Ok;
5106 }
5107 }
5108 }
5109 return FT_THROW( Invalid_Driver_Handle );
5110 }

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 5456 of file ftobjs.c.

5459 {
5460 if ( library && debug_hook &&
5461 hook_index <
5462 ( sizeof ( library->debug_hooks ) / sizeof ( void* ) ) )
5463 library->debug_hooks[hook_index] = debug_hook;
5464 }
FT_DebugHook_Func debug_hooks[4]
Definition: ftobjs.h:908
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

◆ FT_Set_Default_Properties()

FT_Set_Default_Properties ( FT_Library  library)

Definition at line 188 of file ftinit.c.

189 {
191 }
#define FT_UNUSED(arg)

Referenced by FT_Init_FreeType().