ReactOS 0.4.15-dev-7907-g95bf896
ftobjs.c File Reference
#include <ft2build.h>
Include dependency graph for ftobjs.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GRID_FIT_METRICS
 
#define FT_COMPONENT   trace_objs
 
#define FREETYPE_VER_FIXED
 

Functions

static FT_Error ft_open_face_internal (FT_Library library, const FT_Open_Args *args, FT_Long face_index, FT_Face *aface, FT_Bool test_mac_fonts)
 
 ft_service_list_lookup (FT_ServiceDesc service_descriptors, const char *service_id)
 
 ft_validator_init (FT_Validator valid, const FT_Byte *base, const FT_Byte *limit, FT_ValidationLevel level)
 
 ft_validator_run (FT_Validator valid)
 
 ft_validator_error (FT_Validator valid, FT_Error error)
 
 FT_Stream_New (FT_Library library, const FT_Open_Args *args, FT_Stream *astream)
 
 FT_Stream_Free (FT_Stream stream, FT_Int external)
 
static FT_Error ft_glyphslot_init (FT_GlyphSlot slot)
 
 ft_glyphslot_free_bitmap (FT_GlyphSlot slot)
 
 ft_glyphslot_preset_bitmap (FT_GlyphSlot slot, FT_Render_Mode mode, const FT_Vector *origin)
 
 ft_glyphslot_set_bitmap (FT_GlyphSlot slot, FT_Byte *buffer)
 
 ft_glyphslot_alloc_bitmap (FT_GlyphSlot slot, FT_ULong size)
 
static void ft_glyphslot_clear (FT_GlyphSlot slot)
 
static void ft_glyphslot_done (FT_GlyphSlot slot)
 
 FT_New_GlyphSlot (FT_Face face, FT_GlyphSlot *aslot)
 
 FT_Done_GlyphSlot (FT_GlyphSlot slot)
 
 FT_Set_Transform (FT_Face face, FT_Matrix *matrix, FT_Vector *delta)
 
static FT_Renderer ft_lookup_glyph_renderer (FT_GlyphSlot slot)
 
static void ft_glyphslot_grid_fit_metrics (FT_GlyphSlot slot, FT_Bool vertical)
 
 FT_Load_Glyph (FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
 
 FT_Load_Char (FT_Face face, FT_ULong char_code, FT_Int32 load_flags)
 
static void destroy_size (FT_Memory memory, FT_Size size, FT_Driver driver)
 
static void ft_cmap_done_internal (FT_CMap cmap)
 
static void destroy_charmaps (FT_Face face, FT_Memory memory)
 
static void destroy_face (FT_Memory memory, FT_Face face, FT_Driver driver)
 
static void Destroy_Driver (FT_Driver driver)
 
static FT_Error find_unicode_charmap (FT_Face face)
 
static FT_CharMap find_variant_selector_charmap (FT_Face face)
 
static FT_Error open_face (FT_Driver driver, FT_Stream *astream, FT_Bool external_stream, FT_Long face_index, FT_Int num_params, FT_Parameter *params, FT_Face *aface)
 
 FT_New_Face (FT_Library library, const char *pathname, FT_Long face_index, FT_Face *aface)
 
 FT_New_Memory_Face (FT_Library library, const FT_Byte *file_base, FT_Long file_size, FT_Long face_index, FT_Face *aface)
 
 FT_Open_Face (FT_Library library, const FT_Open_Args *args, FT_Long face_index, FT_Face *aface)
 
 FT_Attach_File (FT_Face face, const char *filepathname)
 
 FT_Attach_Stream (FT_Face face, FT_Open_Args *parameters)
 
 FT_Reference_Face (FT_Face face)
 
 FT_Done_Face (FT_Face face)
 
 FT_New_Size (FT_Face face, FT_Size *asize)
 
 FT_Done_Size (FT_Size size)
 
 FT_Match_Size (FT_Face face, FT_Size_Request req, FT_Bool ignore_width, FT_ULong *size_index)
 
 ft_synthesize_vertical_metrics (FT_Glyph_Metrics *metrics, FT_Pos advance)
 
static void ft_recompute_scaled_metrics (FT_Face face, FT_Size_Metrics *metrics)
 
 FT_Select_Metrics (FT_Face face, FT_ULong strike_index)
 
 FT_Request_Metrics (FT_Face face, FT_Size_Request req)
 
 FT_Select_Size (FT_Face face, FT_Int strike_index)
 
 FT_Request_Size (FT_Face face, FT_Size_Request req)
 
 FT_Set_Char_Size (FT_Face face, FT_F26Dot6 char_width, FT_F26Dot6 char_height, FT_UInt horz_resolution, FT_UInt vert_resolution)
 
 FT_Set_Pixel_Sizes (FT_Face face, FT_UInt pixel_width, FT_UInt pixel_height)
 
 FT_Get_Kerning (FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
 
 FT_Get_Track_Kerning (FT_Face face, FT_Fixed point_size, FT_Int degree, FT_Fixed *akerning)
 
 FT_Select_Charmap (FT_Face face, FT_Encoding encoding)
 
 FT_Set_Charmap (FT_Face face, FT_CharMap charmap)
 
 FT_Get_Charmap_Index (FT_CharMap charmap)
 
 FT_CMap_Done (FT_CMap cmap)
 
 FT_CMap_New (FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
 
 FT_Get_Char_Index (FT_Face face, FT_ULong charcode)
 
 FT_Get_First_Char (FT_Face face, FT_UInt *agindex)
 
 FT_Get_Next_Char (FT_Face face, FT_ULong charcode, FT_UInt *agindex)
 
 FT_Face_Properties (FT_Face face, FT_UInt num_properties, FT_Parameter *properties)
 
 FT_Face_GetCharVariantIndex (FT_Face face, FT_ULong charcode, FT_ULong variantSelector)
 
 FT_Face_GetCharVariantIsDefault (FT_Face face, FT_ULong charcode, FT_ULong variantSelector)
 
 FT_Face_GetVariantSelectors (FT_Face face)
 
 FT_Face_GetVariantsOfChar (FT_Face face, FT_ULong charcode)
 
 FT_Face_GetCharsOfVariant (FT_Face face, FT_ULong variantSelector)
 
 FT_Get_Name_Index (FT_Face face, FT_String *glyph_name)
 
 FT_Get_Glyph_Name (FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max)
 
 FT_Get_Postscript_Name (FT_Face face)
 
 FT_Get_Sfnt_Table (FT_Face face, FT_Sfnt_Tag tag)
 
 FT_Load_Sfnt_Table (FT_Face face, FT_ULong tag, FT_Long offset, FT_Byte *buffer, FT_ULong *length)
 
 FT_Sfnt_Table_Info (FT_Face face, FT_UInt table_index, FT_ULong *tag, FT_ULong *length)
 
 FT_Get_CMap_Language_ID (FT_CharMap charmap)
 
 FT_Get_CMap_Format (FT_CharMap charmap)
 
 FT_Activate_Size (FT_Size size)
 
 FT_Lookup_Renderer (FT_Library library, FT_Glyph_Format format, FT_ListNode *node)
 
static void ft_set_current_renderer (FT_Library library)
 
static FT_Error ft_add_renderer (FT_Module module)
 
static void ft_remove_renderer (FT_Module module)
 
 FT_Get_Renderer (FT_Library library, FT_Glyph_Format format)
 
 FT_Set_Renderer (FT_Library library, FT_Renderer renderer, FT_UInt num_params, FT_Parameter *parameters)
 
 FT_Render_Glyph_Internal (FT_Library library, FT_GlyphSlot slot, FT_Render_Mode render_mode)
 
 FT_Render_Glyph (FT_GlyphSlot slot, FT_Render_Mode render_mode)
 
static void Destroy_Module (FT_Module module)
 
 FT_Add_Module (FT_Library library, const FT_Module_Class *clazz)
 
 FT_Get_Module (FT_Library library, const char *module_name)
 
 FT_Get_Module_Interface (FT_Library library, const char *mod_name)
 
 ft_module_get_service (FT_Module module, const char *service_id, FT_Bool global)
 
 FT_Remove_Module (FT_Library library, FT_Module module)
 
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)
 
 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_Reference_Library (FT_Library library)
 
 FT_New_Library (FT_Memory memory, FT_Library *alibrary)
 
 FT_Library_Version (FT_Library library, FT_Int *amajor, FT_Int *aminor, FT_Int *apatch)
 
 FT_Done_Library (FT_Library library)
 
 FT_Set_Debug_Hook (FT_Library library, FT_UInt hook_index, FT_DebugHook_Func debug_hook)
 
 FT_Get_TrueType_Engine_Type (FT_Library library)
 
 FT_Get_SubGlyph_Info (FT_GlyphSlot glyph, FT_UInt sub_index, FT_Int *p_index, FT_UInt *p_flags, FT_Int *p_arg1, FT_Int *p_arg2, FT_Matrix *p_transform)
 

Macro Definition Documentation

◆ FREETYPE_VER_FIXED

#define FREETYPE_VER_FIXED
Value:
( ( (FT_Long)FREETYPE_MAJOR << 16 ) | \
#define FREETYPE_MAJOR
Definition: freetype.h:4553
#define FREETYPE_MINOR
Definition: freetype.h:4554
signed long FT_Long
Definition: fttypes.h:242

◆ FT_COMPONENT

#define FT_COMPONENT   trace_objs

Definition at line 269 of file ftobjs.c.

◆ GRID_FIT_METRICS

#define GRID_FIT_METRICS

Definition at line 85 of file ftobjs.c.

Function Documentation

◆ destroy_charmaps()

static void destroy_charmaps ( FT_Face  face,
FT_Memory  memory 
)
static

Definition at line 1079 of file ftobjs.c.

1081 {
1082 FT_Int n;
1083
1084
1085 if ( !face )
1086 return;
1087
1088 for ( n = 0; n < face->num_charmaps; n++ )
1089 {
1090 FT_CMap cmap = FT_CMAP( face->charmaps[n] );
1091
1092
1093 ft_cmap_done_internal( cmap );
1094
1095 face->charmaps[n] = NULL;
1096 }
1097
1098 FT_FREE( face->charmaps );
1099 face->num_charmaps = 0;
1100 }
#define NULL
Definition: types.h:112
#define FT_FREE(ptr)
Definition: ftmemory.h:329
static void ft_cmap_done_internal(FT_CMap cmap)
Definition: ftobjs.c:3553
#define FT_CMAP(x)
Definition: ftobjs.h:159
signed int FT_Int
Definition: fttypes.h:220
GLdouble n
Definition: glext.h:7729
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

Referenced by destroy_face(), and open_face().

◆ Destroy_Driver()

static void Destroy_Driver ( FT_Driver  driver)
static

Definition at line 1156 of file ftobjs.c.

1157 {
1158 FT_List_Finalize( &driver->faces_list,
1160 driver->root.memory,
1161 driver );
1162 }
void(* FT_List_Destructor)(FT_Memory memory, void *data, void *user)
Definition: ftlist.h:234
FT_List_Finalize(FT_List list, FT_List_Destructor destroy, FT_Memory memory, void *user)
Definition: ftutil.c:413
static void destroy_face(FT_Memory memory, FT_Face face, FT_Driver driver)
Definition: ftobjs.c:1105
struct @1669::@1670 driver

Referenced by Destroy_Module().

◆ destroy_face()

static void destroy_face ( FT_Memory  memory,
FT_Face  face,
FT_Driver  driver 
)
static

Definition at line 1105 of file ftobjs.c.

1108 {
1109 FT_Driver_Class clazz = driver->clazz;
1110
1111
1112 /* discard auto-hinting data */
1113 if ( face->autohint.finalizer )
1114 face->autohint.finalizer( face->autohint.data );
1115
1116 /* Discard glyph slots for this face. */
1117 /* Beware! FT_Done_GlyphSlot() changes the field `face->glyph' */
1118 while ( face->glyph )
1119 FT_Done_GlyphSlot( face->glyph );
1120
1121 /* discard all sizes for this face */
1122 FT_List_Finalize( &face->sizes_list,
1124 memory,
1125 driver );
1126 face->size = NULL;
1127
1128 /* now discard client data */
1129 if ( face->generic.finalizer )
1130 face->generic.finalizer( face );
1131
1132 /* discard charmaps */
1134
1135 /* finalize format-specific stuff */
1136 if ( clazz->done_face )
1137 clazz->done_face( face );
1138
1139 /* close the stream for this face if needed */
1141 face->stream,
1142 ( face->face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0 );
1143
1144 face->stream = NULL;
1145
1146 /* get rid of it */
1147 if ( face->internal )
1148 {
1149 FT_FREE( face->internal );
1150 }
1151 FT_FREE( face );
1152 }
#define FT_FACE_FLAG_EXTERNAL_STREAM
Definition: freetype.h:1248
static void destroy_charmaps(FT_Face face, FT_Memory memory)
Definition: ftobjs.c:1079
static void destroy_size(FT_Memory memory, FT_Size size, FT_Driver driver)
Definition: ftobjs.c:1057
FT_Stream_Free(FT_Stream stream, FT_Int external)
Definition: ftobjs.c:246
FT_Done_GlyphSlot(FT_GlyphSlot slot)
Definition: ftobjs.c:612
static char memory[1024 *256]
Definition: process.c:116
FT_Face_DoneFunc done_face
Definition: ftdrv.h:166

Referenced by Destroy_Driver(), FT_Done_Face(), and ft_open_face_internal().

◆ Destroy_Module()

static void Destroy_Module ( FT_Module  module)
static

Definition at line 4694 of file ftobjs.c.

4695 {
4696 FT_Memory memory = module->memory;
4697 FT_Module_Class* clazz = module->clazz;
4698 FT_Library library = module->library;
4699
4700
4701 if ( library && library->auto_hinter == module )
4703
4704 /* if the module is a renderer */
4707
4708 /* if the module is a font driver, add some steps */
4709 if ( FT_MODULE_IS_DRIVER( module ) )
4711
4712 /* finalize the module object */
4713 if ( clazz->module_done )
4714 clazz->module_done( module );
4715
4716 /* discard it */
4717 FT_FREE( module );
4718 }
FT_Library library
Definition: cffdrivr.c:654
static void Destroy_Driver(FT_Driver driver)
Definition: ftobjs.c:1156
static void ft_remove_renderer(FT_Module module)
Definition: ftobjs.c:4380
#define FT_MODULE_IS_RENDERER(x)
Definition: ftobjs.h:553
#define FT_DRIVER(x)
Definition: ftobjs.h:799
#define FT_MODULE_IS_DRIVER(x)
Definition: ftobjs.h:550
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
FT_Module auto_hinter
Definition: ftobjs.h:929
FT_Module_Destructor module_done
Definition: ftmodapi.h:228

Referenced by FT_Done_Library(), and FT_Remove_Module().

◆ destroy_size()

static void destroy_size ( FT_Memory  memory,
FT_Size  size,
FT_Driver  driver 
)
static

Definition at line 1057 of file ftobjs.c.

1060 {
1061 /* finalize client-specific data */
1062 if ( size->generic.finalizer )
1063 size->generic.finalizer( size );
1064
1065 /* finalize format-specific stuff */
1066 if ( driver->clazz->done_size )
1067 driver->clazz->done_size( size );
1068
1069 FT_FREE( size->internal );
1070 FT_FREE( size );
1071 }
GLsizeiptr size
Definition: glext.h:5919

Referenced by destroy_face(), and FT_Done_Size().

◆ find_unicode_charmap()

static FT_Error find_unicode_charmap ( FT_Face  face)
static

Definition at line 1180 of file ftobjs.c.

1181 {
1183 FT_CharMap* cur;
1184
1185
1186 /* caller should have already checked that `face' is valid */
1187 FT_ASSERT( face );
1188
1189 first = face->charmaps;
1190
1191 if ( !first )
1192 return FT_THROW( Invalid_CharMap_Handle );
1193
1194 /*
1195 * The original TrueType specification(s) only specified charmap
1196 * formats that are capable of mapping 8 or 16 bit character codes to
1197 * glyph indices.
1198 *
1199 * However, recent updates to the Apple and OpenType specifications
1200 * introduced new formats that are capable of mapping 32-bit character
1201 * codes as well. And these are already used on some fonts, mainly to
1202 * map non-BMP Asian ideographs as defined in Unicode.
1203 *
1204 * For compatibility purposes, these fonts generally come with
1205 * *several* Unicode charmaps:
1206 *
1207 * - One of them in the "old" 16-bit format, that cannot access
1208 * all glyphs in the font.
1209 *
1210 * - Another one in the "new" 32-bit format, that can access all
1211 * the glyphs.
1212 *
1213 * This function has been written to always favor a 32-bit charmap
1214 * when found. Otherwise, a 16-bit one is returned when found.
1215 */
1216
1217 /* Since the `interesting' table, with IDs (3,10), is normally the */
1218 /* last one, we loop backwards. This loses with type1 fonts with */
1219 /* non-BMP characters (<.0001%), this wins with .ttf with non-BMP */
1220 /* chars (.01% ?), and this is the same about 99.99% of the time! */
1221
1222 cur = first + face->num_charmaps; /* points after the last one */
1223
1224 for ( ; --cur >= first; )
1225 {
1226 if ( cur[0]->encoding == FT_ENCODING_UNICODE )
1227 {
1228 /* XXX If some new encodings to represent UCS-4 are added, */
1229 /* they should be added here. */
1230 if ( ( cur[0]->platform_id == TT_PLATFORM_MICROSOFT &&
1231 cur[0]->encoding_id == TT_MS_ID_UCS_4 ) ||
1232 ( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE &&
1233 cur[0]->encoding_id == TT_APPLE_ID_UNICODE_32 ) )
1234 {
1235 face->charmap = cur[0];
1236 return FT_Err_Ok;
1237 }
1238 }
1239 }
1240
1241 /* We do not have any UCS-4 charmap. */
1242 /* Do the loop again and search for UCS-2 charmaps. */
1243 cur = first + face->num_charmaps;
1244
1245 for ( ; --cur >= first; )
1246 {
1247 if ( cur[0]->encoding == FT_ENCODING_UNICODE )
1248 {
1249 face->charmap = cur[0];
1250 return FT_Err_Ok;
1251 }
1252 }
1253
1254 return FT_THROW( Invalid_CharMap_Handle );
1255 }
#define TT_PLATFORM_MICROSOFT
Definition: font.c:1174
#define TT_PLATFORM_APPLE_UNICODE
Definition: font.c:1172
return FT_Err_Ok
Definition: ftbbox.c:511
#define FT_ASSERT(condition)
Definition: ftdebug.h:211
#define FT_THROW(e)
Definition: ftdebug.h:213
FxCollectionEntry * cur
const GLint * first
Definition: glext.h:5794
#define TT_APPLE_ID_UNICODE_32
Definition: ttnameid.h:132
#define TT_MS_ID_UCS_4
Definition: ttnameid.h:255
static char * encoding
Definition: xmllint.c:155

Referenced by FT_Select_Charmap(), and open_face().

◆ find_variant_selector_charmap()

static FT_CharMap find_variant_selector_charmap ( FT_Face  face)
static

Definition at line 1268 of file ftobjs.c.

1269 {
1271 FT_CharMap* end;
1272 FT_CharMap* cur;
1273
1274
1275 /* caller should have already checked that `face' is valid */
1276 FT_ASSERT( face );
1277
1278 first = face->charmaps;
1279
1280 if ( !first )
1281 return NULL;
1282
1283 end = first + face->num_charmaps; /* points after the last one */
1284
1285 for ( cur = first; cur < end; cur++ )
1286 {
1287 if ( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE &&
1288 cur[0]->encoding_id == TT_APPLE_ID_VARIANT_SELECTOR &&
1289 FT_Get_CMap_Format( cur[0] ) == 14 )
1290 return cur[0];
1291 }
1292
1293 return NULL;
1294 }
FT_Get_CMap_Format(FT_CharMap charmap)
Definition: ftobjs.c:4206
GLuint GLuint end
Definition: gl.h:1545
#define TT_APPLE_ID_VARIANT_SELECTOR
Definition: ttnameid.h:133

Referenced by FT_Face_GetCharsOfVariant(), FT_Face_GetCharVariantIndex(), FT_Face_GetCharVariantIsDefault(), FT_Face_GetVariantSelectors(), and FT_Face_GetVariantsOfChar().

◆ FT_Activate_Size()

FT_Activate_Size ( FT_Size  size)

Definition at line 4230 of file ftobjs.c.

4231 {
4232 FT_Face face;
4233
4234
4235 if ( !size )
4236 return FT_THROW( Invalid_Size_Handle );
4237
4238 face = size->face;
4239 if ( !face || !face->driver )
4240 return FT_THROW( Invalid_Face_Handle );
4241
4242 /* we don't need anything more complex than that; all size objects */
4243 /* are already listed by the face */
4244 face->size = size;
4245
4246 return FT_Err_Ok;
4247 }
WORD face[3]
Definition: mesh.c:4747

Referenced by ftc_scaler_lookup_size(), ftc_size_node_compare(), T42_Size_Init(), T42_Size_Request(), and T42_Size_Select().

◆ FT_Add_Module()

FT_Add_Module ( FT_Library  library,
const FT_Module_Class clazz 
)

Definition at line 4724 of file ftobjs.c.

4726 {
4730 FT_UInt nn;
4731
4732
4733#define FREETYPE_VER_FIXED ( ( (FT_Long)FREETYPE_MAJOR << 16 ) | \
4734 FREETYPE_MINOR )
4735
4736 if ( !library )
4737 return FT_THROW( Invalid_Library_Handle );
4738
4739 if ( !clazz )
4740 return FT_THROW( Invalid_Argument );
4741
4742 /* check FreeType version */
4743 if ( clazz->module_requires > FREETYPE_VER_FIXED )
4744 return FT_THROW( Invalid_Version );
4745
4746 /* look for a module with the same name in the library's table */
4747 for ( nn = 0; nn < library->num_modules; nn++ )
4748 {
4749 module = library->modules[nn];
4750 if ( ft_strcmp( module->clazz->module_name, clazz->module_name ) == 0 )
4751 {
4752 /* this installed module has the same name, compare their versions */
4753 if ( clazz->module_version <= module->clazz->module_version )
4754 return FT_THROW( Lower_Module_Version );
4755
4756 /* remove the module from our list, then exit the loop to replace */
4757 /* it by our new version.. */
4759 break;
4760 }
4761 }
4762
4764 error = FT_Err_Ok;
4765
4767 {
4768 error = FT_THROW( Too_Many_Drivers );
4769 goto Exit;
4770 }
4771
4772 /* allocate module object */
4773 if ( FT_ALLOC( module, clazz->module_size ) )
4774 goto Exit;
4775
4776 /* base initialization */
4777 module->library = library;
4778 module->memory = memory;
4779 module->clazz = (FT_Module_Class*)clazz;
4780
4781 /* check whether the module is a renderer - this must be performed */
4782 /* before the normal module initialization */
4784 {
4785 /* add to the renderers list */
4787 if ( error )
4788 goto Fail;
4789 }
4790
4791 /* is the module a auto-hinter? */
4792 if ( FT_MODULE_IS_HINTER( module ) )
4794
4795 /* if the module is a font driver */
4796 if ( FT_MODULE_IS_DRIVER( module ) )
4797 {
4799
4800
4801 driver->clazz = (FT_Driver_Class)module->clazz;
4802 }
4803
4804 if ( clazz->module_init )
4805 {
4806 error = clazz->module_init( module );
4807 if ( error )
4808 goto Fail;
4809 }
4810
4811 /* add module to the library's table */
4813
4814 Exit:
4815 return error;
4816
4817 Fail:
4819 {
4820 FT_Renderer renderer = FT_RENDERER( module );
4821
4822
4823 if ( renderer->clazz &&
4825 renderer->raster )
4826 renderer->clazz->raster_class->raster_done( renderer->raster );
4827 }
4828
4829 FT_FREE( module );
4830 goto Exit;
4831 }
#define FT_MAX_MODULES
Definition: ftoption.h:376
int Fail
Definition: ehthrow.cxx:24
struct FT_Driver_ClassRec_ * FT_Driver_Class
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:303
FT_Remove_Module(FT_Library library, FT_Module module)
Definition: ftobjs.c:4927
static FT_Error ft_add_renderer(FT_Module module)
Definition: ftobjs.c:4332
#define FREETYPE_VER_FIXED
#define FT_MODULE_IS_HINTER(x)
Definition: ftobjs.h:556
#define FT_RENDERER(x)
Definition: ftobjs.h:765
smooth FT_Module_Constructor FT_Module_Destructor FT_Module_Requester FT_GLYPH_FORMAT_OUTLINE
Definition: ftsmooth.c:426
#define ft_strcmp
Definition: ftstdlib.h:86
int FT_Error
Definition: fttypes.h:300
unsigned int FT_UInt
Definition: fttypes.h:231
#define error(str)
Definition: mkdosfs.c:1605
static void Exit(void)
Definition: sock.c:1330
FT_Module modules[FT_MAX_MODULES]
Definition: ftobjs.h:925
FT_UInt num_modules
Definition: ftobjs.h:924
FT_Memory memory
Definition: ftobjs.h:918
FT_Fixed module_requires
Definition: ftmodapi.h:223
FT_Long module_size
Definition: ftmodapi.h:220
FT_Fixed module_version
Definition: ftmodapi.h:222
FT_Module_Constructor module_init
Definition: ftmodapi.h:227
const FT_String * module_name
Definition: ftmodapi.h:221
FT_Raster_DoneFunc raster_done
Definition: ftimage.h:1188
FT_Renderer_Class * clazz
Definition: ftobjs.h:774
FT_Raster raster
Definition: ftobjs.h:778
FT_Glyph_Format glyph_format
Definition: ftrender.h:149
FT_Raster_Funcs * raster_class
Definition: ftrender.h:156

Referenced by FT_Add_Default_Modules().

◆ ft_add_renderer()

static FT_Error ft_add_renderer ( FT_Module  module)
static

Definition at line 4332 of file ftobjs.c.

4333 {
4334 FT_Library library = module->library;
4338
4339
4340 if ( FT_NEW( node ) )
4341 goto Exit;
4342
4343 {
4345 FT_Renderer_Class* clazz = (FT_Renderer_Class*)module->clazz;
4346
4347
4348 render->clazz = clazz;
4349 render->glyph_format = clazz->glyph_format;
4350
4351 /* allocate raster object if needed */
4353 clazz->raster_class->raster_new )
4354 {
4355 error = clazz->raster_class->raster_new( memory, &render->raster );
4356 if ( error )
4357 goto Fail;
4358
4359 render->raster_render = clazz->raster_class->raster_render;
4360 render->render = clazz->render_glyph;
4361 }
4362
4363 /* add to list */
4364 node->data = module;
4366
4368 }
4369
4370 Fail:
4371 if ( error )
4372 FT_FREE( node );
4373
4374 Exit:
4375 return error;
4376 }
FT_List_Add(FT_List list, FT_ListNode node)
Definition: ftutil.c:269
#define FT_NEW(ptr)
Definition: ftmemory.h:331
static void ft_set_current_renderer(FT_Library library)
Definition: ftobjs.c:4321
if(dx< 0)
Definition: linetemp.h:194
static void render(void)
Definition: ssstars.c:272
FT_ListRec renderers
Definition: ftobjs.h:927
FT_Raster_NewFunc raster_new
Definition: ftimage.h:1184
FT_Raster_RenderFunc raster_render
Definition: ftimage.h:1187
FT_Renderer_RenderFunc render_glyph
Definition: ftrender.h:151
Definition: dlist.c:348
GLvoid * data
Definition: dlist.c:359

Referenced by FT_Add_Module().

◆ FT_Attach_File()

FT_Attach_File ( FT_Face  face,
const char filepathname 
)

Definition at line 2641 of file ftobjs.c.

2643 {
2645
2646
2647 /* test for valid `face' delayed to `FT_Attach_Stream' */
2648
2649 if ( !filepathname )
2650 return FT_THROW( Invalid_Argument );
2651
2652 open.stream = NULL;
2653 open.flags = FT_OPEN_PATHNAME;
2654 open.pathname = (char*)filepathname;
2655
2656 return FT_Attach_Stream( face, &open );
2657 }
#define open
Definition: acwin.h:95
#define FT_OPEN_PATHNAME
Definition: freetype.h:2036
FT_Attach_Stream(FT_Face face, FT_Open_Args *parameters)
Definition: ftobjs.c:2663

◆ FT_Attach_Stream()

FT_Attach_Stream ( FT_Face  face,
FT_Open_Args parameters 
)

Definition at line 2663 of file ftobjs.c.

2665 {
2669
2670 FT_Driver_Class clazz;
2671
2672
2673 /* test for valid `parameters' delayed to `FT_Stream_New' */
2674
2675 if ( !face )
2676 return FT_THROW( Invalid_Face_Handle );
2677
2678 driver = face->driver;
2679 if ( !driver )
2680 return FT_THROW( Invalid_Driver_Handle );
2681
2682 error = FT_Stream_New( driver->root.library, parameters, &stream );
2683 if ( error )
2684 goto Exit;
2685
2686 /* we implement FT_Attach_Stream in each driver through the */
2687 /* `attach_file' interface */
2688
2689 error = FT_ERR( Unimplemented_Feature );
2690 clazz = driver->clazz;
2691 if ( clazz->attach_file )
2692 error = clazz->attach_file( face, stream );
2693
2694 /* close the attached stream */
2696 (FT_Bool)( parameters->stream &&
2697 ( parameters->flags & FT_OPEN_STREAM ) ) );
2698
2699 Exit:
2700 return error;
2701 }
#define FT_OPEN_STREAM
Definition: freetype.h:2035
FT_Stream_New(FT_Library library, const FT_Open_Args *args, FT_Stream *astream)
Definition: ftobjs.c:178
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
#define FT_ERR(e)
Definition: fttypes.h:586
FT_Face_AttachFunc attach_file
Definition: ftdrv.h:177
FT_UInt flags
Definition: freetype.h:2137
FT_Stream stream
Definition: freetype.h:2141
Definition: parse.h:23

Referenced by FT_Attach_File().

◆ FT_CMap_Done()

FT_CMap_Done ( FT_CMap  cmap)

Definition at line 3568 of file ftobjs.c.

3569 {
3570 if ( cmap )
3571 {
3572 FT_Face face = cmap->charmap.face;
3575 FT_Int i, j;
3576
3577
3578 for ( i = 0; i < face->num_charmaps; i++ )
3579 {
3580 if ( (FT_CMap)face->charmaps[i] == cmap )
3581 {
3582 FT_CharMap last_charmap = face->charmaps[face->num_charmaps - 1];
3583
3584
3585 if ( FT_RENEW_ARRAY( face->charmaps,
3586 face->num_charmaps,
3587 face->num_charmaps - 1 ) )
3588 return;
3589
3590 /* remove it from our list of charmaps */
3591 for ( j = i + 1; j < face->num_charmaps; j++ )
3592 {
3593 if ( j == face->num_charmaps - 1 )
3594 face->charmaps[j - 1] = last_charmap;
3595 else
3596 face->charmaps[j - 1] = face->charmaps[j];
3597 }
3598
3599 face->num_charmaps--;
3600
3601 if ( (FT_CMap)face->charmap == cmap )
3602 face->charmap = NULL;
3603
3604 ft_cmap_done_internal( cmap );
3605
3606 break;
3607 }
3608 }
3609 }
3610 }
#define FT_RENEW_ARRAY(ptr, curcnt, newcnt)
Definition: ftmemory.h:336
#define FT_FACE_MEMORY(x)
Definition: ftobjs.h:636
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
FT_CharMapRec charmap
Definition: ftobjs.h:153
FT_Face face
Definition: freetype.h:842

◆ ft_cmap_done_internal()

static void ft_cmap_done_internal ( FT_CMap  cmap)
static

Definition at line 3553 of file ftobjs.c.

3554 {
3555 FT_CMap_Class clazz = cmap->clazz;
3556 FT_Face face = cmap->charmap.face;
3558
3559
3560 if ( clazz->done )
3561 clazz->done( cmap );
3562
3563 FT_FREE( cmap );
3564 }
FT_CMap_Class clazz
Definition: ftobjs.h:154
FT_CMap_DoneFunc done
Definition: ftobjs.h:215

Referenced by destroy_charmaps(), FT_CMap_Done(), and FT_CMap_New().

◆ FT_CMap_New()

FT_CMap_New ( FT_CMap_Class  clazz,
FT_Pointer  init_data,
FT_CharMap  charmap,
FT_CMap acmap 
)

Definition at line 3614 of file ftobjs.c.

3618 {
3620 FT_Face face;
3622 FT_CMap cmap = NULL;
3623
3624
3625 if ( !clazz || !charmap || !charmap->face )
3626 return FT_THROW( Invalid_Argument );
3627
3628 face = charmap->face;
3630
3631 if ( !FT_ALLOC( cmap, clazz->size ) )
3632 {
3633 cmap->charmap = *charmap;
3634 cmap->clazz = clazz;
3635
3636 if ( clazz->init )
3637 {
3638 error = clazz->init( cmap, init_data );
3639 if ( error )
3640 goto Fail;
3641 }
3642
3643 /* add it to our list of charmaps */
3644 if ( FT_RENEW_ARRAY( face->charmaps,
3645 face->num_charmaps,
3646 face->num_charmaps + 1 ) )
3647 goto Fail;
3648
3649 face->charmaps[face->num_charmaps++] = (FT_CharMap)cmap;
3650 }
3651
3652 Exit:
3653 if ( acmap )
3654 *acmap = cmap;
3655
3656 return error;
3657
3658 Fail:
3659 ft_cmap_done_internal( cmap );
3660 cmap = NULL;
3661 goto Exit;
3662 }
struct FT_CharMapRec_ * FT_CharMap
Definition: freetype.h:588
FT_ULong size
Definition: ftobjs.h:212
FT_CMap_InitFunc init
Definition: ftobjs.h:214

Referenced by BDF_Face_Init(), cff_face_init(), FNT_Face_Init(), PCF_Face_Init(), pfr_face_init(), sfnt_load_face(), T1_Face_Init(), T42_Face_Init(), and tt_face_build_cmaps().

◆ FT_Done_Face()

FT_Done_Face ( FT_Face  face)

Definition at line 2721 of file ftobjs.c.

2722 {
2727
2728
2729 error = FT_ERR( Invalid_Face_Handle );
2730 if ( face && face->driver )
2731 {
2732 face->internal->refcount--;
2733 if ( face->internal->refcount > 0 )
2734 error = FT_Err_Ok;
2735 else
2736 {
2737 driver = face->driver;
2738 memory = driver->root.memory;
2739
2740 /* find face in driver's list */
2741 node = FT_List_Find( &driver->faces_list, face );
2742 if ( node )
2743 {
2744 /* remove face object from the driver's list */
2745 FT_List_Remove( &driver->faces_list, node );
2746 FT_FREE( node );
2747
2748 /* now destroy the object proper */
2750 error = FT_Err_Ok;
2751 }
2752 }
2753 }
2754
2755 return error;
2756 }
FT_List_Remove(FT_List list, FT_ListNode node)
Definition: ftutil.c:321
FT_BEGIN_HEADER FT_List_Find(FT_List list, void *data)
Definition: ftutil.c:244

Referenced by ExecuteTest(), FT_Done_Library(), ft_open_face_internal(), ftc_face_node_done(), FtfdQueryFont(), FtfdUnloadFontFile(), SharedFace_Release(), T42_Face_Done(), and TestFace().

◆ FT_Done_GlyphSlot()

FT_Done_GlyphSlot ( FT_GlyphSlot  slot)

Definition at line 612 of file ftobjs.c.

613 {
614 if ( slot )
615 {
616 FT_Driver driver = slot->face->driver;
617 FT_Memory memory = driver->root.memory;
618 FT_GlyphSlot prev;
620
621
622 /* Remove slot from its parent face's list */
623 prev = NULL;
624 cur = slot->face->glyph;
625
626 while ( cur )
627 {
628 if ( cur == slot )
629 {
630 if ( !prev )
631 slot->face->glyph = cur->next;
632 else
633 prev->next = cur->next;
634
635 /* finalize client-specific data */
636 if ( slot->generic.finalizer )
637 slot->generic.finalizer( slot );
638
640 FT_FREE( slot );
641 break;
642 }
643 prev = cur;
644 cur = cur->next;
645 }
646 }
647 }
static void ft_glyphslot_done(FT_GlyphSlot slot)
Definition: ftobjs.c:528
FT_GlyphSlot next
Definition: freetype.h:1912
Definition: vfat.h:185

Referenced by destroy_face(), and T42_GlyphSlot_Done().

◆ FT_Done_Library()

FT_Done_Library ( FT_Library  library)

Definition at line 5220 of file ftobjs.c.

5221 {
5223
5224
5225 if ( !library )
5226 return FT_THROW( Invalid_Library_Handle );
5227
5228 library->refcount--;
5229 if ( library->refcount > 0 )
5230 goto Exit;
5231
5233
5234 /*
5235 * Close all faces in the library. If we don't do this, we can have
5236 * some subtle memory leaks.
5237 *
5238 * Example:
5239 *
5240 * - the cff font driver uses the pshinter module in cff_size_done
5241 * - if the pshinter module is destroyed before the cff font driver,
5242 * opened FT_Face objects managed by the driver are not properly
5243 * destroyed, resulting in a memory leak
5244 *
5245 * Some faces are dependent on other faces, like Type42 faces that
5246 * depend on TrueType faces synthesized internally.
5247 *
5248 * The order of drivers should be specified in driver_name[].
5249 */
5250 {
5251 FT_UInt m, n;
5252 const char* driver_name[] = { "type42", NULL };
5253
5254
5255 for ( m = 0;
5256 m < sizeof ( driver_name ) / sizeof ( driver_name[0] );
5257 m++ )
5258 {
5259 for ( n = 0; n < library->num_modules; n++ )
5260 {
5262 const char* module_name = module->clazz->module_name;
5263 FT_List faces;
5264
5265
5266 if ( driver_name[m] &&
5267 ft_strcmp( module_name, driver_name[m] ) != 0 )
5268 continue;
5269
5270 if ( ( module->clazz->module_flags & FT_MODULE_FONT_DRIVER ) == 0 )
5271 continue;
5272
5273 FT_TRACE7(( "FT_Done_Library: close faces for %s\n", module_name ));
5274
5275 faces = &FT_DRIVER( module )->faces_list;
5276 while ( faces->head )
5277 {
5278 FT_Done_Face( FT_FACE( faces->head->data ) );
5279 if ( faces->head )
5280 FT_TRACE0(( "FT_Done_Library: failed to free some faces\n" ));
5281 }
5282 }
5283 }
5284 }
5285
5286 /* Close all other modules in the library */
5287#if 1
5288 /* XXX Modules are removed in the reversed order so that */
5289 /* type42 module is removed before truetype module. This */
5290 /* avoids double free in some occasions. It is a hack. */
5291 while ( library->num_modules > 0 )
5294#else
5295 {
5296 FT_UInt n;
5297
5298
5299 for ( n = 0; n < library->num_modules; n++ )
5300 {
5302
5303
5304 if ( module )
5305 {
5307 library->modules[n] = NULL;
5308 }
5309 }
5310 }
5311#endif
5312
5313#ifdef FT_CONFIG_OPTION_PIC
5314 /* Destroy pic container contents */
5315 ft_pic_container_destroy( library );
5316#endif
5317
5318 FT_FREE( library );
5319
5320 Exit:
5321 return FT_Err_Ok;
5322 }
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:170
#define FT_TRACE0(varformat)
Definition: ftdebug.h:157
#define FT_TRACE7(varformat)
Definition: ftdebug.h:164
#define FT_MODULE_FONT_DRIVER
Definition: ftmodapi.h:110
FT_Done_Face(FT_Face face)
Definition: ftobjs.c:2721
static void Destroy_Module(FT_Module module)
Definition: ftobjs.c:4694
#define FT_FACE(x)
Definition: ftobjs.h:630
const GLfloat * m
Definition: glext.h:10848
FT_Int refcount
Definition: ftobjs.h:942
void * data
Definition: fttypes.h:548
FT_ListNode head
Definition: fttypes.h:569

Referenced by FT_Done_FreeType().

◆ FT_Done_Size()

FT_Done_Size ( FT_Size  size)

Definition at line 2827 of file ftobjs.c.

2828 {
2832 FT_Face face;
2834
2835
2836 if ( !size )
2837 return FT_THROW( Invalid_Size_Handle );
2838
2839 face = size->face;
2840 if ( !face )
2841 return FT_THROW( Invalid_Face_Handle );
2842
2843 driver = face->driver;
2844 if ( !driver )
2845 return FT_THROW( Invalid_Driver_Handle );
2846
2847 memory = driver->root.memory;
2848
2849 error = FT_Err_Ok;
2850 node = FT_List_Find( &face->sizes_list, size );
2851 if ( node )
2852 {
2853 FT_List_Remove( &face->sizes_list, node );
2854 FT_FREE( node );
2855
2856 if ( face->size == size )
2857 {
2858 face->size = NULL;
2859 if ( face->sizes_list.head )
2860 face->size = (FT_Size)(face->sizes_list.head->data);
2861 }
2862
2864 }
2865 else
2866 error = FT_THROW( Invalid_Size_Handle );
2867
2868 return error;
2869 }
struct FT_SizeRec_ * FT_Size
Definition: freetype.h:534

Referenced by ftc_face_node_init(), ftc_scaler_lookup_size(), ftc_size_node_done(), ftc_size_node_reset(), T42_Face_Init(), and T42_Size_Done().

◆ FT_Face_GetCharsOfVariant()

FT_Face_GetCharsOfVariant ( FT_Face  face,
FT_ULong  variantSelector 
)

Definition at line 3984 of file ftobjs.c.

3986 {
3987 FT_UInt32 *result = NULL;
3988
3989
3990 if ( face )
3991 {
3993
3994
3995 if ( charmap )
3996 {
3997 FT_CMap vcmap = FT_CMAP( charmap );
3999
4000
4001 if ( variantSelector > 0xFFFFFFFFUL )
4002 {
4003 FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" ));
4004 FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
4005 }
4006
4007 result = vcmap->clazz->variantchar_list( vcmap, memory,
4008 (FT_UInt32)variantSelector );
4009 }
4010 }
4011
4012 return result;
4013 }
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
static FT_CharMap find_variant_selector_charmap(FT_Face face)
Definition: ftobjs.c:1268
GLuint64EXT * result
Definition: glext.h:11304
FT_CMap_VariantCharListFunc variantchar_list
Definition: ftobjs.h:226

◆ FT_Face_GetCharVariantIndex()

FT_Face_GetCharVariantIndex ( FT_Face  face,
FT_ULong  charcode,
FT_ULong  variantSelector 
)

Definition at line 3834 of file ftobjs.c.

3837 {
3838 FT_UInt result = 0;
3839
3840
3841 if ( face &&
3842 face->charmap &&
3843 face->charmap->encoding == FT_ENCODING_UNICODE )
3844 {
3846 FT_CMap ucmap = FT_CMAP( face->charmap );
3847
3848
3849 if ( charmap )
3850 {
3851 FT_CMap vcmap = FT_CMAP( charmap );
3852
3853
3854 if ( charcode > 0xFFFFFFFFUL )
3855 {
3856 FT_TRACE1(( "FT_Face_GetCharVariantIndex:"
3857 " too large charcode" ));
3858 FT_TRACE1(( " 0x%x is truncated\n", charcode ));
3859 }
3860 if ( variantSelector > 0xFFFFFFFFUL )
3861 {
3862 FT_TRACE1(( "FT_Face_GetCharVariantIndex:"
3863 " too large variantSelector" ));
3864 FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
3865 }
3866
3867 result = vcmap->clazz->char_var_index( vcmap, ucmap,
3868 (FT_UInt32)charcode,
3869 (FT_UInt32)variantSelector );
3870 }
3871 }
3872
3873 return result;
3874 }
FT_CMap_CharVarIndexFunc char_var_index
Definition: ftobjs.h:222

◆ FT_Face_GetCharVariantIsDefault()

FT_Face_GetCharVariantIsDefault ( FT_Face  face,
FT_ULong  charcode,
FT_ULong  variantSelector 
)

Definition at line 3880 of file ftobjs.c.

3883 {
3884 FT_Int result = -1;
3885
3886
3887 if ( face )
3888 {
3890
3891
3892 if ( charmap )
3893 {
3894 FT_CMap vcmap = FT_CMAP( charmap );
3895
3896
3897 if ( charcode > 0xFFFFFFFFUL )
3898 {
3899 FT_TRACE1(( "FT_Face_GetCharVariantIsDefault:"
3900 " too large charcode" ));
3901 FT_TRACE1(( " 0x%x is truncated\n", charcode ));
3902 }
3903 if ( variantSelector > 0xFFFFFFFFUL )
3904 {
3905 FT_TRACE1(( "FT_Face_GetCharVariantIsDefault:"
3906 " too large variantSelector" ));
3907 FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
3908 }
3909
3910 result = vcmap->clazz->char_var_default( vcmap,
3911 (FT_UInt32)charcode,
3912 (FT_UInt32)variantSelector );
3913 }
3914 }
3915
3916 return result;
3917 }
FT_CMap_CharVarIsDefaultFunc char_var_default
Definition: ftobjs.h:223

◆ FT_Face_GetVariantSelectors()

FT_Face_GetVariantSelectors ( FT_Face  face)

Definition at line 3923 of file ftobjs.c.

3924 {
3925 FT_UInt32 *result = NULL;
3926
3927
3928 if ( face )
3929 {
3931
3932
3933 if ( charmap )
3934 {
3935 FT_CMap vcmap = FT_CMAP( charmap );
3937
3938
3939 result = vcmap->clazz->variant_list( vcmap, memory );
3940 }
3941 }
3942
3943 return result;
3944 }
FT_CMap_VariantListFunc variant_list
Definition: ftobjs.h:224

◆ FT_Face_GetVariantsOfChar()

FT_Face_GetVariantsOfChar ( FT_Face  face,
FT_ULong  charcode 
)

Definition at line 3950 of file ftobjs.c.

3952 {
3953 FT_UInt32 *result = NULL;
3954
3955
3956 if ( face )
3957 {
3959
3960
3961 if ( charmap )
3962 {
3963 FT_CMap vcmap = FT_CMAP( charmap );
3965
3966
3967 if ( charcode > 0xFFFFFFFFUL )
3968 {
3969 FT_TRACE1(( "FT_Face_GetVariantsOfChar: too large charcode" ));
3970 FT_TRACE1(( " 0x%x is truncated\n", charcode ));
3971 }
3972
3973 result = vcmap->clazz->charvariant_list( vcmap, memory,
3974 (FT_UInt32)charcode );
3975 }
3976 }
3977 return result;
3978 }
FT_CMap_CharVariantListFunc charvariant_list
Definition: ftobjs.h:225

◆ FT_Face_Properties()

FT_Face_Properties ( FT_Face  face,
FT_UInt  num_properties,
FT_Parameter properties 
)

Definition at line 3755 of file ftobjs.c.

3758 {
3760
3761
3762 if ( num_properties > 0 && !properties )
3763 {
3764 error = FT_THROW( Invalid_Argument );
3765 goto Exit;
3766 }
3767
3768 for ( ; num_properties > 0; num_properties-- )
3769 {
3770 if ( properties->tag == FT_PARAM_TAG_STEM_DARKENING )
3771 {
3772 if ( properties->data )
3773 {
3774 if ( *( (FT_Bool*)properties->data ) == TRUE )
3775 face->internal->no_stem_darkening = FALSE;
3776 else
3777 face->internal->no_stem_darkening = TRUE;
3778 }
3779 else
3780 {
3781 /* use module default */
3782 face->internal->no_stem_darkening = -1;
3783 }
3784 }
3785 else if ( properties->tag == FT_PARAM_TAG_LCD_FILTER_WEIGHTS )
3786 {
3787#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
3788 if ( properties->data )
3789 {
3790 ft_memcpy( face->internal->lcd_weights,
3791 properties->data,
3793 face->internal->lcd_filter_func = ft_lcd_filter_fir;
3794 }
3795#else
3796 error = FT_THROW( Unimplemented_Feature );
3797 goto Exit;
3798#endif
3799 }
3800 else if ( properties->tag == FT_PARAM_TAG_RANDOM_SEED )
3801 {
3802 if ( properties->data )
3803 {
3804 face->internal->random_seed = *( (FT_Int32*)properties->data );
3805 if ( face->internal->random_seed < 0 )
3806 face->internal->random_seed = 0;
3807 }
3808 else
3809 {
3810 /* use module default */
3811 face->internal->random_seed = -1;
3812 }
3813 }
3814 else
3815 {
3816 error = FT_THROW( Invalid_Argument );
3817 goto Exit;
3818 }
3819
3820 if ( error )
3821 break;
3822
3823 properties++;
3824 }
3825
3826 Exit:
3827 return error;
3828 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define FT_LCD_FILTER_FIVE_TAPS
Definition: ftlcdfil.h:296
#define FT_PARAM_TAG_RANDOM_SEED
Definition: ftparams.h:151
#define FT_PARAM_TAG_LCD_FILTER_WEIGHTS
Definition: ftparams.h:132
#define FT_PARAM_TAG_STEM_DARKENING
Definition: ftparams.h:175
#define ft_memcpy
Definition: ftstdlib.h:82
FT_ULong tag
Definition: freetype.h:2070
FT_Pointer data
Definition: freetype.h:2071

◆ FT_Get_Char_Index()

FT_Get_Char_Index ( FT_Face  face,
FT_ULong  charcode 
)

Definition at line 3668 of file ftobjs.c.

3670 {
3671 FT_UInt result = 0;
3672
3673
3674 if ( face && face->charmap )
3675 {
3676 FT_CMap cmap = FT_CMAP( face->charmap );
3677
3678
3679 if ( charcode > 0xFFFFFFFFUL )
3680 {
3681 FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
3682 FT_TRACE1(( " 0x%x is truncated\n", charcode ));
3683 }
3684
3685 result = cmap->clazz->char_index( cmap, (FT_UInt32)charcode );
3686 if ( result >= (FT_UInt)face->num_glyphs )
3687 result = 0;
3688 }
3689
3690 return result;
3691 }
FT_CMap_CharIndexFunc char_index
Definition: ftobjs.h:216

Referenced by af_face_globals_compute_style_coverage(), af_shaper_get_cluster(), FT_Get_First_Char(), FT_Load_Char(), FTC_CMapCache_Lookup(), get_glyph_index(), get_glyph_index_symbol(), and T1_Read_PFM().

◆ FT_Get_Charmap_Index()

FT_Get_Charmap_Index ( FT_CharMap  charmap)

Definition at line 3534 of file ftobjs.c.

3535 {
3536 FT_Int i;
3537
3538
3539 if ( !charmap || !charmap->face )
3540 return -1;
3541
3542 for ( i = 0; i < charmap->face->num_charmaps; i++ )
3543 if ( charmap->face->charmaps[i] == charmap )
3544 break;
3545
3546 FT_ASSERT( i < charmap->face->num_charmaps );
3547
3548 return i;
3549 }
FT_Int num_charmaps
Definition: freetype.h:1084
FT_CharMap * charmaps
Definition: freetype.h:1085

◆ FT_Get_CMap_Format()

FT_Get_CMap_Format ( FT_CharMap  charmap)

Definition at line 4206 of file ftobjs.c.

4207 {
4208 FT_Service_TTCMaps service;
4209 FT_Face face;
4211
4212
4213 if ( !charmap || !charmap->face )
4214 return -1;
4215
4216 face = charmap->face;
4217 FT_FACE_FIND_SERVICE( face, service, TT_CMAP );
4218 if ( !service )
4219 return -1;
4220 if ( service->get_cmap_info( charmap, &cmap_info ))
4221 return -1;
4222
4223 return cmap_info.format;
4224 }
TT_CMapInfo * cmap_info
Definition: cffdrivr.c:649
#define FT_FACE_FIND_SERVICE(face, ptr, id)
Definition: ftserv.h:75
FT_Long format
Definition: svttcmap.h:61

Referenced by find_variant_selector_charmap(), and FT_Set_Charmap().

◆ FT_Get_CMap_Language_ID()

FT_Get_CMap_Language_ID ( FT_CharMap  charmap)

Definition at line 4182 of file ftobjs.c.

4183 {
4184 FT_Service_TTCMaps service;
4185 FT_Face face;
4187
4188
4189 if ( !charmap || !charmap->face )
4190 return 0;
4191
4192 face = charmap->face;
4193 FT_FACE_FIND_SERVICE( face, service, TT_CMAP );
4194 if ( !service )
4195 return 0;
4196 if ( service->get_cmap_info( charmap, &cmap_info ))
4197 return 0;
4198
4199 return cmap_info.language;
4200 }
FT_ULong language
Definition: svttcmap.h:60

◆ FT_Get_First_Char()

FT_Get_First_Char ( FT_Face  face,
FT_UInt agindex 
)

Definition at line 3697 of file ftobjs.c.

3699 {
3700 FT_ULong result = 0;
3701 FT_UInt gindex = 0;
3702
3703
3704 /* only do something if we have a charmap, and we have glyphs at all */
3705 if ( face && face->charmap && face->num_glyphs )
3706 {
3707 gindex = FT_Get_Char_Index( face, 0 );
3708 if ( gindex == 0 )
3709 result = FT_Get_Next_Char( face, 0, &gindex );
3710 }
3711
3712 if ( agindex )
3713 *agindex = gindex;
3714
3715 return result;
3716 }
FT_Get_Next_Char(FT_Face face, FT_ULong charcode, FT_UInt *agindex)
Definition: ftobjs.c:3722
FT_Get_Char_Index(FT_Face face, FT_ULong charcode)
Definition: ftobjs.c:3668
unsigned long FT_ULong
Definition: fttypes.h:253

Referenced by FontFamilyFillInfo(), FtfdQueryFontTree(), ftGdiGetKerningPairs(), ftGdiGetTextCharsetInfo(), and ftGetFontUnicodeRanges().

◆ FT_Get_Glyph_Name()

FT_Get_Glyph_Name ( FT_Face  face,
FT_UInt  glyph_index,
FT_Pointer  buffer,
FT_UInt  buffer_max 
)

Definition at line 4047 of file ftobjs.c.

4051 {
4053 FT_Service_GlyphDict service;
4054
4055
4056 if ( !face )
4057 return FT_THROW( Invalid_Face_Handle );
4058
4059 if ( !buffer || buffer_max == 0 )
4060 return FT_THROW( Invalid_Argument );
4061
4062 /* clean up buffer */
4063 ((FT_Byte*)buffer)[0] = '\0';
4064
4065 if ( (FT_Long)glyph_index >= face->num_glyphs )
4066 return FT_THROW( Invalid_Glyph_Index );
4067
4068 if ( !FT_HAS_GLYPH_NAMES( face ) )
4069 return FT_THROW( Invalid_Argument );
4070
4071 FT_FACE_LOOKUP_SERVICE( face, service, GLYPH_DICT );
4072 if ( service && service->get_name )
4073 error = service->get_name( face, glyph_index, buffer, buffer_max );
4074 else
4075 error = FT_THROW( Invalid_Argument );
4076
4077 return error;
4078 }
#define FT_HAS_GLYPH_NAMES(face)
Definition: freetype.h:1387
#define FT_FACE_LOOKUP_SERVICE(face, ptr, id)
Definition: ftserv.h:950
unsigned char FT_Byte
Definition: fttypes.h:154
GLuint buffer
Definition: glext.h:5915

Referenced by tt_check_single_notdef().

◆ FT_Get_Kerning()

FT_Get_Kerning ( FT_Face  face,
FT_UInt  left_glyph,
FT_UInt  right_glyph,
FT_UInt  kern_mode,
FT_Vector akerning 
)

Definition at line 3347 of file ftobjs.c.

3352 {
3355
3356
3357 if ( !face )
3358 return FT_THROW( Invalid_Face_Handle );
3359
3360 if ( !akerning )
3361 return FT_THROW( Invalid_Argument );
3362
3363 driver = face->driver;
3364
3365 akerning->x = 0;
3366 akerning->y = 0;
3367
3368 if ( driver->clazz->get_kerning )
3369 {
3370 error = driver->clazz->get_kerning( face,
3371 left_glyph,
3373 akerning );
3374 if ( !error )
3375 {
3376 if ( kern_mode != FT_KERNING_UNSCALED )
3377 {
3378 akerning->x = FT_MulFix( akerning->x, face->size->metrics.x_scale );
3379 akerning->y = FT_MulFix( akerning->y, face->size->metrics.y_scale );
3380
3381 if ( kern_mode != FT_KERNING_UNFITTED )
3382 {
3383 FT_Pos orig_x = akerning->x;
3384 FT_Pos orig_y = akerning->y;
3385
3386
3387 /* we scale down kerning values for small ppem values */
3388 /* to avoid that rounding makes them too big. */
3389 /* `25' has been determined heuristically. */
3390 if ( face->size->metrics.x_ppem < 25 )
3391 akerning->x = FT_MulDiv( orig_x,
3392 face->size->metrics.x_ppem, 25 );
3393 if ( face->size->metrics.y_ppem < 25 )
3394 akerning->y = FT_MulDiv( orig_y,
3395 face->size->metrics.y_ppem, 25 );
3396
3397 akerning->x = FT_PIX_ROUND( akerning->x );
3398 akerning->y = FT_PIX_ROUND( akerning->y );
3399
3400#ifdef FT_DEBUG_LEVEL_TRACE
3401 {
3402 FT_Pos orig_x_rounded = FT_PIX_ROUND( orig_x );
3403 FT_Pos orig_y_rounded = FT_PIX_ROUND( orig_y );
3404
3405
3406 if ( akerning->x != orig_x_rounded ||
3407 akerning->y != orig_y_rounded )
3408 FT_TRACE5(( "FT_Get_Kerning: horizontal kerning"
3409 " (%d, %d) scaled down to (%d, %d) pixels\n",
3410 orig_x_rounded / 64, orig_y_rounded / 64,
3411 akerning->x / 64, akerning->y / 64 ));
3412 }
3413#endif
3414 }
3415 }
3416 }
3417 }
3418
3419 return error;
3420 }
@ FT_KERNING_UNFITTED
Definition: freetype.h:3390
@ FT_KERNING_UNSCALED
Definition: freetype.h:3391
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
Definition: ftcalc.c:416
FT_MulFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:509
#define FT_TRACE5(varformat)
Definition: ftdebug.h:162
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
#define FT_PIX_ROUND(x)
Definition: ftobjs.h:93
FT_Pos x
Definition: ftimage.h:76
FT_Pos y
Definition: ftimage.h:77
FT_UInt left_glyph
Definition: ttdriver.c:201
FT_UInt FT_UInt right_glyph
Definition: ttdriver.c:202

Referenced by FT_Get_PFR_Kerning(), ftGdiGetKerningPairs(), IntExtTextOutW(), IntGetTextDisposition(), and TextIntGetTextExtentPoint().

◆ FT_Get_Module()

FT_Get_Module ( FT_Library  library,
const char module_name 
)

Definition at line 4837 of file ftobjs.c.

4839 {
4841 FT_Module* cur;
4843
4844
4845 if ( !library || !module_name )
4846 return result;
4847
4848 cur = library->modules;
4850
4851 for ( ; cur < limit; cur++ )
4852 if ( ft_strcmp( cur[0]->clazz->module_name, module_name ) == 0 )
4853 {
4854 result = cur[0];
4855 break;
4856 }
4857
4858 return result;
4859 }
GLint limit
Definition: glext.h:10326

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_Module_Interface()

FT_Get_Module_Interface ( FT_Library  library,
const char mod_name 
)

Definition at line 4865 of file ftobjs.c.

4867 {
4869
4870
4871 /* test for valid `library' delayed to FT_Get_Module() */
4872
4873 module = FT_Get_Module( library, mod_name );
4874
4875 return module ? module->clazz->module_interface : 0;
4876 }
FT_Get_Module(FT_Library library, const char *module_name)
Definition: ftobjs.c:4837

Referenced by cff_face_init(), cff_parser_run(), cid_face_init(), parse_afm(), sfnt_init_face(), T1_Face_Init(), T42_Face_Init(), and tt_face_init().

◆ FT_Get_Name_Index()

FT_Get_Name_Index ( FT_Face  face,
FT_String glyph_name 
)

Definition at line 4019 of file ftobjs.c.

4021 {
4022 FT_UInt result = 0;
4023
4024
4025 if ( face &&
4027 glyph_name )
4028 {
4029 FT_Service_GlyphDict service;
4030
4031
4033 service,
4034 GLYPH_DICT );
4035
4036 if ( service && service->name_index )
4037 result = service->name_index( face, glyph_name );
4038 }
4039
4040 return result;
4041 }

◆ FT_Get_Next_Char()

FT_Get_Next_Char ( FT_Face  face,
FT_ULong  charcode,
FT_UInt agindex 
)

Definition at line 3722 of file ftobjs.c.

3725 {
3726 FT_ULong result = 0;
3727 FT_UInt gindex = 0;
3728
3729
3730 if ( face && face->charmap && face->num_glyphs )
3731 {
3732 FT_UInt32 code = (FT_UInt32)charcode;
3733 FT_CMap cmap = FT_CMAP( face->charmap );
3734
3735
3736 do
3737 {
3738 gindex = cmap->clazz->char_next( cmap, &code );
3739
3740 } while ( gindex >= (FT_UInt)face->num_glyphs );
3741
3742 result = ( gindex == 0 ) ? 0 : code;
3743 }
3744
3745 if ( agindex )
3746 *agindex = gindex;
3747
3748 return result;
3749 }
FT_CMap_CharNextFunc char_next
Definition: ftobjs.h:217
Definition: inflate.c:139

Referenced by af_face_globals_compute_style_coverage(), FT_Get_First_Char(), FtfdQueryFontTree(), ftGdiGetKerningPairs(), and ftGetFontUnicodeRanges().

◆ FT_Get_Postscript_Name()

FT_Get_Postscript_Name ( FT_Face  face)

Definition at line 4084 of file ftobjs.c.

4085 {
4086 const char* result = NULL;
4087
4088
4089 if ( !face )
4090 goto Exit;
4091
4092 if ( !result )
4093 {
4094 FT_Service_PsFontName service;
4095
4096
4098 service,
4099 POSTSCRIPT_FONT_NAME );
4100
4101 if ( service && service->get_ps_font_name )
4102 result = service->get_ps_font_name( face );
4103 }
4104
4105 Exit:
4106 return result;
4107 }

◆ FT_Get_Renderer()

FT_Get_Renderer ( FT_Library  library,
FT_Glyph_Format  format 
)

Definition at line 4416 of file ftobjs.c.

4418 {
4419 /* test for valid `library' delayed to `FT_Lookup_Renderer' */
4420
4421 return FT_Lookup_Renderer( library, format, 0 );
4422 }
FT_Lookup_Renderer(FT_Library library, FT_Glyph_Format format, FT_ListNode *node)
Definition: ftobjs.c:4264
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546

◆ FT_Get_Sfnt_Table()

FT_Get_Sfnt_Table ( FT_Face  face,
FT_Sfnt_Tag  tag 
)

Definition at line 4113 of file ftobjs.c.

4115 {
4116 void* table = NULL;
4117 FT_Service_SFNT_Table service;
4118
4119
4120 if ( face && FT_IS_SFNT( face ) )
4121 {
4122 FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
4123 if ( service )
4124 table = service->get_table( face, tag );
4125 }
4126
4127 return table;
4128 }
#define FT_IS_SFNT(face)
Definition: freetype.h:1331
Definition: ecma_167.h:138

Referenced by FontFamilyFillInfo(), FT_Get_FSType_Flags(), ftGdiGetTextCharsetInfo(), ftGdiGetTextMetricsW(), IntFontType(), IntGdiLoadFontsFromMemory(), IntGetOutlineTextMetrics(), IntRequestFontSize(), and NtGdiGetGlyphIndicesW().

◆ FT_Get_SubGlyph_Info()

FT_Get_SubGlyph_Info ( FT_GlyphSlot  glyph,
FT_UInt  sub_index,
FT_Int p_index,
FT_UInt p_flags,
FT_Int p_arg1,
FT_Int p_arg2,
FT_Matrix p_transform 
)

Definition at line 5373 of file ftobjs.c.

5380 {
5381 FT_Error error = FT_ERR( Invalid_Argument );
5382
5383
5384 if ( glyph &&
5385 glyph->subglyphs &&
5386 glyph->format == FT_GLYPH_FORMAT_COMPOSITE &&
5387 sub_index < glyph->num_subglyphs )
5388 {
5389 FT_SubGlyph subg = glyph->subglyphs + sub_index;
5390
5391
5392 *p_index = subg->index;
5393 *p_flags = subg->flags;
5394 *p_arg1 = subg->arg1;
5395 *p_arg2 = subg->arg2;
5396 *p_transform = subg->transform;
5397
5398 error = FT_Err_Ok;
5399 }
5400
5401 return error;
5402 }
FT_SubGlyph subglyphs
Definition: freetype.h:1930
FT_Glyph_Format format
Definition: freetype.h:1921
FT_Int arg2
Definition: ftgloadr.h:44
FT_UShort flags
Definition: ftgloadr.h:42
FT_Matrix transform
Definition: ftgloadr.h:45
FT_Int index
Definition: ftgloadr.h:41
FT_Int arg1
Definition: ftgloadr.h:43

◆ FT_Get_Track_Kerning()

FT_Get_Track_Kerning ( FT_Face  face,
FT_Fixed  point_size,
FT_Int  degree,
FT_Fixed akerning 
)

Definition at line 3426 of file ftobjs.c.

3430 {
3431 FT_Service_Kerning service;
3433
3434
3435 if ( !face )
3436 return FT_THROW( Invalid_Face_Handle );
3437
3438 if ( !akerning )
3439 return FT_THROW( Invalid_Argument );
3440
3441 FT_FACE_FIND_SERVICE( face, service, KERNING );
3442 if ( !service )
3443 return FT_THROW( Unimplemented_Feature );
3444
3445 error = service->get_track( face,
3446 point_size,
3447 degree,
3448 akerning );
3449
3450 return error;
3451 }

◆ FT_Get_TrueType_Engine_Type()

FT_Get_TrueType_Engine_Type ( FT_Library  library)

Definition at line 5342 of file ftobjs.c.

5343 {
5345
5346
5347 if ( library )
5348 {
5349 FT_Module module = FT_Get_Module( library, "truetype" );
5350
5351
5352 if ( module )
5353 {
5354 FT_Service_TrueTypeEngine service;
5355
5356
5357 service = (FT_Service_TrueTypeEngine)
5360 0 );
5361 if ( service )
5362 result = service->engine_type;
5363 }
5364 }
5365
5366 return result;
5367 }
@ FT_TRUETYPE_ENGINE_TYPE_NONE
Definition: ftmodapi.h:673
enum FT_TrueTypeEngineType_ FT_TrueTypeEngineType
ft_module_get_service(FT_Module module, const char *service_id, FT_Bool global)
Definition: ftobjs.c:4880
#define FT_SERVICE_ID_TRUETYPE_ENGINE
Definition: svtteng.h:33

◆ ft_glyphslot_alloc_bitmap()

ft_glyphslot_alloc_bitmap ( FT_GlyphSlot  slot,
FT_ULong  size 
)

Definition at line 478 of file ftobjs.c.

480 {
483
484
485 if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
486 FT_FREE( slot->bitmap.buffer );
487 else
488 slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
489
490 (void)FT_ALLOC( slot->bitmap.buffer, size );
491 return error;
492 }
#define FT_GLYPH_OWN_BITMAP
Definition: ftobjs.h:463

Referenced by PCF_Glyph_Load().

◆ ft_glyphslot_clear()

static void ft_glyphslot_clear ( FT_GlyphSlot  slot)
static

Definition at line 496 of file ftobjs.c.

497 {
498 /* free bitmap if needed */
500
501 /* clear all public fields in the glyph slot */
502 FT_ZERO( &slot->metrics );
503 FT_ZERO( &slot->outline );
504
505 slot->bitmap.width = 0;
506 slot->bitmap.rows = 0;
507 slot->bitmap.pitch = 0;
508 slot->bitmap.pixel_mode = 0;
509 /* `slot->bitmap.buffer' has been handled by ft_glyphslot_free_bitmap */
510
511 slot->bitmap_left = 0;
512 slot->bitmap_top = 0;
513 slot->num_subglyphs = 0;
514 slot->subglyphs = NULL;
515 slot->control_data = NULL;
516 slot->control_len = 0;
517 slot->other = NULL;
518 slot->format = FT_GLYPH_FORMAT_NONE;
519
520 slot->linearHoriAdvance = 0;
521 slot->linearVertAdvance = 0;
522 slot->lsb_delta = 0;
523 slot->rsb_delta = 0;
524 }
#define FT_ZERO(p)
Definition: ftmemory.h:237
ft_glyphslot_free_bitmap(FT_GlyphSlot slot)
Definition: ftobjs.c:314

Referenced by FT_Load_Glyph().

◆ ft_glyphslot_done()

static void ft_glyphslot_done ( FT_GlyphSlot  slot)
static

Definition at line 528 of file ftobjs.c.

529 {
530 FT_Driver driver = slot->face->driver;
531 FT_Driver_Class clazz = driver->clazz;
532 FT_Memory memory = driver->root.memory;
533
534
535 if ( clazz->done_slot )
536 clazz->done_slot( slot );
537
538 /* free bitmap buffer if needed */
540
541 /* slot->internal might be NULL in out-of-memory situations */
542 if ( slot->internal )
543 {
544 /* free glyph loader */
546 {
547 FT_GlyphLoader_Done( slot->internal->loader );
548 slot->internal->loader = NULL;
549 }
550
551 FT_FREE( slot->internal );
552 }
553 }
FT_GlyphLoader_Done(FT_GlyphLoader loader)
Definition: ftgloadr.c:128
#define FT_DRIVER_USES_OUTLINES(x)
Definition: ftobjs.h:565
FT_Slot_DoneFunc done_slot
Definition: ftdrv.h:172

Referenced by FT_Done_GlyphSlot(), and FT_New_GlyphSlot().

◆ ft_glyphslot_free_bitmap()

ft_glyphslot_free_bitmap ( FT_GlyphSlot  slot)

Definition at line 314 of file ftobjs.c.

315 {
316 if ( slot->internal && ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
317 {
319
320
321 FT_FREE( slot->bitmap.buffer );
322 slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
323 }
324 else
325 {
326 /* assume that the bitmap buffer was stolen or not */
327 /* allocated from the heap */
328 slot->bitmap.buffer = NULL;
329 }
330 }

Referenced by ft_glyphslot_clear(), ft_glyphslot_done(), ft_glyphslot_set_bitmap(), and t42_glyphslot_clear().

◆ ft_glyphslot_grid_fit_metrics()

static void ft_glyphslot_grid_fit_metrics ( FT_GlyphSlot  slot,
FT_Bool  vertical 
)
static

Definition at line 707 of file ftobjs.c.

709 {
710 FT_Glyph_Metrics* metrics = &slot->metrics;
712
713
714 if ( vertical )
715 {
716 metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX );
717 metrics->horiBearingY = FT_PIX_CEIL_LONG( metrics->horiBearingY );
718
719 right = FT_PIX_CEIL_LONG( ADD_LONG( metrics->vertBearingX,
720 metrics->width ) );
721 bottom = FT_PIX_CEIL_LONG( ADD_LONG( metrics->vertBearingY,
722 metrics->height ) );
723
724 metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX );
725 metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY );
726
727 metrics->width = SUB_LONG( right,
728 metrics->vertBearingX );
729 metrics->height = SUB_LONG( bottom,
730 metrics->vertBearingY );
731 }
732 else
733 {
734 metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX );
735 metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY );
736
737 right = FT_PIX_CEIL_LONG( ADD_LONG( metrics->horiBearingX,
738 metrics->width ) );
739 bottom = FT_PIX_FLOOR( SUB_LONG( metrics->horiBearingY,
740 metrics->height ) );
741
742 metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX );
743 metrics->horiBearingY = FT_PIX_CEIL_LONG( metrics->horiBearingY );
744
745 metrics->width = SUB_LONG( right,
746 metrics->horiBearingX );
747 metrics->height = SUB_LONG( metrics->horiBearingY,
748 bottom );
749 }
750
751 metrics->horiAdvance = FT_PIX_ROUND_LONG( metrics->horiAdvance );
752 metrics->vertAdvance = FT_PIX_ROUND_LONG( metrics->vertAdvance );
753 }
FT_BEGIN_HEADER struct FT_Glyph_Metrics_ FT_Glyph_Metrics
#define SUB_LONG(a, b)
Definition: ftcalc.h:422
#define ADD_LONG(a, b)
Definition: ftcalc.h:420
#define FT_PIX_FLOOR(x)
Definition: ftobjs.h:92
#define FT_PIX_ROUND_LONG(x)
Definition: ftobjs.h:102
#define FT_PIX_CEIL_LONG(x)
Definition: ftobjs.h:103
GLdouble GLdouble right
Definition: glext.h:10859
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:11745
GLint GLint bottom
Definition: glext.h:7726

Referenced by FT_Load_Glyph().

◆ ft_glyphslot_init()

static FT_Error ft_glyphslot_init ( FT_GlyphSlot  slot)
static

Definition at line 286 of file ftobjs.c.

287 {
288 FT_Driver driver = slot->face->driver;
289 FT_Driver_Class clazz = driver->clazz;
290 FT_Memory memory = driver->root.memory;
293
294
295 slot->library = driver->root.library;
296
297 if ( FT_NEW( internal ) )
298 goto Exit;
299
300 slot->internal = internal;
301
304
305 if ( !error && clazz->init_slot )
306 error = clazz->init_slot( slot );
307
308 Exit:
309 return error;
310 }
ios_base &_STLP_CALL internal(ios_base &__s)
Definition: _ios_base.h:311
FT_GlyphLoader_New(FT_Memory memory, FT_GlyphLoader *aloader)
Definition: ftgloadr.c:70
FT_Slot_InitFunc init_slot
Definition: ftdrv.h:171

Referenced by FT_New_GlyphSlot().

◆ ft_glyphslot_preset_bitmap()

ft_glyphslot_preset_bitmap ( FT_GlyphSlot  slot,
FT_Render_Mode  mode,
const FT_Vector origin 
)

Definition at line 334 of file ftobjs.c.

337 {
338 FT_Outline* outline = &slot->outline;
339 FT_Bitmap* bitmap = &slot->bitmap;
340
341 FT_Pixel_Mode pixel_mode;
342
343 FT_BBox cbox;
344 FT_Pos x_shift = 0;
345 FT_Pos y_shift = 0;
346 FT_Pos x_left, y_top;
347 FT_Pos width, height, pitch;
348
349
350 if ( slot->internal && ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
351 return;
352
353 if ( origin )
354 {
355 x_shift = origin->x;
356 y_shift = origin->y;
357 }
358
359 /* compute the control box, and grid-fit it, */
360 /* taking into account the origin shift */
362
363 cbox.xMin += x_shift;
364 cbox.yMin += y_shift;
365 cbox.xMax += x_shift;
366 cbox.yMax += y_shift;
367
368 switch ( mode )
369 {
371 pixel_mode = FT_PIXEL_MODE_MONO;
372#if 1
373 /* undocumented but confirmed: bbox values get rounded */
374 /* unless the rounded box can collapse for a narrow glyph */
375 if ( cbox.xMax - cbox.xMin < 64 )
376 {
377 cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
378 cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax );
379 }
380 else
381 {
382 cbox.xMin = FT_PIX_ROUND_LONG( cbox.xMin );
383 cbox.xMax = FT_PIX_ROUND_LONG( cbox.xMax );
384 }
385
386 if ( cbox.yMax - cbox.yMin < 64 )
387 {
388 cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
389 cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax );
390 }
391 else
392 {
393 cbox.yMin = FT_PIX_ROUND_LONG( cbox.yMin );
394 cbox.yMax = FT_PIX_ROUND_LONG( cbox.yMax );
395 }
396#else
397 cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
398 cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
399 cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax );
400 cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax );
401#endif
402 break;
403
405 pixel_mode = FT_PIXEL_MODE_LCD;
406 ft_lcd_padding( &cbox.xMin, &cbox.xMax, slot );
407 goto Round;
408
410 pixel_mode = FT_PIXEL_MODE_LCD_V;
411 ft_lcd_padding( &cbox.yMin, &cbox.yMax, slot );
412 goto Round;
413
416 default:
417 pixel_mode = FT_PIXEL_MODE_GRAY;
418 Round:
419 cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
420 cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
421 cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax );
422 cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax );
423 }
424
425 x_shift = SUB_LONG( x_shift, cbox.xMin );
426 y_shift = SUB_LONG( y_shift, cbox.yMin );
427
428 x_left = cbox.xMin >> 6;
429 y_top = cbox.yMax >> 6;
430
431 width = ( (FT_ULong)cbox.xMax - (FT_ULong)cbox.xMin ) >> 6;
432 height = ( (FT_ULong)cbox.yMax - (FT_ULong)cbox.yMin ) >> 6;
433
434 switch ( pixel_mode )
435 {
437 pitch = ( ( width + 15 ) >> 4 ) << 1;
438 break;
439
441 width *= 3;
442 pitch = FT_PAD_CEIL( width, 4 );
443 break;
444
446 height *= 3;
447 /* fall through */
448
450 default:
451 pitch = width;
452 }
453
454 slot->bitmap_left = (FT_Int)x_left;
455 slot->bitmap_top = (FT_Int)y_top;
456
457 bitmap->pixel_mode = (unsigned char)pixel_mode;
458 bitmap->num_grays = 256;
459 bitmap->width = (unsigned int)width;
460 bitmap->rows = (unsigned int)height;
461 bitmap->pitch = pitch;
462 }
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned char
Definition: typeof.h:29
@ FT_RENDER_MODE_MONO
Definition: freetype.h:3236
@ FT_RENDER_MODE_NORMAL
Definition: freetype.h:3234
@ FT_RENDER_MODE_LIGHT
Definition: freetype.h:3235
@ FT_RENDER_MODE_LCD_V
Definition: freetype.h:3238
@ FT_RENDER_MODE_LCD
Definition: freetype.h:3237
@ FT_PIXEL_MODE_LCD_V
Definition: ftimage.h:188
@ FT_PIXEL_MODE_MONO
Definition: ftimage.h:183
@ FT_PIXEL_MODE_GRAY
Definition: ftimage.h:184
@ FT_PIXEL_MODE_LCD
Definition: ftimage.h:187
enum FT_Pixel_Mode_ FT_Pixel_Mode
ft_lcd_padding(FT_Pos *Min, FT_Pos *Max, FT_GlyphSlot slot)
Definition: ftlcdfil.c:348
#define FT_PAD_CEIL(x, n)
Definition: ftobjs.h:90
FT_Outline_Get_CBox(const FT_Outline *outline, FT_BBox *acbox)
Definition: ftoutln.c:478
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum mode
Definition: glext.h:6217
voidpf uLong int origin
Definition: ioapi.h:144
FT_Pos xMin
Definition: ftimage.h:117
FT_Pos yMax
Definition: ftimage.h:118
FT_Pos yMin
Definition: ftimage.h:117
FT_Pos xMax
Definition: ftimage.h:118
Definition: uimain.c:89
uint32 width
Definition: uimain.c:91
Definition: mesh.c:5330

Referenced by FT_Load_Glyph(), ft_raster1_render(), and ft_smooth_render_generic().

◆ ft_glyphslot_set_bitmap()

ft_glyphslot_set_bitmap ( FT_GlyphSlot  slot,
FT_Byte buffer 
)

Definition at line 466 of file ftobjs.c.

468 {
470
471 slot->bitmap.buffer = buffer;
472
473 FT_ASSERT( (slot->internal->flags & FT_GLYPH_OWN_BITMAP) == 0 );
474 }

Referenced by BDF_Glyph_Load().

◆ FT_Library_Version()

FT_Library_Version ( FT_Library  library,
FT_Int amajor,
FT_Int aminor,
FT_Int apatch 
)

Definition at line 5189 of file ftobjs.c.

5193 {
5194 FT_Int major = 0;
5195 FT_Int minor = 0;
5196 FT_Int patch = 0;
5197
5198
5199 if ( library )
5200 {
5203 patch = library->version_patch;
5204 }
5205
5206 if ( amajor )
5207 *amajor = major;
5208
5209 if ( aminor )
5210 *aminor = minor;
5211
5212 if ( apatch )
5213 *apatch = patch;
5214 }
#define minor(rdev)
Definition: propsheet.cpp:929
#define major(rdev)
Definition: propsheet.cpp:928
FT_Int version_minor
Definition: ftobjs.h:921
FT_Int version_major
Definition: ftobjs.h:920
FT_Int version_patch
Definition: ftobjs.h:922

◆ FT_Load_Char()

FT_Load_Char ( FT_Face  face,
FT_ULong  char_code,
FT_Int32  load_flags 
)

Definition at line 1037 of file ftobjs.c.

1040 {
1041 FT_UInt glyph_index;
1042
1043
1044 if ( !face )
1045 return FT_THROW( Invalid_Face_Handle );
1046
1047 glyph_index = (FT_UInt)char_code;
1048 if ( face->charmap )
1049 glyph_index = FT_Get_Char_Index( face, char_code );
1050
1051 return FT_Load_Glyph( face, glyph_index, load_flags );
1052 }
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:760

◆ FT_Load_Glyph()

FT_Load_Glyph ( FT_Face  face,
FT_UInt  glyph_index,
FT_Int32  load_flags 
)

Definition at line 760 of file ftobjs.c.

763 {
768 FT_Bool autohint = FALSE;
769 FT_Module hinter;
770 TT_Face ttface = (TT_Face)face;
771
772
773 if ( !face || !face->size || !face->glyph )
774 return FT_THROW( Invalid_Face_Handle );
775
776 /* The validity test for `glyph_index' is performed by the */
777 /* font drivers. */
778
779 slot = face->glyph;
781
782 driver = face->driver;
783 library = driver->root.library;
784 hinter = library->auto_hinter;
785
786 /* resolve load flags dependencies */
787
788 if ( load_flags & FT_LOAD_NO_RECURSE )
789 load_flags |= FT_LOAD_NO_SCALE |
791
792 if ( load_flags & FT_LOAD_NO_SCALE )
793 {
794 load_flags |= FT_LOAD_NO_HINTING |
796
797 load_flags &= ~FT_LOAD_RENDER;
798 }
799
800 if ( load_flags & FT_LOAD_BITMAP_METRICS_ONLY )
801 load_flags &= ~FT_LOAD_RENDER;
802
803 /*
804 * Determine whether we need to auto-hint or not.
805 * The general rules are:
806 *
807 * - Do only auto-hinting if we have
808 *
809 * - a hinter module,
810 * - a scalable font format dealing with outlines,
811 * - not a tricky font, and
812 * - no transforms except simple slants and/or rotations by
813 * integer multiples of 90 degrees.
814 *
815 * - Then, auto-hint if FT_LOAD_FORCE_AUTOHINT is set or if we don't
816 * have a native font hinter.
817 *
818 * - Otherwise, auto-hint for LIGHT hinting mode or if there isn't
819 * any hinting bytecode in the TrueType/OpenType font.
820 *
821 * - Exception: The font is `tricky' and requires the native hinter to
822 * load properly.
823 */
824
825 if ( hinter &&
826 !( load_flags & FT_LOAD_NO_HINTING ) &&
827 !( load_flags & FT_LOAD_NO_AUTOHINT ) &&
830 !FT_IS_TRICKY( face ) &&
831 ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM ) ||
832 ( face->internal->transform_matrix.yx == 0 &&
833 face->internal->transform_matrix.xx != 0 ) ||
834 ( face->internal->transform_matrix.xx == 0 &&
835 face->internal->transform_matrix.yx != 0 ) ) )
836 {
837 if ( ( load_flags & FT_LOAD_FORCE_AUTOHINT ) ||
839 autohint = TRUE;
840 else
841 {
843 FT_Bool is_light_type1;
844
845
846 /* only the new Adobe engine (for both CFF and Type 1) is `light'; */
847 /* we use `strstr' to catch both `Type 1' and `CID Type 1' */
848 is_light_type1 =
849 ft_strstr( FT_Get_Font_Format( face ), "Type 1" ) != NULL &&
850 ((PS_Driver)driver)->hinting_engine == FT_HINTING_ADOBE;
851
852 /* the check for `num_locations' assures that we actually */
853 /* test for instructions in a TTF and not in a CFF-based OTF */
854 /* */
855 /* since `maxSizeOfInstructions' might be unreliable, we */
856 /* check the size of the `fpgm' and `prep' tables, too -- */
857 /* the assumption is that there don't exist real TTFs where */
858 /* both `fpgm' and `prep' tables are missing */
859 if ( ( mode == FT_RENDER_MODE_LIGHT &&
861 !is_light_type1 ) ) ||
862 ( FT_IS_SFNT( face ) &&
863 ttface->num_locations &&
864 ttface->max_profile.maxSizeOfInstructions == 0 &&
865 ttface->font_program_size == 0 &&
866 ttface->cvt_program_size == 0 ) )
867 autohint = TRUE;
868 }
869 }
870
871 if ( autohint )
872 {
874
875
876 /* try to load embedded bitmaps first if available */
877 /* */
878 /* XXX: This is really a temporary hack that should disappear */
879 /* promptly with FreeType 2.1! */
880 /* */
881 if ( FT_HAS_FIXED_SIZES( face ) &&
882 ( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
883 {
884 error = driver->clazz->load_glyph( slot, face->size,
885 glyph_index,
886 load_flags | FT_LOAD_SBITS_ONLY );
887
888 if ( !error && slot->format == FT_GLYPH_FORMAT_BITMAP )
889 goto Load_Ok;
890 }
891
892 {
893 FT_Face_Internal internal = face->internal;
894 FT_Int transform_flags = internal->transform_flags;
895
896
897 /* since the auto-hinter calls FT_Load_Glyph by itself, */
898 /* make sure that glyphs aren't transformed */
899 internal->transform_flags = 0;
900
901 /* load auto-hinted outline */
903
904 error = hinting->load_glyph( (FT_AutoHinter)hinter,
905 slot, face->size,
906 glyph_index, load_flags );
907
908 internal->transform_flags = transform_flags;
909 }
910 }
911 else
912 {
913 error = driver->clazz->load_glyph( slot,
914 face->size,
915 glyph_index,
916 load_flags );
917 if ( error )
918 goto Exit;
919
920 if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
921 {
922 /* check that the loaded outline is correct */
923 error = FT_Outline_Check( &slot->outline );
924 if ( error )
925 goto Exit;
926
927#ifdef GRID_FIT_METRICS
928 if ( !( load_flags & FT_LOAD_NO_HINTING ) )
930 FT_BOOL( load_flags & FT_LOAD_VERTICAL_LAYOUT ) );
931#endif
932 }
933 }
934
935 Load_Ok:
936 /* compute the advance */
937 if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
938 {
939 slot->advance.x = 0;
940 slot->advance.y = slot->metrics.vertAdvance;
941 }
942 else
943 {
944 slot->advance.x = slot->metrics.horiAdvance;
945 slot->advance.y = 0;
946 }
947
948 /* compute the linear advance in 16.16 pixels */
949 if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 &&
951 {
952 FT_Size_Metrics* metrics = &face->size->metrics;
953
954
955 /* it's tricky! */
956 slot->linearHoriAdvance = FT_MulDiv( slot->linearHoriAdvance,
957 metrics->x_scale, 64 );
958
959 slot->linearVertAdvance = FT_MulDiv( slot->linearVertAdvance,
960 metrics->y_scale, 64 );
961 }
962
963 if ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM ) == 0 )
964 {
965 FT_Face_Internal internal = face->internal;
966
967
968 /* now, transform the glyph image if needed */
969 if ( internal->transform_flags )
970 {
971 /* get renderer */
973
974
975 if ( renderer )
976 error = renderer->clazz->transform_glyph(
977 renderer, slot,
978 &internal->transform_matrix,
979 &internal->transform_delta );
980 else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
981 {
982 /* apply `standard' transformation if no renderer is available */
983 if ( internal->transform_flags & 1 )
984 FT_Outline_Transform( &slot->outline,
985 &internal->transform_matrix );
986
987 if ( internal->transform_flags & 2 )
988 FT_Outline_Translate( &slot->outline,
989 internal->transform_delta.x,
990 internal->transform_delta.y );
991 }
992
993 /* transform advance */
994 FT_Vector_Transform( &slot->advance, &internal->transform_matrix );
995 }
996 }
997
998 /* do we need to render the image or preset the bitmap now? */
999 if ( !error &&
1000 ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
1001 slot->format != FT_GLYPH_FORMAT_BITMAP &&
1002 slot->format != FT_GLYPH_FORMAT_COMPOSITE )
1003 {
1004 FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags );
1005
1006
1007 if ( mode == FT_RENDER_MODE_NORMAL &&
1008 load_flags & FT_LOAD_MONOCHROME )
1010
1011 if ( load_flags & FT_LOAD_RENDER )
1013 else
1015 }
1016
1017 FT_TRACE5(( "FT_Load_Glyph: index %d, flags %x\n",
1018 glyph_index, load_flags ));
1019 FT_TRACE5(( " x advance: %f\n", slot->advance.x / 64.0 ));
1020 FT_TRACE5(( " y advance: %f\n", slot->advance.y / 64.0 ));
1021 FT_TRACE5(( " linear x advance: %f\n",
1022 slot->linearHoriAdvance / 65536.0 ));
1023 FT_TRACE5(( " linear y advance: %f\n",
1024 slot->linearVertAdvance / 65536.0 ));
1025 FT_TRACE5(( " bitmap %dx%d, mode %d\n",
1026 slot->bitmap.width, slot->bitmap.rows,
1027 slot->bitmap.pixel_mode ));
1028
1029 Exit:
1030 return error;
1031 }
struct FT_AutoHinter_InterfaceRec_ * FT_AutoHinter_Interface
typedefFT_BEGIN_HEADER struct FT_AutoHinterRec_ * FT_AutoHinter
Definition: autohint.h:80
#define FT_LOAD_RENDER
Definition: freetype.h:3011
#define FT_LOAD_VERTICAL_LAYOUT
Definition: freetype.h:3013
#define FT_LOAD_TARGET_MODE(x)
Definition: freetype.h:3137
#define FT_LOAD_SBITS_ONLY
Definition: freetype.h:3032
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
FT_Vector_Transform(FT_Vector *vec, const FT_Matrix *matrix)
Definition: ftoutln.c:688
#define FT_LOAD_IGNORE_TRANSFORM
Definition: freetype.h:3019
#define FT_LOAD_NO_SCALE
Definition: freetype.h:3009
#define FT_LOAD_NO_RECURSE
Definition: freetype.h:3018
#define FT_LOAD_BITMAP_METRICS_ONLY
Definition: freetype.h:3026
enum FT_Render_Mode_ FT_Render_Mode
#define FT_LOAD_NO_HINTING
Definition: freetype.h:3010
#define FT_HAS_FIXED_SIZES(face)
Definition: freetype.h:1361
#define FT_LOAD_FORCE_AUTOHINT
Definition: freetype.h:3014
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1312
#define FT_LOAD_MONOCHROME
Definition: freetype.h:3020
#define FT_LOAD_NO_AUTOHINT
Definition: freetype.h:3022
#define FT_IS_TRICKY(face)
Definition: freetype.h:1474
#define FT_LOAD_LINEAR_DESIGN
Definition: freetype.h:3021
#define FT_HINTING_ADOBE
Definition: ftdriver.h:346
FT_BEGIN_HEADER FT_Get_Font_Format(FT_Face face)
Definition: ftfntfmt.c:28
static void ft_glyphslot_clear(FT_GlyphSlot slot)
Definition: ftobjs.c:496
static FT_Renderer ft_lookup_glyph_renderer(FT_GlyphSlot slot)
Definition: ftobjs.c:4306
ft_glyphslot_preset_bitmap(FT_GlyphSlot slot, FT_Render_Mode mode, const FT_Vector *origin)
Definition: ftobjs.c:334
static void ft_glyphslot_grid_fit_metrics(FT_GlyphSlot slot, FT_Bool vertical)
Definition: ftobjs.c:707
FT_Render_Glyph(FT_GlyphSlot slot, FT_Render_Mode render_mode)
Definition: ftobjs.c:4650
#define FT_DRIVER_HAS_HINTER(x)
Definition: ftobjs.h:568
#define FT_DRIVER_IS_SCALABLE(x)
Definition: ftobjs.h:562
#define FT_DRIVER_HINTS_LIGHTLY(x)
Definition: ftobjs.h:571
FT_Outline_Check(FT_Outline *outline)
Definition: ftoutln.c:357
FT_Outline_Translate(const FT_Outline *outline, FT_Pos xOffset, FT_Pos yOffset)
Definition: ftoutln.c:528
FT_Outline_Transform(const FT_Outline *outline, const FT_Matrix *matrix)
Definition: ftoutln.c:711
#define ft_strstr
Definition: ftstdlib.h:92
#define FT_BOOL(x)
Definition: fttypes.h:578
FT_BEGIN_HEADER struct PS_DriverRec_ * PS_Driver
FT_AutoHinter_GlyphLoadFunc load_glyph
Definition: autohint.h:195
FT_Module_Class * clazz
Definition: ftobjs.h:535
const void * module_interface
Definition: ftmodapi.h:225
FT_Renderer_TransformFunc transform_glyph
Definition: ftrender.h:152
TT_MaxProfile max_profile
Definition: tttypes.h:1404
FT_ULong num_locations
Definition: tttypes.h:1523
FT_ULong font_program_size
Definition: tttypes.h:1475
FT_ULong cvt_program_size
Definition: tttypes.h:1479
FT_UShort maxSizeOfInstructions
Definition: tttables.h:581
struct TT_FaceRec_ * TT_Face
Definition: tttypes.h:973
struct _slot slot
Definition: vfat.h:196

Referenced by af_latin_metrics_init_blues(), af_latin_metrics_init_widths(), af_loader_load_glyph(), FT_Get_Advances(), FT_Load_Char(), ftc_basic_family_load_bitmap(), ftc_basic_family_load_glyph(), ftGdiGetGlyphOutline(), gxv_ctlPoint_validate(), gxv_prop_zero_advance_validate(), IntGetRealGlyph(), NtGdiGetCharABCWidthsW(), NtGdiGetCharWidthW(), and TestFace().

◆ FT_Load_Sfnt_Table()

FT_Load_Sfnt_Table ( FT_Face  face,
FT_ULong  tag,
FT_Long  offset,
FT_Byte buffer,
FT_ULong length 
)

Definition at line 4134 of file ftobjs.c.

4139 {
4140 FT_Service_SFNT_Table service;
4141
4142
4143 if ( !face || !FT_IS_SFNT( face ) )
4144 return FT_THROW( Invalid_Face_Handle );
4145
4146 FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
4147 if ( !service )
4148 return FT_THROW( Unimplemented_Feature );
4149
4150 return service->load_table( face, tag, offset, buffer, length );
4151 }
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLintptr offset
Definition: glext.h:5920

Referenced by ftGdiGetFontData(), gxv_load_table(), IntFontType(), and otv_load_table().

◆ ft_lookup_glyph_renderer()

static FT_Renderer ft_lookup_glyph_renderer ( FT_GlyphSlot  slot)
static

Definition at line 4306 of file ftobjs.c.

4307 {
4308 FT_Face face = slot->face;
4311
4312
4313 if ( !result || result->glyph_format != slot->format )
4314 result = FT_Lookup_Renderer( library, slot->format, 0 );
4315
4316 return result;
4317 }
#define FT_FACE_LIBRARY(x)
Definition: ftobjs.h:635
FT_Renderer cur_renderer
Definition: ftobjs.h:928

Referenced by FT_Load_Glyph().

◆ FT_Lookup_Renderer()

FT_Lookup_Renderer ( FT_Library  library,
FT_Glyph_Format  format,
FT_ListNode node 
)

Definition at line 4264 of file ftobjs.c.

4267 {
4270
4271
4272 if ( !library )
4273 goto Exit;
4274
4276
4277 if ( node )
4278 {
4279 if ( *node )
4280 cur = (*node)->next;
4281 *node = NULL;
4282 }
4283
4284 while ( cur )
4285 {
4286 FT_Renderer renderer = FT_RENDERER( cur->data );
4287
4288
4289 if ( renderer->glyph_format == format )
4290 {
4291 if ( node )
4292 *node = cur;
4293
4294 result = renderer;
4295 break;
4296 }
4297 cur = cur->next;
4298 }
4299
4300 Exit:
4301 return result;
4302 }
FT_Glyph_Format glyph_format
Definition: ftobjs.h:775

Referenced by FT_Get_Glyph(), FT_Get_Renderer(), ft_lookup_glyph_renderer(), FT_Outline_Render(), FT_Render_Glyph_Internal(), and ft_set_current_renderer().

◆ FT_Match_Size()

FT_Match_Size ( FT_Face  face,
FT_Size_Request  req,
FT_Bool  ignore_width,
FT_ULong size_index 
)

Definition at line 2875 of file ftobjs.c.

2879 {
2880 FT_Int i;
2881 FT_Long w, h;
2882
2883
2884 if ( !FT_HAS_FIXED_SIZES( face ) )
2885 return FT_THROW( Invalid_Face_Handle );
2886
2887 /* FT_Bitmap_Size doesn't provide enough info... */
2888 if ( req->type != FT_SIZE_REQUEST_TYPE_NOMINAL )
2889 return FT_THROW( Unimplemented_Feature );
2890
2891 w = FT_REQUEST_WIDTH ( req );
2892 h = FT_REQUEST_HEIGHT( req );
2893
2894 if ( req->width && !req->height )
2895 h = w;
2896 else if ( !req->width && req->height )
2897 w = h;
2898
2899 w = FT_PIX_ROUND( w );
2900 h = FT_PIX_ROUND( h );
2901
2902 if ( !w || !h )
2903 return FT_THROW( Invalid_Pixel_Size );
2904
2905 for ( i = 0; i < face->num_fixed_sizes; i++ )
2906 {
2907 FT_Bitmap_Size* bsize = face->available_sizes + i;
2908
2909
2910 if ( h != FT_PIX_ROUND( bsize->y_ppem ) )
2911 continue;
2912
2913 if ( w == FT_PIX_ROUND( bsize->x_ppem ) || ignore_width )
2914 {
2915 FT_TRACE3(( "FT_Match_Size: bitmap strike %d matches\n", i ));
2916
2917 if ( size_index )
2918 *size_index = (FT_ULong)i;
2919
2920 return FT_Err_Ok;
2921 }
2922 }
2923
2924 FT_TRACE3(( "FT_Match_Size: no matching bitmap strike\n" ));
2925
2926 return FT_THROW( Invalid_Pixel_Size );
2927 }
@ FT_SIZE_REQUEST_TYPE_NOMINAL
Definition: freetype.h:2570
#define FT_TRACE3(varformat)
Definition: ftdebug.h:160
#define FT_REQUEST_WIDTH(req)
Definition: ftobjs.h:689
#define FT_REQUEST_HEIGHT(req)
Definition: ftobjs.h:694
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
FT_Pos y_ppem
Definition: freetype.h:379
FT_Pos x_ppem
Definition: freetype.h:378
FT_Size_Request_Type type
Definition: freetype.h:2619

Referenced by FT_Request_Size().

◆ ft_module_get_service()

ft_module_get_service ( FT_Module  module,
const char service_id,
FT_Bool  global 
)

Definition at line 4880 of file ftobjs.c.

4883 {
4885
4886
4887 if ( module )
4888 {
4889 FT_ASSERT( module->clazz && module->clazz->get_interface );
4890
4891 /* first, look for the service in the module */
4892 if ( module->clazz->get_interface )
4893 result = module->clazz->get_interface( module, service_id );
4894
4895 if ( global && !result )
4896 {
4897 /* we didn't find it, look in all other modules then */
4898 FT_Library library = module->library;
4901
4902
4903 for ( ; cur < limit; cur++ )
4904 {
4905 if ( cur[0] != module )
4906 {
4907 FT_ASSERT( cur[0]->clazz );
4908
4909 if ( cur[0]->clazz->get_interface )
4910 {
4911 result = cur[0]->clazz->get_interface( cur[0], service_id );
4912 if ( result )
4913 break;
4914 }
4915 }
4916 }
4917 }
4918 }
4919
4920 return result;
4921 }
int global
Definition: ehframes.cpp:22

Referenced by cff_get_glyph_name(), cff_get_name_index(), FT_DEFINE_SERVICE_PSINFOREC(), FT_Get_TrueType_Engine_Type(), if(), and sfnt_init_face().

◆ FT_New_Face()

FT_New_Face ( FT_Library  library,
const char pathname,
FT_Long  face_index,
FT_Face aface 
)

Definition at line 1406 of file ftobjs.c.

1410 {
1412
1413
1414 /* test for valid `library' and `aface' delayed to `FT_Open_Face' */
1415 if ( !pathname )
1416 return FT_THROW( Invalid_Argument );
1417
1418 args.flags = FT_OPEN_PATHNAME;
1419 args.pathname = (char*)pathname;
1420 args.stream = NULL;
1421
1422 return ft_open_face_internal( library, &args, face_index, aface, 1 );
1423 }
static FT_Error ft_open_face_internal(FT_Library library, const FT_Open_Args *args, FT_Long face_index, FT_Face *aface, FT_Bool test_mac_fonts)
Definition: ftobjs.c:2327
char pathname[512]
Definition: util.h:13
#define args
Definition: format.c:66
Definition: match.c:390

Referenced by ExecuteTest().

◆ FT_New_GlyphSlot()

FT_New_GlyphSlot ( FT_Face  face,
FT_GlyphSlot aslot 
)

Definition at line 559 of file ftobjs.c.

561 {
564 FT_Driver_Class clazz;
567
568
569 if ( !face )
570 return FT_THROW( Invalid_Face_Handle );
571
572 if ( !face->driver )
573 return FT_THROW( Invalid_Argument );
574
575 driver = face->driver;
576 clazz = driver->clazz;
577 memory = driver->root.memory;
578
579 FT_TRACE4(( "FT_New_GlyphSlot: Creating new slot object\n" ));
580 if ( !FT_ALLOC( slot, clazz->slot_object_size ) )
581 {
582 slot->face = face;
583
585 if ( error )
586 {
588 FT_FREE( slot );
589 goto Exit;
590 }
591
592 slot->next = face->glyph;
593 face->glyph = slot;
594
595 if ( aslot )
596 *aslot = slot;
597 }
598 else if ( aslot )
599 *aslot = NULL;
600
601
602 Exit:
603 FT_TRACE4(( "FT_New_GlyphSlot: Return 0x%x\n", error ));
604
605 return error;
606 }
#define FT_TRACE4(varformat)
Definition: ftdebug.h:161
static FT_Error ft_glyphslot_init(FT_GlyphSlot slot)
Definition: ftobjs.c:286
FT_Long slot_object_size
Definition: ftdrv.h:163

Referenced by ft_open_face_internal(), and T42_GlyphSlot_Init().

◆ FT_New_Library()

FT_New_Library ( FT_Memory  memory,
FT_Library alibrary 
)

Definition at line 5138 of file ftobjs.c.

5140 {
5143
5144
5145 if ( !memory || !alibrary )
5146 return FT_THROW( Invalid_Argument );
5147
5148#ifdef FT_DEBUG_LEVEL_ERROR
5149 /* init debugging support */
5150 ft_debug_init();
5151#endif
5152
5153 /* first of all, allocate the library object */
5154 if ( FT_NEW( library ) )
5155 return error;
5156
5158
5159#ifdef FT_CONFIG_OPTION_PIC
5160 /* initialize position independent code containers */
5161 error = ft_pic_container_init( library );
5162 if ( error )
5163 goto Fail;
5164#endif
5165
5169
5170 library->refcount = 1;
5171
5172 /* That's ok now */
5173 *alibrary = library;
5174
5175 return FT_Err_Ok;
5176
5177#ifdef FT_CONFIG_OPTION_PIC
5178 Fail:
5179 ft_pic_container_destroy( library );
5180 FT_FREE( library );
5181 return error;
5182#endif
5183 }
#define FREETYPE_PATCH
Definition: freetype.h:4555
ft_debug_init(void)
Definition: ftdebug.c:241

Referenced by FT_Init_FreeType().

◆ FT_New_Memory_Face()

FT_New_Memory_Face ( FT_Library  library,
const FT_Byte file_base,
FT_Long  file_size,
FT_Long  face_index,
FT_Face aface 
)

Definition at line 1431 of file ftobjs.c.

1436 {
1438
1439
1440 /* test for valid `library' and `face' delayed to `FT_Open_Face' */
1441 if ( !file_base )
1442 return FT_THROW( Invalid_Argument );
1443
1444 args.flags = FT_OPEN_MEMORY;
1445 args.memory_base = file_base;
1446 args.memory_size = file_size;
1447 args.stream = NULL;
1448
1449 return ft_open_face_internal( library, &args, face_index, aface, 1 );
1450 }
#define FT_OPEN_MEMORY
Definition: freetype.h:2034
static unsigned int file_size
Definition: regtests2xml.c:47

Referenced by FtfdLoadFontFile(), FtfdQueryFont(), FtfdQueryFontTree(), and IntGdiLoadFontsFromMemory().

◆ FT_New_Size()

FT_New_Size ( FT_Face  face,
FT_Size asize 
)

Definition at line 2762 of file ftobjs.c.

2764 {
2768 FT_Driver_Class clazz;
2769
2770 FT_Size size = NULL;
2772
2774
2775
2776 if ( !face )
2777 return FT_THROW( Invalid_Face_Handle );
2778
2779 if ( !asize )
2780 return FT_THROW( Invalid_Argument );
2781
2782 if ( !face->driver )
2783 return FT_THROW( Invalid_Driver_Handle );
2784
2785 *asize = NULL;
2786
2787 driver = face->driver;
2788 clazz = driver->clazz;
2789 memory = face->memory;
2790
2791 /* Allocate new size object and perform basic initialisation */
2792 if ( FT_ALLOC( size, clazz->size_object_size ) || FT_NEW( node ) )
2793 goto Exit;
2794
2795 size->face = face;
2796
2797 if ( FT_NEW( internal ) )
2798 goto Exit;
2799
2800 size->internal = internal;
2801
2802 if ( clazz->init_size )
2803 error = clazz->init_size( size );
2804
2805 /* in case of success, add to the face's list */
2806 if ( !error )
2807 {
2808 *asize = size;
2809 node->data = size;
2810 FT_List_Add( &face->sizes_list, node );
2811 }
2812
2813 Exit:
2814 if ( error )
2815 {
2816 FT_FREE( node );
2817 FT_FREE( size );
2818 }
2819
2820 return error;
2821 }
FT_Size_InitFunc init_size
Definition: ftdrv.h:168
FT_Long size_object_size
Definition: ftdrv.h:162

Referenced by ft_open_face_internal(), ftc_scaler_lookup_size(), and T42_Size_Init().

◆ FT_Open_Face()

FT_Open_Face ( FT_Library  library,
const FT_Open_Args args,
FT_Long  face_index,
FT_Face aface 
)

Definition at line 2317 of file ftobjs.c.

2321 {
2322 return ft_open_face_internal( library, args, face_index, aface, 1 );
2323 }

Referenced by T42_Face_Init().

◆ ft_open_face_internal()

static FT_Error ft_open_face_internal ( FT_Library  library,
const FT_Open_Args args,
FT_Long  face_index,
FT_Face aface,
FT_Bool  test_mac_fonts 
)
static

Definition at line 2327 of file ftobjs.c.

2332 {
2337 FT_Face face = NULL;
2339 FT_Bool external_stream;
2340 FT_Module* cur;
2342
2343#ifndef FT_CONFIG_OPTION_MAC_FONTS
2344 FT_UNUSED( test_mac_fonts );
2345#endif
2346
2347
2348#ifdef FT_DEBUG_LEVEL_TRACE
2349 FT_TRACE3(( "FT_Open_Face: " ));
2350 if ( face_index < 0 )
2351 FT_TRACE3(( "Requesting number of faces and named instances\n"));
2352 else
2353 {
2354 FT_TRACE3(( "Requesting face %ld", face_index & 0xFFFFL ));
2355 if ( face_index & 0x7FFF0000L )
2356 FT_TRACE3(( ", named instance %ld", face_index >> 16 ));
2357 FT_TRACE3(( "\n" ));
2358 }
2359#endif
2360
2361 /* test for valid `library' delayed to `FT_Stream_New' */
2362
2363 if ( ( !aface && face_index >= 0 ) || !args )
2364 return FT_THROW( Invalid_Argument );
2365
2366 external_stream = FT_BOOL( ( args->flags & FT_OPEN_STREAM ) &&
2367 args->stream );
2368
2369 /* create input stream */
2371 if ( error )
2372 goto Fail3;
2373
2375
2376 /* If the font driver is specified in the `args' structure, use */
2377 /* it. Otherwise, we scan the list of registered drivers. */
2378 if ( ( args->flags & FT_OPEN_DRIVER ) && args->driver )
2379 {
2380 driver = FT_DRIVER( args->driver );
2381
2382 /* not all modules are drivers, so check... */
2383 if ( FT_MODULE_IS_DRIVER( driver ) )
2384 {
2385 FT_Int num_params = 0;
2387
2388
2389 if ( args->flags & FT_OPEN_PARAMS )
2390 {
2391 num_params = args->num_params;
2392 params = args->params;
2393 }
2394
2395 error = open_face( driver, &stream, external_stream, face_index,
2396 num_params, params, &face );
2397 if ( !error )
2398 goto Success;
2399 }
2400 else
2401 error = FT_THROW( Invalid_Handle );
2402
2403 FT_Stream_Free( stream, external_stream );
2404 goto Fail;
2405 }
2406 else
2407 {
2408 error = FT_ERR( Missing_Module );
2409
2410 /* check each font driver for an appropriate format */
2411 cur = library->modules;
2413
2414 for ( ; cur < limit; cur++ )
2415 {
2416 /* not all modules are font drivers, so check... */
2417 if ( FT_MODULE_IS_DRIVER( cur[0] ) )
2418 {
2419 FT_Int num_params = 0;
2421
2422
2423 driver = FT_DRIVER( cur[0] );
2424
2425 if ( args->flags & FT_OPEN_PARAMS )
2426 {
2427 num_params = args->num_params;
2428 params = args->params;
2429 }
2430
2431 error = open_face( driver, &stream, external_stream, face_index,
2432 num_params, params, &face );
2433 if ( !error )
2434 goto Success;
2435
2436#ifdef FT_CONFIG_OPTION_MAC_FONTS
2437 if ( test_mac_fonts &&
2438 ft_strcmp( cur[0]->clazz->module_name, "truetype" ) == 0 &&
2439 FT_ERR_EQ( error, Table_Missing ) )
2440 {
2441 /* TrueType but essential tables are missing */
2442 error = FT_Stream_Seek( stream, 0 );
2443 if ( error )
2444 break;
2445
2446 error = open_face_PS_from_sfnt_stream( library,
2447 stream,
2448 face_index,
2449 num_params,
2450 params,
2451 aface );
2452 if ( !error )
2453 {
2454 FT_Stream_Free( stream, external_stream );
2455 return error;
2456 }
2457 }
2458#endif
2459
2460 if ( FT_ERR_NEQ( error, Unknown_File_Format ) )
2461 goto Fail3;
2462 }
2463 }
2464
2465 Fail3:
2466 /* If we are on the mac, and we get an */
2467 /* FT_Err_Invalid_Stream_Operation it may be because we have an */
2468 /* empty data fork, so we need to check the resource fork. */
2469 if ( FT_ERR_NEQ( error, Cannot_Open_Stream ) &&
2470 FT_ERR_NEQ( error, Unknown_File_Format ) &&
2471 FT_ERR_NEQ( error, Invalid_Stream_Operation ) )
2472 goto Fail2;
2473
2474#if !defined( FT_MACINTOSH ) && defined( FT_CONFIG_OPTION_MAC_FONTS )
2475 if ( test_mac_fonts )
2476 {
2477 error = load_mac_face( library, stream, face_index, aface, args );
2478 if ( !error )
2479 {
2480 /* We don't want to go to Success here. We've already done */
2481 /* that. On the other hand, if we succeeded we still need to */
2482 /* close this stream (we opened a different stream which */
2483 /* extracted the interesting information out of this stream */
2484 /* here. That stream will still be open and the face will */
2485 /* point to it). */
2486 FT_Stream_Free( stream, external_stream );
2487 return error;
2488 }
2489 }
2490
2491 if ( FT_ERR_NEQ( error, Unknown_File_Format ) )
2492 goto Fail2;
2493#endif /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */
2494
2495 /* no driver is able to handle this format */
2496 error = FT_THROW( Unknown_File_Format );
2497
2498 Fail2:
2499 FT_Stream_Free( stream, external_stream );
2500 goto Fail;
2501 }
2502
2503 Success:
2504 FT_TRACE4(( "FT_Open_Face: New face object, adding to list\n" ));
2505
2506 /* add the face object to its driver's list */
2507 if ( FT_NEW( node ) )
2508 goto Fail;
2509
2510 node->data = face;
2511 /* don't assume driver is the same as face->driver, so use */
2512 /* face->driver instead. */
2513 FT_List_Add( &face->driver->faces_list, node );
2514
2515 /* now allocate a glyph slot object for the face */
2516 FT_TRACE4(( "FT_Open_Face: Creating glyph slot\n" ));
2517
2518 if ( face_index >= 0 )
2519 {
2521 if ( error )
2522 goto Fail;
2523
2524 /* finally, allocate a size object for the face */
2525 {
2526 FT_Size size;
2527
2528
2529 FT_TRACE4(( "FT_Open_Face: Creating size object\n" ));
2530
2531 error = FT_New_Size( face, &size );
2532 if ( error )
2533 goto Fail;
2534
2535 face->size = size;
2536 }
2537 }
2538
2539 /* some checks */
2540
2541 if ( FT_IS_SCALABLE( face ) )
2542 {
2543 if ( face->height < 0 )
2544 face->height = (FT_Short)-face->height;
2545
2546 if ( !FT_HAS_VERTICAL( face ) )
2547 face->max_advance_height = (FT_Short)face->height;
2548 }
2549
2550 if ( FT_HAS_FIXED_SIZES( face ) )
2551 {
2552 FT_Int i;
2553
2554
2555 for ( i = 0; i < face->num_fixed_sizes; i++ )
2556 {
2557 FT_Bitmap_Size* bsize = face->available_sizes + i;
2558
2559
2560 if ( bsize->height < 0 )
2561 bsize->height = -bsize->height;
2562 if ( bsize->x_ppem < 0 )
2563 bsize->x_ppem = -bsize->x_ppem;
2564 if ( bsize->y_ppem < 0 )
2565 bsize->y_ppem = -bsize->y_ppem;
2566
2567 /* check whether negation actually has worked */
2568 if ( bsize->height < 0 || bsize->x_ppem < 0 || bsize->y_ppem < 0 )
2569 {
2570 FT_TRACE0(( "FT_Open_Face:"
2571 " Invalid bitmap dimensions for strike %d,"
2572 " now disabled\n", i ));
2573 bsize->width = 0;
2574 bsize->height = 0;
2575 bsize->size = 0;
2576 bsize->x_ppem = 0;
2577 bsize->y_ppem = 0;
2578 }
2579 }
2580 }
2581
2582 /* initialize internal face data */
2583 {
2584 FT_Face_Internal internal = face->internal;
2585
2586
2587 internal->transform_matrix.xx = 0x10000L;
2588 internal->transform_matrix.xy = 0;
2589 internal->transform_matrix.yx = 0;
2590 internal->transform_matrix.yy = 0x10000L;
2591
2592 internal->transform_delta.x = 0;
2593 internal->transform_delta.y = 0;
2594
2595 internal->refcount = 1;
2596
2597 internal->no_stem_darkening = -1;
2598
2599#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
2600 /* Per-face filtering can only be set up by FT_Face_Properties */
2601 internal->lcd_filter_func = NULL;
2602#endif
2603 }
2604
2605 if ( aface )
2606 *aface = face;
2607 else
2608 FT_Done_Face( face );
2609
2610 goto Exit;
2611
2612 Fail:
2613 if ( node )
2614 FT_Done_Face( face ); /* face must be in the driver's list */
2615 else if ( face )
2617
2618 Exit:
2619#ifdef FT_DEBUG_LEVEL_TRACE
2620 if ( !error && face_index < 0 )
2621 {
2622 FT_TRACE3(( "FT_Open_Face: The font has %ld face%s\n"
2623 " and %ld named instance%s for face %ld\n",
2624 face->num_faces,
2625 face->num_faces == 1 ? "" : "s",
2626 face->style_flags >> 16,
2627 ( face->style_flags >> 16 ) == 1 ? "" : "s",
2628 -face_index - 1 ));
2629 }
2630#endif
2631
2632 FT_TRACE4(( "FT_Open_Face: Return 0x%x\n", error ));
2633
2634 return error;
2635 }
@ Success
Definition: eventcreate.c:712
#define FT_OPEN_PARAMS
Definition: freetype.h:2038
#define FT_OPEN_DRIVER
Definition: freetype.h:2037
#define FT_HAS_VERTICAL(face)
Definition: freetype.h:1283
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
static FT_Error open_face(FT_Driver driver, FT_Stream *astream, FT_Bool external_stream, FT_Long face_index, FT_Int num_params, FT_Parameter *params, FT_Face *aface)
Definition: ftobjs.c:1306
FT_New_GlyphSlot(FT_Face face, FT_GlyphSlot *aslot)
Definition: ftobjs.c:559
FT_New_Size(FT_Face face, FT_Size *asize)
Definition: ftobjs.c:2762
FT_Stream_Seek(FT_Stream stream, FT_ULong pos)
Definition: ftstream.c:57
#define FT_ERR_EQ(x, e)
Definition: fttypes.h:591
#define FT_ERR_NEQ(x, e)
Definition: fttypes.h:593
signed short FT_Short
Definition: fttypes.h:198
GLenum const GLfloat * params
Definition: glext.h:5645
FT_Short width
Definition: freetype.h:374
FT_Short height
Definition: freetype.h:373

Referenced by FT_New_Face(), FT_New_Memory_Face(), and FT_Open_Face().

◆ ft_property_do()

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 
)
static

Definition at line 4967 of file ftobjs.c.

4973 {
4974 FT_Module* cur;
4977
4978 FT_Service_Properties service;
4979
4980#ifdef FT_DEBUG_LEVEL_ERROR
4981 const FT_String* set_name = "FT_Property_Set";
4982 const FT_String* get_name = "FT_Property_Get";
4984#endif
4985
4986 FT_Bool missing_func;
4987
4988
4989 if ( !library )
4990 return FT_THROW( Invalid_Library_Handle );
4991
4992 if ( !module_name || !property_name || !value )
4993 return FT_THROW( Invalid_Argument );
4994
4995 cur = library->modules;
4997
4998 /* search module */
4999 for ( ; cur < limit; cur++ )
5000 if ( !ft_strcmp( cur[0]->clazz->module_name, module_name ) )
5001 break;
5002
5003 if ( cur == limit )
5004 {
5005 FT_ERROR(( "%s: can't find module `%s'\n",
5007 return FT_THROW( Missing_Module );
5008 }
5009
5010 /* check whether we have a service interface */
5011 if ( !cur[0]->clazz->get_interface )
5012 {
5013 FT_ERROR(( "%s: module `%s' doesn't support properties\n",
5015 return FT_THROW( Unimplemented_Feature );
5016 }
5017
5018 /* search property service */
5019 interface = cur[0]->clazz->get_interface( cur[0],
5021 if ( !interface )
5022 {
5023 FT_ERROR(( "%s: module `%s' doesn't support properties\n",
5025 return FT_THROW( Unimplemented_Feature );
5026 }
5027
5028 service = (FT_Service_Properties)interface;
5029
5030 if ( set )
5031 missing_func = (FT_Bool)( !service->set_property );
5032 else
5033 missing_func = (FT_Bool)( !service->get_property );
5034
5035 if ( missing_func )
5036 {
5037 FT_ERROR(( "%s: property service of module `%s' is broken\n",
5039 return FT_THROW( Unimplemented_Feature );
5040 }
5041
5042 return set ? service->set_property( cur[0],
5043 property_name,
5044 value,
5045 value_is_string )
5046 : service->get_property( cur[0],
5047 property_name,
5048 value );
5049 }
int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name)
Definition: util.c:55
#define interface
Definition: basetyps.h:61
Definition: _set.h:50
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
char FT_String
Definition: fttypes.h:187
void func_name(void)
#define FT_SERVICE_ID_PROPERTIES
Definition: svprop.h:26
Definition: pdh_main.c:94
static void set_name(msft_typelib_t *typelib)
Definition: write_msft.c:2395

Referenced by FT_Property_Get(), and FT_Property_Set().

◆ FT_Property_Get()

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

Definition at line 5072 of file ftobjs.c.

5076 {
5077 return ft_property_do( library,
5079 property_name,
5080 value,
5081 FALSE,
5082 FALSE );
5083 }
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:4967

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

5059 {
5060 return ft_property_do( library,
5062 property_name,
5063 (void*)value,
5064 TRUE,
5065 FALSE );
5066 }

◆ ft_recompute_scaled_metrics()

static void ft_recompute_scaled_metrics ( FT_Face  face,
FT_Size_Metrics metrics 
)
static

Definition at line 2959 of file ftobjs.c.

2961 {
2962 /* Compute root ascender, descender, test height, and max_advance */
2963
2964#ifdef GRID_FIT_METRICS
2965 metrics->ascender = FT_PIX_CEIL( FT_MulFix( face->ascender,
2966 metrics->y_scale ) );
2967
2968 metrics->descender = FT_PIX_FLOOR( FT_MulFix( face->descender,
2969 metrics->y_scale ) );
2970
2971 metrics->height = FT_PIX_ROUND( FT_MulFix( face->height,
2972 metrics->y_scale ) );
2973
2974 metrics->max_advance = FT_PIX_ROUND( FT_MulFix( face->max_advance_width,
2975 metrics->x_scale ) );
2976#else /* !GRID_FIT_METRICS */
2977 metrics->ascender = FT_MulFix( face->ascender,
2978 metrics->y_scale );
2979
2980 metrics->descender = FT_MulFix( face->descender,
2981 metrics->y_scale );
2982
2983 metrics->height = FT_MulFix( face->height,
2984 metrics->y_scale );
2985
2986 metrics->max_advance = FT_MulFix( face->max_advance_width,
2987 metrics->x_scale );
2988#endif /* !GRID_FIT_METRICS */
2989 }
#define FT_PIX_CEIL(x)
Definition: ftobjs.h:94

Referenced by FT_Request_Metrics(), and FT_Select_Metrics().

◆ FT_Reference_Face()

FT_Reference_Face ( FT_Face  face)

Definition at line 2707 of file ftobjs.c.

2708 {
2709 if ( !face )
2710 return FT_THROW( Invalid_Face_Handle );
2711
2712 face->internal->refcount++;
2713
2714 return FT_Err_Ok;
2715 }

◆ FT_Reference_Library()

FT_Reference_Library ( FT_Library  library)

Definition at line 5124 of file ftobjs.c.

5125 {
5126 if ( !library )
5127 return FT_THROW( Invalid_Library_Handle );
5128
5129 library->refcount++;
5130
5131 return FT_Err_Ok;
5132 }

◆ FT_Remove_Module()

FT_Remove_Module ( FT_Library  library,
FT_Module  module 
)

Definition at line 4927 of file ftobjs.c.

4929 {
4930 /* try to find the module from the table, then remove it from there */
4931
4932 if ( !library )
4933 return FT_THROW( Invalid_Library_Handle );
4934
4935 if ( module )
4936 {
4939
4940
4941 for ( ; cur < limit; cur++ )
4942 {
4943 if ( cur[0] == module )
4944 {
4945 /* remove it from the table */
4947 limit--;
4948 while ( cur < limit )
4949 {
4950 cur[0] = cur[1];
4951 cur++;
4952 }
4953 limit[0] = NULL;
4954
4955 /* destroy the module */
4957
4958 return FT_Err_Ok;
4959 }
4960 }
4961 }
4962 return FT_THROW( Invalid_Driver_Handle );
4963 }

Referenced by FT_Add_Module(), and FT_Done_Library().

◆ ft_remove_renderer()

static void ft_remove_renderer ( FT_Module  module)
static

Definition at line 4380 of file ftobjs.c.

4381 {
4385
4386
4387 library = module->library;
4388 if ( !library )
4389 return;
4390
4392
4394 if ( node )
4395 {
4397
4398
4399 /* release raster object, if any */
4400 if ( render->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE &&
4401 render->raster )
4402 render->clazz->raster_class->raster_done( render->raster );
4403
4404 /* remove from list */
4406 FT_FREE( node );
4407
4409 }
4410 }

Referenced by Destroy_Module().

◆ FT_Render_Glyph()

FT_Render_Glyph ( FT_GlyphSlot  slot,
FT_Render_Mode  render_mode 
)

Definition at line 4650 of file ftobjs.c.

4652 {
4654
4655
4656 if ( !slot || !slot->face )
4657 return FT_THROW( Invalid_Argument );
4658
4659 library = FT_FACE_LIBRARY( slot->face );
4660
4661 return FT_Render_Glyph_Internal( library, slot, render_mode );
4662 }
FT_Render_Glyph_Internal(FT_Library library, FT_GlyphSlot slot, FT_Render_Mode render_mode)
Definition: ftobjs.c:4485

Referenced by FT_Load_Glyph(), and TestFace().

◆ FT_Render_Glyph_Internal()

FT_Render_Glyph_Internal ( FT_Library  library,
FT_GlyphSlot  slot,
FT_Render_Mode  render_mode 
)

Definition at line 4485 of file ftobjs.c.

4488 {
4490 FT_Renderer renderer;
4491
4492
4493 /* if it is already a bitmap, no need to do anything */
4494 switch ( slot->format )
4495 {
4496 case FT_GLYPH_FORMAT_BITMAP: /* already a bitmap, don't do anything */
4497 break;
4498
4499 default:
4500 {
4502
4503
4504 /* small shortcut for the very common case */
4505 if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
4506 {
4507 renderer = library->cur_renderer;
4509 }
4510 else
4511 renderer = FT_Lookup_Renderer( library, slot->format, &node );
4512
4513 error = FT_ERR( Unimplemented_Feature );
4514 while ( renderer )
4515 {
4516 error = renderer->render( renderer, slot, render_mode, NULL );
4517 if ( !error ||
4518 FT_ERR_NEQ( error, Cannot_Render_Glyph ) )
4519 break;
4520
4521 /* FT_Err_Cannot_Render_Glyph is returned if the render mode */
4522 /* is unsupported by the current renderer for this glyph image */
4523 /* format. */
4524
4525 /* now, look for another renderer that supports the same */
4526 /* format. */
4527 renderer = FT_Lookup_Renderer( library, slot->format, &node );
4528 }
4529 }
4530 }
4531
4532#ifdef FT_DEBUG_LEVEL_TRACE
4533
4534#undef FT_COMPONENT
4535#define FT_COMPONENT trace_bitmap
4536
4537 /*
4538 * Computing the MD5 checksum is expensive, unnecessarily distorting a
4539 * possible profiling of FreeType if compiled with tracing support. For
4540 * this reason, we execute the following code only if explicitly
4541 * requested.
4542 */
4543
4544 /* we use FT_TRACE3 in this block */
4545 if ( !error &&
4546 ft_trace_levels[trace_bitmap] >= 3 &&
4547 slot->bitmap.buffer )
4548 {
4550 FT_Error err;
4551
4552
4554
4555 /* we convert to a single bitmap format for computing the checksum */
4556 /* this also converts the bitmap flow to `down' (i.e., pitch > 0) */
4557 err = FT_Bitmap_Convert( library, &slot->bitmap, &bitmap, 1 );
4558 if ( !err )
4559 {
4560 MD5_CTX ctx;
4561 unsigned char md5[16];
4562 unsigned long coverage = 0;
4563 int i, j;
4564 int rows = (int)bitmap.rows;
4565 int pitch = bitmap.pitch;
4566
4567
4568 FT_TRACE3(( "FT_Render_Glyph: bitmap %dx%d, mode %d\n",
4569 rows, pitch, slot->bitmap.pixel_mode ));
4570
4571 for ( i = 0; i < rows; i++ )
4572 for ( j = 0; j < pitch; j++ )
4573 coverage += bitmap.buffer[i * pitch + j];
4574
4575 FT_TRACE3(( " Total coverage: %lu\n", coverage ));
4576
4577 MD5_Init( &ctx );
4578 if ( bitmap.buffer )
4579 MD5_Update( &ctx, bitmap.buffer,
4580 (unsigned long)rows * (unsigned long)pitch );
4581 MD5_Final( md5, &ctx );
4582
4583 FT_TRACE3(( " MD5 checksum: " ));
4584 for ( i = 0; i < 16; i++ )
4585 FT_TRACE3(( "%02X", md5[i] ));
4586 FT_TRACE3(( "\n" ));
4587 }
4588
4590 }
4591
4592 /*
4593 * Dump bitmap in Netpbm format (PBM or PGM).
4594 */
4595
4596 /* we use FT_TRACE7 in this block */
4597 if ( !error &&
4598 ft_trace_levels[trace_bitmap] >= 7 &&
4599 slot->bitmap.rows < 128U &&
4600 slot->bitmap.width < 128U &&
4601 slot->bitmap.buffer )
4602 {
4603 int rows = (int)slot->bitmap.rows;
4604 int width = (int)slot->bitmap.width;
4605 int pitch = slot->bitmap.pitch;
4606 int i, j, m;
4607 unsigned char* topleft = slot->bitmap.buffer;
4608
4609 if ( pitch < 0 )
4610 topleft -= pitch * ( rows - 1 );
4611
4612 FT_TRACE7(( "Netpbm image: start\n" ));
4613 switch ( slot->bitmap.pixel_mode )
4614 {
4615 case FT_PIXEL_MODE_MONO:
4616 FT_TRACE7(( "P1 %d %d\n", width, rows ));
4617 for ( i = 0; i < rows; i++ )
4618 {
4619 for ( j = 0; j < width; )
4620 for ( m = 128; m > 0 && j < width; m >>= 1, j++ )
4621 FT_TRACE7(( " %d", ( topleft[i * pitch + j / 8] & m ) != 0 ));
4622 FT_TRACE7(( "\n" ));
4623 }
4624 break;
4625
4626 default:
4627 FT_TRACE7(( "P2 %d %d 255\n", width, rows ));
4628 for ( i = 0; i < rows; i++ )
4629 {
4630 for ( j = 0; j < width; j += 1 )
4631 FT_TRACE7(( " %3u", topleft[i * pitch + j] ));
4632 FT_TRACE7(( "\n" ));
4633 }
4634 }
4635 FT_TRACE7(( "Netpbm image: end\n" ));
4636 }
4637
4638#undef FT_COMPONENT
4639#define FT_COMPONENT trace_objs
4640
4641#endif /* FT_DEBUG_LEVEL_TRACE */
4642
4643 return error;
4644 }
#define md5
Definition: compat-1.3.h:2034
FT_Bitmap_Convert(FT_Library library, const FT_Bitmap *source, FT_Bitmap *target, FT_Int alignment)
Definition: ftbitmap.c:504
FT_BEGIN_HEADER FT_Bitmap_Init(FT_Bitmap *abitmap)
Definition: ftbitmap.c:34
FT_Bitmap_Done(FT_Library library, FT_Bitmap *bitmap)
Definition: ftbitmap.c:826
#define err(...)
void MD5_Init(MD5_CTX *ctx)
Definition: md5.c:207
void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size)
Definition: md5.c:218
void MD5_Final(unsigned char *result, MD5_CTX *ctx)
Definition: md5.c:258
FT_Renderer_RenderFunc render
Definition: ftobjs.h:780
Definition: msi.c:4013

Referenced by FT_Glyph_To_Bitmap(), and FT_Render_Glyph().

◆ FT_Request_Metrics()

FT_Request_Metrics ( FT_Face  face,
FT_Size_Request  req 
)

Definition at line 3028 of file ftobjs.c.

3030 {
3032
3033
3034 metrics = &face->size->metrics;
3035
3036 if ( FT_IS_SCALABLE( face ) )
3037 {
3038 FT_Long w = 0, h = 0, scaled_w = 0, scaled_h = 0;
3039
3040
3041 switch ( req->type )
3042 {
3044 w = h = face->units_per_EM;
3045 break;
3046
3048 w = h = face->ascender - face->descender;
3049 break;
3050
3052 w = face->bbox.xMax - face->bbox.xMin;
3053 h = face->bbox.yMax - face->bbox.yMin;
3054 break;
3055
3057 w = face->max_advance_width;
3058 h = face->ascender - face->descender;
3059 break;
3060
3062 metrics->x_scale = (FT_Fixed)req->width;
3063 metrics->y_scale = (FT_Fixed)req->height;
3064 if ( !metrics->x_scale )
3065 metrics->x_scale = metrics->y_scale;
3066 else if ( !metrics->y_scale )
3067 metrics->y_scale = metrics->x_scale;
3068 goto Calculate_Ppem;
3069
3071 break;
3072 }
3073
3074 /* to be on the safe side */
3075 if ( w < 0 )
3076 w = -w;
3077
3078 if ( h < 0 )
3079 h = -h;
3080
3081 scaled_w = FT_REQUEST_WIDTH ( req );
3082 scaled_h = FT_REQUEST_HEIGHT( req );
3083
3084 /* determine scales */
3085 if ( req->width )
3086 {
3087 metrics->x_scale = FT_DivFix( scaled_w, w );
3088
3089 if ( req->height )
3090 {
3091 metrics->y_scale = FT_DivFix( scaled_h, h );
3092
3093 if ( req->type == FT_SIZE_REQUEST_TYPE_CELL )
3094 {
3095 if ( metrics->y_scale > metrics->x_scale )
3096 metrics->y_scale = metrics->x_scale;
3097 else
3098 metrics->x_scale = metrics->y_scale;
3099 }
3100 }
3101 else
3102 {
3103 metrics->y_scale = metrics->x_scale;
3104 scaled_h = FT_MulDiv( scaled_w, h, w );
3105 }
3106 }
3107 else
3108 {
3109 metrics->x_scale = metrics->y_scale = FT_DivFix( scaled_h, h );
3110 scaled_w = FT_MulDiv( scaled_h, w, h );
3111 }
3112
3113 Calculate_Ppem:
3114 /* calculate the ppems */
3115 if ( req->type != FT_SIZE_REQUEST_TYPE_NOMINAL )
3116 {
3117 scaled_w = FT_MulFix( face->units_per_EM, metrics->x_scale );
3118 scaled_h = FT_MulFix( face->units_per_EM, metrics->y_scale );
3119 }
3120
3121 metrics->x_ppem = (FT_UShort)( ( scaled_w + 32 ) >> 6 );
3122 metrics->y_ppem = (FT_UShort)( ( scaled_h + 32 ) >> 6 );
3123
3125 }
3126 else
3127 {
3128 FT_ZERO( metrics );
3129 metrics->x_scale = 1L << 16;
3130 metrics->y_scale = 1L << 16;
3131 }
3132 }
@ FT_SIZE_REQUEST_TYPE_BBOX
Definition: freetype.h:2572
@ FT_SIZE_REQUEST_TYPE_REAL_DIM
Definition: freetype.h:2571
@ FT_SIZE_REQUEST_TYPE_SCALES
Definition: freetype.h:2574
@ FT_SIZE_REQUEST_TYPE_MAX
Definition: freetype.h:2576
@ FT_SIZE_REQUEST_TYPE_CELL
Definition: freetype.h:2573
FT_DivFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:608
static void ft_recompute_scaled_metrics(FT_Face face, FT_Size_Metrics *metrics)
Definition: ftobjs.c:2959
signed long FT_Fixed
Definition: fttypes.h:288
unsigned short FT_UShort
Definition: fttypes.h:209

Referenced by cff_size_request(), cid_size_request(), FT_Request_Size(), T1_Size_Request(), and tt_size_request().

◆ FT_Request_Size()

FT_Request_Size ( FT_Face  face,
FT_Size_Request  req 
)

Definition at line 3192 of file ftobjs.c.

3194 {
3196 FT_Driver_Class clazz;
3197 FT_ULong strike_index;
3198
3199
3200 if ( !face )
3201 return FT_THROW( Invalid_Face_Handle );
3202
3203 if ( !req || req->width < 0 || req->height < 0 ||
3205 return FT_THROW( Invalid_Argument );
3206
3207 /* signal the auto-hinter to recompute its size metrics */
3208 /* (if requested) */
3209 face->size->internal->autohint_metrics.x_scale = 0;
3210
3211 clazz = face->driver->clazz;
3212
3213 if ( clazz->request_size )
3214 {
3215 error = clazz->request_size( face->size, req );
3216
3217 FT_TRACE5(( "FT_Request_Size (%s driver):\n",
3218 face->driver->root.clazz->module_name ));
3219 }
3220 else if ( !FT_IS_SCALABLE( face ) && FT_HAS_FIXED_SIZES( face ) )
3221 {
3222 /*
3223 * The reason that a driver doesn't have `request_size' defined is
3224 * either that the scaling here suffices or that the supported formats
3225 * are bitmap-only and size matching is not implemented.
3226 *
3227 * In the latter case, a simple size matching is done.
3228 */
3229 error = FT_Match_Size( face, req, 0, &strike_index );
3230 if ( error )
3231 return error;
3232
3233 return FT_Select_Size( face, (FT_Int)strike_index );
3234 }
3235 else
3236 {
3237 FT_Request_Metrics( face, req );
3238
3239 FT_TRACE5(( "FT_Request_Size:\n" ));
3240 }
3241
3242#ifdef FT_DEBUG_LEVEL_TRACE
3243 {
3244 FT_Size_Metrics* metrics = &face->size->metrics;
3245
3246
3247 FT_TRACE5(( " x scale: %d (%f)\n",
3248 metrics->x_scale, metrics->x_scale / 65536.0 ));
3249 FT_TRACE5(( " y scale: %d (%f)\n",
3250 metrics->y_scale, metrics->y_scale / 65536.0 ));
3251 FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
3252 FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
3253 FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
3254 FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
3255 FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
3256 FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
3257 }
3258#endif
3259
3260 return error;
3261 }
FT_Match_Size(FT_Face face, FT_Size_Request req, FT_Bool ignore_width, FT_ULong *size_index)
Definition: ftobjs.c:2875
FT_Select_Size(FT_Face face, FT_Int strike_index)
Definition: ftobjs.c:3138
FT_Request_Metrics(FT_Face face, FT_Size_Request req)
Definition: ftobjs.c:3028
FT_Size_RequestFunc request_size
Definition: ftdrv.h:181

Referenced by FT_Set_Char_Size(), FT_Set_Pixel_Sizes(), IntRequestFontSize(), and T42_Size_Request().

◆ FT_Select_Charmap()

FT_Select_Charmap ( FT_Face  face,
FT_Encoding  encoding 
)

Definition at line 3457 of file ftobjs.c.

3459 {
3460 FT_CharMap* cur;
3462
3463
3464 if ( !face )
3465 return FT_THROW( Invalid_Face_Handle );
3466
3467 if ( encoding == FT_ENCODING_NONE )
3468 return FT_THROW( Invalid_Argument );
3469
3470 /* FT_ENCODING_UNICODE is special. We try to find the `best' Unicode */
3471 /* charmap available, i.e., one with UCS-4 characters, if possible. */
3472 /* */
3473 /* This is done by find_unicode_charmap() above, to share code. */
3474 if ( encoding == FT_ENCODING_UNICODE )
3475 return find_unicode_charmap( face );
3476
3477 cur = face->charmaps;
3478 if ( !cur )
3479 return FT_THROW( Invalid_CharMap_Handle );
3480
3481 limit = cur + face->num_charmaps;
3482
3483 for ( ; cur < limit; cur++ )
3484 {
3485 if ( cur[0]->encoding == encoding )
3486 {
3487 face->charmap = cur[0];
3488 return 0;
3489 }
3490 }
3491
3492 return FT_THROW( Invalid_Argument );
3493 }
static FT_Error find_unicode_charmap(FT_Face face)
Definition: ftobjs.c:1180

Referenced by af_face_globals_compute_style_coverage(), af_latin_metrics_init(), and FtfdLoadFontFile().

◆ FT_Select_Metrics()

FT_Select_Metrics ( FT_Face  face,
FT_ULong  strike_index 
)

Definition at line 2993 of file ftobjs.c.

2995 {
2997 FT_Bitmap_Size* bsize;
2998
2999
3000 metrics = &face->size->metrics;
3001 bsize = face->available_sizes + strike_index;
3002
3003 metrics->x_ppem = (FT_UShort)( ( bsize->x_ppem + 32 ) >> 6 );
3004 metrics->y_ppem = (FT_UShort)( ( bsize->y_ppem + 32 ) >> 6 );
3005
3006 if ( FT_IS_SCALABLE( face ) )
3007 {
3008 metrics->x_scale = FT_DivFix( bsize->x_ppem,
3009 face->units_per_EM );
3010 metrics->y_scale = FT_DivFix( bsize->y_ppem,
3011 face->units_per_EM );
3012
3014 }
3015 else
3016 {
3017 metrics->x_scale = 1L << 16;
3018 metrics->y_scale = 1L << 16;
3019 metrics->ascender = bsize->y_ppem;
3020 metrics->descender = 0;
3021 metrics->height = bsize->height << 6;
3022 metrics->max_advance = bsize->x_ppem;
3023 }
3024 }

Referenced by BDF_Size_Select(), FNT_Size_Select(), FT_Select_Size(), and PCF_Size_Select().

◆ FT_Select_Size()

FT_Select_Size ( FT_Face  face,
FT_Int  strike_index 
)

Definition at line 3138 of file ftobjs.c.

3140 {
3142 FT_Driver_Class clazz;
3143
3144
3145 if ( !face || !FT_HAS_FIXED_SIZES( face ) )
3146 return FT_THROW( Invalid_Face_Handle );
3147
3148 if ( strike_index < 0 || strike_index >= face->num_fixed_sizes )
3149 return FT_THROW( Invalid_Argument );
3150
3151 clazz = face->driver->clazz;
3152
3153 if ( clazz->select_size )
3154 {
3155 error = clazz->select_size( face->size, (FT_ULong)strike_index );
3156
3157 FT_TRACE5(( "FT_Select_Size (%s driver):\n",
3158 face->driver->root.clazz->module_name ));
3159 }
3160 else
3161 {
3162 FT_Select_Metrics( face, (FT_ULong)strike_index );
3163
3164 FT_TRACE5(( "FT_Select_Size:\n" ));
3165 }
3166
3167#ifdef FT_DEBUG_LEVEL_TRACE
3168 {
3169 FT_Size_Metrics* metrics = &face->size->metrics;
3170
3171
3172 FT_TRACE5(( " x scale: %d (%f)\n",
3173 metrics->x_scale, metrics->x_scale / 65536.0 ));
3174 FT_TRACE5(( " y scale: %d (%f)\n",
3175 metrics->y_scale, metrics->y_scale / 65536.0 ));
3176 FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
3177 FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
3178 FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
3179 FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
3180 FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
3181 FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
3182 }
3183#endif
3184
3185 return error;
3186 }
FT_Select_Metrics(FT_Face face, FT_ULong strike_index)
Definition: ftobjs.c:2993
FT_Size_SelectFunc select_size
Definition: ftdrv.h:182

Referenced by FT_Request_Size(), and T42_Size_Select().

◆ ft_service_list_lookup()

ft_service_list_lookup ( FT_ServiceDesc  service_descriptors,
const char service_id 
)

Definition at line 98 of file ftobjs.c.

100 {
102 FT_ServiceDesc desc = service_descriptors;
103
104
105 if ( desc && service_id )
106 {
107 for ( ; desc->serv_id != NULL; desc++ )
108 {
109 if ( ft_strcmp( desc->serv_id, service_id ) == 0 )
110 {
111 result = (FT_Pointer)desc->serv_data;
112 break;
113 }
114 }
115 }
116
117 return result;
118 }
void * FT_Pointer
Definition: fttypes.h:311
static const WCHAR desc[]
Definition: protectdata.c:36

Referenced by af_get_interface(), bdf_driver_requester(), cff_get_interface(), cid_get_interface(), Get_Interface(), gxvalid_get_service(), otvalid_get_service(), pcf_driver_requester(), pfr_get_service(), T42_Get_Interface(), tt_get_interface(), and winfnt_get_service().

◆ FT_Set_Char_Size()

FT_Set_Char_Size ( FT_Face  face,
FT_F26Dot6  char_width,
FT_F26Dot6  char_height,
FT_UInt  horz_resolution,
FT_UInt  vert_resolution 
)

Definition at line 3267 of file ftobjs.c.

3272 {
3274
3275
3276 /* check of `face' delayed to `FT_Request_Size' */
3277
3278 if ( !char_width )
3279 char_width = char_height;
3280 else if ( !char_height )
3281 char_height = char_width;
3282
3283 if ( !horz_resolution )
3284 horz_resolution = vert_resolution;
3285 else if ( !vert_resolution )
3286 vert_resolution = horz_resolution;
3287
3288 if ( char_width < 1 * 64 )
3289 char_width = 1 * 64;
3290 if ( char_height < 1 * 64 )
3291 char_height = 1 * 64;
3292
3293 if ( !horz_resolution )
3294 horz_resolution = vert_resolution = 72;
3295
3297 req.width = char_width;
3298 req.height = char_height;
3299 req.horiResolution = horz_resolution;
3300 req.vertResolution = vert_resolution;
3301
3302 return FT_Request_Size( face, &req );
3303 }
FT_Request_Size(FT_Face face, FT_Size_Request req)
Definition: ftobjs.c:3192
FT_UInt horiResolution
Definition: freetype.h:2622
FT_UInt vertResolution
Definition: freetype.h:2623

Referenced by ftc_scaler_lookup_size(), and TestFace().

◆ FT_Set_Charmap()

FT_Set_Charmap ( FT_Face  face,
FT_CharMap  charmap 
)

Definition at line 3499 of file ftobjs.c.

3501 {
3502 FT_CharMap* cur;
3504
3505
3506 if ( !face )
3507 return FT_THROW( Invalid_Face_Handle );
3508
3509 cur = face->charmaps;
3510 if ( !cur || !charmap )
3511 return FT_THROW( Invalid_CharMap_Handle );
3512
3513 if ( FT_Get_CMap_Format( charmap ) == 14 )
3514 return FT_THROW( Invalid_Argument );
3515
3516 limit = cur + face->num_charmaps;
3517
3518 for ( ; cur < limit; cur++ )
3519 {
3520 if ( cur[0] == charmap )
3521 {
3522 face->charmap = cur[0];
3523 return FT_Err_Ok;
3524 }
3525 }
3526
3527 return FT_THROW( Invalid_Argument );
3528 }

Referenced by af_face_globals_compute_style_coverage(), af_latin_metrics_init(), FTC_CMapCache_Lookup(), NtGdiGetCharABCWidthsW(), NtGdiGetCharWidthW(), T1_Read_PFM(), and TextIntUpdateSize().

◆ ft_set_current_renderer()

static void ft_set_current_renderer ( FT_Library  library)
static

Definition at line 4321 of file ftobjs.c.

4322 {
4323 FT_Renderer renderer;
4324
4325
4327 library->cur_renderer = renderer;
4328 }

Referenced by ft_add_renderer(), and ft_remove_renderer().

◆ FT_Set_Debug_Hook()

FT_Set_Debug_Hook ( FT_Library  library,
FT_UInt  hook_index,
FT_DebugHook_Func  debug_hook 
)

Definition at line 5328 of file ftobjs.c.

5331 {
5332 if ( library && debug_hook &&
5333 hook_index <
5334 ( sizeof ( library->debug_hooks ) / sizeof ( void* ) ) )
5335 library->debug_hooks[hook_index] = debug_hook;
5336 }
FT_DebugHook_Func debug_hooks[4]
Definition: ftobjs.h:931
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

◆ FT_Set_Pixel_Sizes()

FT_Set_Pixel_Sizes ( FT_Face  face,
FT_UInt  pixel_width,
FT_UInt  pixel_height 
)

Definition at line 3309 of file ftobjs.c.

3312 {
3314
3315
3316 /* check of `face' delayed to `FT_Request_Size' */
3317
3318 if ( pixel_width == 0 )
3319 pixel_width = pixel_height;
3320 else if ( pixel_height == 0 )
3321 pixel_height = pixel_width;
3322
3323 if ( pixel_width < 1 )
3324 pixel_width = 1;
3325 if ( pixel_height < 1 )
3326 pixel_height = 1;
3327
3328 /* use `>=' to avoid potential compiler warning on 16bit platforms */
3329 if ( pixel_width >= 0xFFFFU )
3330 pixel_width = 0xFFFFU;
3331 if ( pixel_height >= 0xFFFFU )
3332 pixel_height = 0xFFFFU;
3333
3335 req.width = (FT_Long)( pixel_width << 6 );
3336 req.height = (FT_Long)( pixel_height << 6 );
3337 req.horiResolution = 0;
3338 req.vertResolution = 0;
3339
3340 return FT_Request_Size( face, &req );
3341 }

Referenced by ftc_scaler_lookup_size().

◆ FT_Set_Renderer()

FT_Set_Renderer ( FT_Library  library,
FT_Renderer  renderer,
FT_UInt  num_params,
FT_Parameter parameters 
)

Definition at line 4428 of file ftobjs.c.

4432 {
4435
4436 FT_Renderer_SetModeFunc set_mode;
4437
4438
4439 if ( !library )
4440 {
4441 error = FT_THROW( Invalid_Library_Handle );
4442 goto Exit;
4443 }
4444
4445 if ( !renderer )
4446 {
4447 error = FT_THROW( Invalid_Argument );
4448 goto Exit;
4449 }
4450
4451 if ( num_params > 0 && !parameters )
4452 {
4453 error = FT_THROW( Invalid_Argument );
4454 goto Exit;
4455 }
4456
4457 node = FT_List_Find( &library->renderers, renderer );
4458 if ( !node )
4459 {
4460 error = FT_THROW( Invalid_Argument );
4461 goto Exit;
4462 }
4463
4465
4466 if ( renderer->glyph_format == FT_GLYPH_FORMAT_OUTLINE )
4467 library->cur_renderer = renderer;
4468
4469 set_mode = renderer->clazz->set_mode;
4470
4471 for ( ; num_params > 0; num_params-- )
4472 {
4473 error = set_mode( renderer, parameters->tag, parameters->data );
4474 if ( error )
4475 break;
4476 parameters++;
4477 }
4478
4479 Exit:
4480 return error;
4481 }
FT_List_Up(FT_List list, FT_ListNode node)
Definition: ftutil.c:348
FT_Error(* FT_Renderer_SetModeFunc)(FT_Renderer renderer, FT_ULong mode_tag, FT_Pointer mode_ptr)
Definition: ftrender.h:108
FT_Renderer_SetModeFunc set_mode
Definition: ftrender.h:154

◆ FT_Set_Transform()

FT_Set_Transform ( FT_Face  face,
FT_Matrix matrix,
FT_Vector delta 
)

Definition at line 653 of file ftobjs.c.

656 {
658
659
660 if ( !face )
661 return;
662
663 internal = face->internal;
664
665 internal->transform_flags = 0;
666
667 if ( !matrix )
668 {
669 internal->transform_matrix.xx = 0x10000L;
670 internal->transform_matrix.xy = 0;
671 internal->transform_matrix.yx = 0;
672 internal->transform_matrix.yy = 0x10000L;
673
674 matrix = &internal->transform_matrix;
675 }
676 else
677 internal->transform_matrix = *matrix;
678
679 /* set transform_flags bit flag 0 if `matrix' isn't the identity */
680 if ( ( matrix->xy | matrix->yx ) ||
681 matrix->xx != 0x10000L ||
682 matrix->yy != 0x10000L )
683 internal->transform_flags |= 1;
684
685 if ( !delta )
686 {
687 internal->transform_delta.x = 0;
688 internal->transform_delta.y = 0;
689
690 delta = &internal->transform_delta;
691 }
692 else
693 internal->transform_delta = *delta;
694
695 /* set transform_flags bit flag 1 if `delta' isn't the null vector */
696 if ( delta->x | delta->y )
697 internal->transform_flags |= 2;
698 }
GLuint GLenum matrix
Definition: glext.h:9407

Referenced by ftGdiGetGlyphOutline(), ftGdiGetTextMetricsW(), IntExtTextOutW(), NtGdiGetCharABCWidthsW(), NtGdiGetCharWidthW(), and TextIntGetTextExtentPoint().

◆ FT_Sfnt_Table_Info()

FT_Sfnt_Table_Info ( FT_Face  face,
FT_UInt  table_index,
FT_ULong tag,
FT_ULong length 
)

Definition at line 4157 of file ftobjs.c.

4161 {
4162 FT_Service_SFNT_Table service;
4164
4165
4166 /* test for valid `length' delayed to `service->table_info' */
4167
4168 if ( !face || !FT_IS_SFNT( face ) )
4169 return FT_THROW( Invalid_Face_Handle );
4170
4171 FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
4172 if ( !service )
4173 return FT_THROW( Unimplemented_Feature );
4174
4175 return service->table_info( face, table_index, tag, &offset, length );
4176 }

◆ FT_Stream_Free()

FT_Stream_Free ( FT_Stream  stream,
FT_Int  external 
)

Definition at line 246 of file ftobjs.c.

248 {
249 if ( stream )
250 {
251 FT_Memory memory = stream->memory;
252
253
255
256 if ( !external )
257 FT_FREE( stream );
258 }
259 }
FT_Stream_Close(FT_Stream stream)
Definition: ftstream.c:49

Referenced by destroy_face(), FT_Attach_Stream(), ft_open_face_internal(), and woff_open_font().

◆ FT_Stream_New()

FT_Stream_New ( FT_Library  library,
const FT_Open_Args args,
FT_Stream astream 
)

Definition at line 178 of file ftobjs.c.

181 {
185
186
187 *astream = NULL;
188
189 if ( !library )
190 return FT_THROW( Invalid_Library_Handle );
191
192 if ( !args )
193 return FT_THROW( Invalid_Argument );
194
196
197 if ( FT_NEW( stream ) )
198 goto Exit;
199
200 stream->memory = memory;
201
202 if ( args->flags & FT_OPEN_MEMORY )
203 {
204 /* create a memory-based stream */
206 (const FT_Byte*)args->memory_base,
207 (FT_ULong)args->memory_size );
208 }
209
210#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT
211
212 else if ( args->flags & FT_OPEN_PATHNAME )
213 {
214 /* create a normal system stream */
215 error = FT_Stream_Open( stream, args->pathname );
216 stream->pathname.pointer = args->pathname;
217 }
218 else if ( ( args->flags & FT_OPEN_STREAM ) && args->stream )
219 {
220 /* use an existing, user-provided stream */
221
222 /* in this case, we do not need to allocate a new stream object */
223 /* since the caller is responsible for closing it himself */
224 FT_FREE( stream );
225 stream = args->stream;
226 }
227
228#endif
229
230 else
231 error = FT_THROW( Invalid_Argument );
232
233 if ( error )
234 FT_FREE( stream );
235 else
236 stream->memory = memory; /* just to be certain */
237
238 *astream = stream;
239
240 Exit:
241 return error;
242 }
FT_Stream_Open(FT_Stream stream, const char *filepathname)
Definition: ftsystem.c:224
FT_Stream_OpenMemory(FT_Stream stream, const FT_Byte *base, FT_ULong size)
Definition: ftstream.c:35

Referenced by FT_Attach_Stream(), and ft_open_face_internal().

◆ ft_synthesize_vertical_metrics()

ft_synthesize_vertical_metrics ( FT_Glyph_Metrics metrics,
FT_Pos  advance 
)

Definition at line 2933 of file ftobjs.c.

2935 {
2936 FT_Pos height = metrics->height;
2937
2938
2939 /* compensate for glyph with bbox above/below the baseline */
2940 if ( metrics->horiBearingY < 0 )
2941 {
2942 if ( height < metrics->horiBearingY )
2943 height = metrics->horiBearingY;
2944 }
2945 else if ( metrics->horiBearingY > 0 )
2946 height -= metrics->horiBearingY;
2947
2948 /* the factor 1.2 is a heuristical value */
2949 if ( !advance )
2950 advance = height * 12 / 10;
2951
2952 metrics->vertBearingX = metrics->horiBearingX - metrics->horiAdvance / 2;
2953 metrics->vertBearingY = ( advance - height ) / 2;
2954 metrics->vertAdvance = advance;
2955 }
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)

Referenced by BDF_Glyph_Load(), cff_slot_load(), cid_slot_load_glyph(), FNT_Load_Glyph(), PCF_Glyph_Load(), and T1_Load_Glyph().

◆ ft_validator_error()

ft_validator_error ( FT_Validator  valid,
FT_Error  error 
)

Definition at line 145 of file ftobjs.c.

147 {
148 /* since the cast below also disables the compiler's */
149 /* type check, we introduce a dummy variable, which */
150 /* will be optimized away */
151 volatile ft_jmp_buf* jump_buffer = &valid->jump_buffer;
152
153
154 valid->error = error;
155
156 /* throw away volatileness; use `jump_buffer' or the */
157 /* compiler may warn about an unused local variable */
158 ft_longjmp( *(ft_jmp_buf*) jump_buffer, 1 );
159 }
#define ft_jmp_buf
Definition: ftstdlib.h:158
#define ft_longjmp
Definition: ftstdlib.h:162
BOOLEAN valid

◆ ft_validator_init()

ft_validator_init ( FT_Validator  valid,
const FT_Byte base,
const