From b72d8a85212e1dc2dc103c28e19a4f4a2d71767e Mon Sep 17 00:00:00 2001 From: David Turner Date: Mon, 29 Sep 2003 20:33:37 +0000 Subject: [PATCH] * include/freetype/internal/services/svpsname.h (added), include/freetype/internal/psnames.h (removed), include/freetype/internal/internal.h (FT_SERVICE_POSTSCRIPT_NAMES): added new service to handle glyph name dictionaries, replacing the old internal header named "psnames.h" by "services/svpsname.h" note that this is different from "services/svpostnm.h" which only handles the retrieval of Postscript font name for a given face. (should we merge these two services into a single header ??) * include/freetype/internal/ftserv.h: adding FT_FACE_FIND_GLOBAL_SERVICE (used to lookup a service globally, instead of only within the current module) * include/freetype/internal/ftobjs.h, src/base/ftobjs.c: adding the new base function ft_module_get_service --- ChangeLog | 22 ++ include/freetype/internal/ftobjs.h | 4 + include/freetype/internal/ftserv.h | 20 +- include/freetype/internal/internal.h | 1 - include/freetype/internal/psaux.h | 3 +- include/freetype/internal/psnames.h | 241 ------------------ include/freetype/internal/services/svpostnm.h | 8 +- include/freetype/internal/services/svpsname.h | 82 ++++++ include/freetype/internal/t1types.h | 7 +- include/freetype/internal/t42types.h | 1 - include/freetype/internal/tttypes.h | 5 +- src/base/ftbdf.c | 8 +- src/base/ftobjs.c | 60 ++++- src/base/ftxf86.c | 4 +- src/cff/cffcmap.c | 40 +-- src/cff/cffdrivr.c | 38 ++- src/cff/cffload.c | 10 +- src/cff/cffload.h | 8 +- src/cff/cffobjs.c | 27 +- src/cff/cffobjs.h | 2 +- src/cid/cidobjs.c | 19 +- src/cid/cidriver.c | 11 +- src/psaux/t1cmap.c | 24 +- src/psaux/t1cmap.h | 17 +- src/psaux/t1decode.c | 11 +- src/psaux/t1decode.h | 1 - src/psnames/psmodule.c | 57 +++-- src/sfnt/sfdriver.c | 4 +- src/sfnt/sfobjs.c | 9 +- src/sfnt/ttpost.c | 8 +- src/truetype/ttobjs.c | 2 +- src/type1/t1driver.c | 6 +- src/type1/t1objs.c | 9 +- src/type42/t42drivr.c | 14 +- src/type42/t42objs.c | 7 +- src/type42/t42objs.h | 2 +- 36 files changed, 348 insertions(+), 444 deletions(-) delete mode 100644 include/freetype/internal/psnames.h create mode 100644 include/freetype/internal/services/svpsname.h diff --git a/ChangeLog b/ChangeLog index 7445aba6b..e7a790117 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2003-09-29 David Turner + + * include/freetype/internal/services/svpsname.h (added), + include/freetype/internal/psnames.h (removed), + include/freetype/internal/internal.h (FT_SERVICE_POSTSCRIPT_NAMES): + + added new service to handle glyph name dictionaries, replacing + the old internal header named "psnames.h" by "services/svpsname.h" + note that this is different from "services/svpostnm.h" which only + handles the retrieval of Postscript font name for a given face. + (should we merge these two services into a single header ??) + + + * include/freetype/internal/ftserv.h: adding + FT_FACE_FIND_GLOBAL_SERVICE (used to lookup a service globally, + instead of only within the current module) + + * include/freetype/internal/ftobjs.h, src/base/ftobjs.c: adding + the new base function ft_module_get_service + + + 2003-09-21 Werner Lemberg * include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE): diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 6260843ee..fa1b29f67 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -467,6 +467,10 @@ FT_BEGIN_HEADER FT_Get_Module_Interface( FT_Library library, const char* mod_name ); + FT_BASE( FT_Pointer ) + ft_module_get_service( FT_Module module, + const char* service_id ); + /* */ diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h index 5819940eb..bf17497f4 100644 --- a/include/freetype/internal/ftserv.h +++ b/include/freetype/internal/ftserv.h @@ -57,19 +57,26 @@ FT_BEGIN_HEADER * A variable that receives the service pointer. Will be NULL * if not found. */ -#define FT_FACE_FIND_SERVICE( ptr, face, id ) \ +#define FT_FACE_FIND_SERVICE( face, ptr, id ) \ FT_BEGIN_STMNT \ FT_Module module = FT_MODULE( FT_FACE(face)->driver ); \ + FT_Pointer* Pptr = (FT_Pointer*) &(ptr); \ /* the strange cast is to allow C++ compilation */ \ - FT_Pointer* Pptr = (FT_Pointer*)&(ptr); \ - \ - \ *Pptr = NULL; \ if ( module->clazz->get_interface ) \ *Pptr = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \ FT_END_STMNT +#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \ + FT_BEGIN_STMNT \ + FT_Module module = FT_MODULE( FT_FACE(face)->driver ); \ + FT_Pointer* Pptr = (FT_Pointer*) &(ptr); \ + \ + /* the strange cast is to allow C++ compilation */ \ + *Pptr = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \ + FT_END_STMNT + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -129,7 +136,7 @@ FT_BEGIN_HEADER */ typedef struct FT_ServiceCacheRec_ { - FT_Pointer service_POSTSCRIPT_NAME; + FT_Pointer service_POSTSCRIPT_FONT_NAME; FT_Pointer service_MULTI_MASTERS; FT_Pointer service_GLYPH_DICT; FT_Pointer service_PFR_METRICS; @@ -178,7 +185,7 @@ FT_BEGIN_HEADER svc = NULL; \ else if ( svc == NULL ) \ { \ - FT_FACE_FIND_SERVICE( svc, face, id ); \ + FT_FACE_FIND_SERVICE( face, svc, id ); \ \ FT_FACE(face)->internal->services. service_ ## id = \ (FT_Pointer)( svc != NULL ? svc \ @@ -207,6 +214,7 @@ FT_BEGIN_HEADER #define FT_SERVICE_MULTIPLE_MASTERS_H #define FT_SERVICE_POSTSCRIPT_NAME_H +#define FT_SERVICE_POSTSCRIPT_NAMES_H #define FT_SERVICE_GLYPH_DICT_H #define FT_SERVICE_BDF_H #define FT_SERVICE_XFREE86_NAME_H diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h index 6ce543c4a..3b030cfbb 100644 --- a/include/freetype/internal/internal.h +++ b/include/freetype/internal/internal.h @@ -41,7 +41,6 @@ #define FT_INTERNAL_CFF_TYPES_H #define FT_INTERNAL_BDF_TYPES_H -#define FT_INTERNAL_POSTSCRIPT_NAMES_H #define FT_INTERNAL_POSTSCRIPT_AUX_H #define FT_INTERNAL_POSTSCRIPT_HINTS_H #define FT_INTERNAL_POSTSCRIPT_GLOBALS_H diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index c7093fe54..48bda925a 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -24,6 +24,7 @@ #include #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_TYPE1_TYPES_H +#include FT_SERVICE_POSTSCRIPT_NAMES_H FT_BEGIN_HEADER @@ -648,7 +649,7 @@ FT_BEGIN_HEADER T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1]; T1_Decoder_Zone zone; - PSNames_Service psnames; /* for seac */ + FT_Service_PsNames psnames; /* for seac */ FT_UInt num_glyphs; FT_Byte** glyph_names; diff --git a/include/freetype/internal/psnames.h b/include/freetype/internal/psnames.h deleted file mode 100644 index 0f4ec86a8..000000000 --- a/include/freetype/internal/psnames.h +++ /dev/null @@ -1,241 +0,0 @@ -/***************************************************************************/ -/* */ -/* psnames.h */ -/* */ -/* High-level interface for the `PSNames' module (in charge of */ -/* various functions related to Postscript glyph names conversion). */ -/* */ -/* Copyright 1996-2001, 2002 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __PSNAMES_H__ -#define __PSNAMES_H__ - - -#include -#include FT_FREETYPE_H - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* */ - /* PS_Unicode_Value_Func */ - /* */ - /* */ - /* A function used to return the Unicode index corresponding to a */ - /* given glyph name. */ - /* */ - /* */ - /* glyph_name :: The glyph name. */ - /* */ - /* */ - /* The Unicode character index resp. the non-Unicode value 0xFFFF if */ - /* the glyph name has no known Unicode meaning. */ - /* */ - /* */ - /* This function is able to map several different glyph names to the */ - /* same Unicode value, according to the rules defined in the Adobe */ - /* Glyph List table. */ - /* */ - /* This function will not be compiled if the configuration macro */ - /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined. */ - /* */ - typedef FT_UInt32 - (*PS_Unicode_Value_Func)( const char* glyph_name ); - - - /*************************************************************************/ - /* */ - /* */ - /* PS_Unicode_Index_Func */ - /* */ - /* */ - /* A function used to return the glyph index corresponding to a given */ - /* Unicode value. */ - /* */ - /* */ - /* num_glyphs :: The number of glyphs in the face. */ - /* */ - /* glyph_names :: An array of glyph name pointers. */ - /* */ - /* unicode :: The Unicode value. */ - /* */ - /* */ - /* The glyph index resp. 0xFFFF if no glyph corresponds to this */ - /* Unicode value. */ - /* */ - /* */ - /* This function is able to recognize several glyph names per Unicode */ - /* value, according to the Adobe Glyph List. */ - /* */ - /* This function will not be compiled if the configuration macro */ - /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined. */ - /* */ - typedef FT_UInt - (*PS_Unicode_Index_Func)( FT_UInt num_glyphs, - const char** glyph_names, - FT_ULong unicode ); - - - /*************************************************************************/ - /* */ - /* */ - /* PS_Macintosh_Name_Func */ - /* */ - /* */ - /* A function used to return the glyph name corresponding to an Apple */ - /* glyph name index. */ - /* */ - /* */ - /* name_index :: The index of the Mac name. */ - /* */ - /* */ - /* The glyph name, or 0 if the index is invalid. */ - /* */ - /* */ - /* This function will not be compiled if the configuration macro */ - /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES is undefined. */ - /* */ - typedef const char* - (*PS_Macintosh_Name_Func)( FT_UInt name_index ); - - - typedef const char* - (*PS_Adobe_Std_Strings_Func)( FT_UInt string_index ); - - - typedef struct PS_UniMap_ - { - FT_UInt unicode; - FT_UInt glyph_index; - - } PS_UniMap; - - - /*************************************************************************/ - /* */ - /* */ - /* PS_Unicodes */ - /* */ - /* */ - /* A simple table used to map Unicode values to glyph indices. It is */ - /* built by the PS_Build_Unicodes table according to the glyphs */ - /* present in a font file. */ - /* */ - /* */ - /* num_codes :: The number of glyphs in the font that match a given */ - /* Unicode value. */ - /* */ - /* unicodes :: An array of unicode values, sorted in increasing */ - /* order. */ - /* */ - /* gindex :: An array of glyph indices, corresponding to each */ - /* Unicode value. */ - /* */ - /* */ - /* Use the function PS_Lookup_Unicode() to retrieve the glyph index */ - /* corresponding to a given Unicode character code. */ - /* */ - typedef struct PS_Unicodes_ - { - FT_UInt num_maps; - PS_UniMap* maps; - - } PS_Unicodes; - - - typedef FT_Error - (*PS_Build_Unicodes_Func)( FT_Memory memory, - FT_UInt num_glyphs, - const char** glyph_names, - PS_Unicodes* unicodes ); - - typedef FT_UInt - (*PS_Lookup_Unicode_Func)( PS_Unicodes* unicodes, - FT_UInt unicode ); - - typedef FT_ULong - (*PS_Next_Unicode_Func)( PS_Unicodes* unicodes, - FT_ULong unicode ); - - - /*************************************************************************/ - /* */ - /* */ - /* PSNames_Interface */ - /* */ - /* */ - /* This structure defines the PSNames interface. */ - /* */ - /* */ - /* unicode_value :: A function used to convert a glyph name */ - /* into a Unicode character code. */ - /* */ - /* build_unicodes :: A function which builds up the Unicode */ - /* mapping table. */ - /* */ - /* lookup_unicode :: A function used to return the glyph index */ - /* corresponding to a given Unicode */ - /* character. */ - /* */ - /* macintosh_name :: A function used to return the standard */ - /* Apple glyph Postscript name corresponding */ - /* to a given string index (used by the */ - /* TrueType `post' table). */ - /* */ - /* adobe_std_strings :: A function that returns a pointer to a */ - /* Adobe Standard String for a given SID. */ - /* */ - /* adobe_std_encoding :: A table of 256 unsigned shorts that maps */ - /* character codes in the Adobe Standard */ - /* Encoding to SIDs. */ - /* */ - /* adobe_expert_encoding :: A table of 256 unsigned shorts that maps */ - /* character codes in the Adobe Expert */ - /* Encoding to SIDs. */ - /* */ - /* */ - /* `unicode_value' and `unicode_index' will be set to 0 if the */ - /* configuration macro FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is */ - /* undefined. */ - /* */ - /* `macintosh_name' will be set to 0 if the configuration macro */ - /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES is undefined. */ - /* */ - typedef struct PSNames_Interface_ - { - PS_Unicode_Value_Func unicode_value; - PS_Build_Unicodes_Func build_unicodes; - PS_Lookup_Unicode_Func lookup_unicode; - PS_Macintosh_Name_Func macintosh_name; - - PS_Adobe_Std_Strings_Func adobe_std_strings; - const unsigned short* adobe_std_encoding; - const unsigned short* adobe_expert_encoding; - - PS_Next_Unicode_Func next_unicode; - - } PSNames_Interface; - - - typedef PSNames_Interface* PSNames_Service; - - -FT_END_HEADER - -#endif /* __PSNAMES_H__ */ - - -/* END */ diff --git a/include/freetype/internal/services/svpostnm.h b/include/freetype/internal/services/svpostnm.h index 405eba839..7f1700adb 100644 --- a/include/freetype/internal/services/svpostnm.h +++ b/include/freetype/internal/services/svpostnm.h @@ -34,16 +34,16 @@ FT_BEGIN_HEADER * The name is owned by the face and will be destroyed with it. */ -#define FT_SERVICE_ID_POSTSCRIPT_NAME "postscript-name" +#define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME "postscript-font-name" typedef const char* (*FT_PsName_GetFunc)( FT_Face face ); - - FT_DEFINE_SERVICE( PsName ) + + FT_DEFINE_SERVICE( PsFontName ) { - FT_PsName_GetFunc get_ps_name; + FT_PsName_GetFunc get_ps_font_name; }; /* */ diff --git a/include/freetype/internal/services/svpsname.h b/include/freetype/internal/services/svpsname.h new file mode 100644 index 000000000..5a56179cb --- /dev/null +++ b/include/freetype/internal/services/svpsname.h @@ -0,0 +1,82 @@ +#ifndef __SVPSNAME_H__ +#define __SVPSNAME_H__ + +FT_BEGIN_HEADER + +#define FT_SERVICE_ID_POSTSCRIPT_NAMES "postscript-names" + + /* Adobe glyph name to unicode value + */ + typedef FT_UInt32 + (*PS_Unicode_ValueFunc)( const char* glyph_name ); + + /* Unicode value to Adobe glyph name index. 0xFFFF if not found + */ + typedef FT_UInt + (*PS_Unicode_Index_Func)( FT_UInt num_glyphs, + const char** glyph_names, + FT_ULong unicode ); + + /* Macintosh name id to glyph name, NULL if invalid index + */ + typedef const char* + (*PS_Macintosh_Name_Func)( FT_UInt name_index ); + + /* Adobe standard string id to glyph name, NULL if invalid index + */ + typedef const char* + (*PS_Adobe_Std_Strings_Func)( FT_UInt string_index ); + + + /* Simple unicode -> glyph index charmap built from font glyph names + * table + */ + typedef struct PS_UniMap_ + { + FT_UInt unicode; + FT_UInt glyph_index; + + } PS_UniMap; + + + typedef struct PS_Unicodes_ + { + FT_UInt num_maps; + PS_UniMap* maps; + + } PS_Unicodes; + + + typedef FT_Error + (*PS_Unicodes_InitFunc)( FT_Memory memory, + FT_UInt num_glyphs, + const char** glyph_names, + PS_Unicodes* unicodes ); + + typedef FT_UInt + (*PS_Unicodes_CharIndexFunc)( PS_Unicodes* unicodes, + FT_UInt unicode ); + + typedef FT_ULong + (*PS_Unicodes_CharNextFunc)( PS_Unicodes* unicodes, + FT_ULong unicode ); + + FT_DEFINE_SERVICE( PsNames ) + { + PS_Unicode_ValueFunc unicode_value; + + PS_Unicodes_InitFunc unicodes_init; + PS_Unicodes_CharIndexFunc unicodes_char_index; + PS_Unicodes_CharNextFunc unicodes_char_next; + + PS_Macintosh_Name_Func macintosh_name; + PS_Adobe_Std_Strings_Func adobe_std_strings; + const unsigned short* adobe_std_encoding; + const unsigned short* adobe_expert_encoding; + }; + + /* */ + +FT_END_HEADER + +#endif /* __SVPSNAME_H__ */ diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h index f6f68f4a5..851baa8be 100644 --- a/include/freetype/internal/t1types.h +++ b/include/freetype/internal/t1types.h @@ -23,8 +23,9 @@ #include #include FT_TYPE1_TABLES_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H +#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H +#include FT_SERVICE_POSTSCRIPT_NAMES_H FT_BEGIN_HEADER @@ -169,7 +170,7 @@ FT_BEGIN_HEADER /* support for Multiple Masters fonts */ PS_Blend blend; - + /* since FT 2.1 - interface to PostScript hinter */ const void* pshinter; @@ -184,7 +185,7 @@ FT_BEGIN_HEADER CID_FaceInfoRec cid; void* afm_data; CID_Subrs subrs; - + /* since FT 2.1 - interface to PostScript hinter */ void* pshinter; diff --git a/include/freetype/internal/t42types.h b/include/freetype/internal/t42types.h index 7562252e6..9e612d58a 100644 --- a/include/freetype/internal/t42types.h +++ b/include/freetype/internal/t42types.h @@ -23,7 +23,6 @@ #include FT_FREETYPE_H #include FT_TYPE1_TABLES_H #include FT_INTERNAL_TYPE1_TYPES_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index d002703de..7e9db90d2 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1377,9 +1377,6 @@ FT_BEGIN_HEADER /* */ /* sfnt :: A pointer to the SFNT `driver' interface. */ /* */ - /* psnames :: A pointer to the `PSNames' module */ - /* interface. */ - /* */ /* hdmx :: The face's horizontal device metrics */ /* (`hdmx' table). This table is optional in */ /* TrueType/OpenType fonts. */ @@ -1501,7 +1498,7 @@ FT_BEGIN_HEADER /* the basic TrueType tables in the face object */ void* sfnt; - /* a typeless pointer to the PSNames_Interface table used to */ + /* a typeless pointer to the FT_Service_PsNamesRec table used to */ /* handle glyph names <-> unicode & Mac values */ void* psnames; diff --git a/src/base/ftbdf.c b/src/base/ftbdf.c index 96a6911c8..59e5d2018 100644 --- a/src/base/ftbdf.c +++ b/src/base/ftbdf.c @@ -39,9 +39,7 @@ FT_Service_BDF service; - FT_FACE_FIND_SERVICE( service, - face, - BDF ); + FT_FACE_FIND_SERVICE( face, service, BDF ); if ( service && service->get_charset_id ) error = service->get_charset_id( face, &encoding, ®istry ); @@ -74,9 +72,7 @@ FT_Service_BDF service; - FT_FACE_FIND_SERVICE( service, - face, - BDF ); + FT_FACE_FIND_SERVICE( face, service, BDF ); if ( service && service->get_property ) error = service->get_property( face, prop_name, aproperty ); diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index c6d60d326..7665b544a 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -2458,15 +2458,15 @@ if ( !result ) { - FT_Service_PsName service; + FT_Service_PsFontName service; FT_FACE_LOOKUP_SERVICE( face, service, - POSTSCRIPT_NAME ); + POSTSCRIPT_FONT_NAME ); - if ( service && service->get_ps_name ) - result = service->get_ps_name( face ); + if ( service && service->get_ps_font_name ) + result = service->get_ps_font_name( face ); } Exit: @@ -2486,9 +2486,7 @@ if ( face && FT_IS_SFNT( face ) ) { - FT_FACE_FIND_SERVICE( service, - face, - SFNT_TABLE ); + FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE ); if ( service != NULL ) table = service->get_table( face, tag ); } @@ -2512,9 +2510,7 @@ if ( !face || !FT_IS_SFNT( face ) ) return FT_Err_Invalid_Face_Handle; - FT_FACE_FIND_SERVICE( service, - face, - SFNT_TABLE ); + FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE ); if ( service == NULL ) return FT_Err_Unimplemented_Feature; @@ -3068,6 +3064,50 @@ } + FT_BASE_DEF( FT_Pointer ) + ft_module_get_service( FT_Module module, + const char* service_id ) + { + FT_Pointer result = NULL; + + if ( module ) + { + FT_ASSERT( module->clazz && module->clazz->get_interface ); + + /* first, look for the service in the module + */ + if ( module->clazz->get_interface ) + result = module->clazz->get_interface( module, service_id ); + + if ( result == NULL ) + { + /* we didn't find it, look in all other modules then + */ + FT_Library library = module->library; + FT_Module* cur = library->modules; + FT_Module* limit = cur + library->num_modules; + + for ( ; cur < limit; cur++ ) + { + if ( cur[0] != module ) + { + FT_ASSERT( cur[0]->clazz ); + + if ( cur[0]->clazz->get_interface ) + { + result = cur[0]->clazz->get_interface( cur[0], service_id ); + if ( result != NULL ) + break; + } + } + } + } + } + + return result; + } + + /* documentation is in ftmodule.h */ FT_EXPORT_DEF( FT_Error ) diff --git a/src/base/ftxf86.c b/src/base/ftxf86.c index 7cb03ff00..8238ed074 100644 --- a/src/base/ftxf86.c +++ b/src/base/ftxf86.c @@ -28,9 +28,7 @@ if ( face ) - FT_FACE_FIND_SERVICE( result, - face, - XF86_NAME ); + FT_FACE_FIND_SERVICE( face, result, XF86_NAME ); return result; } diff --git a/src/cff/cffcmap.c b/src/cff/cffcmap.c index ef1735a7c..46f959495 100644 --- a/src/cff/cffcmap.c +++ b/src/cff/cffcmap.c @@ -39,7 +39,7 @@ cmap->gids = encoding->codes; - + return 0; } @@ -60,7 +60,7 @@ if ( char_code < 256 ) result = cmap->gids[char_code]; - + return result; } @@ -71,27 +71,27 @@ { FT_UInt result = 0; FT_UInt32 char_code = *pchar_code; - + *pchar_code = 0; if ( char_code < 255 ) { FT_UInt code = (FT_UInt)(char_code + 1); - + for (;;) { if ( code >= 256 ) break; - + result = cmap->gids[code]; if ( result != 0 ) { *pchar_code = code; break; } - + code++; } } @@ -125,28 +125,28 @@ { FT_UInt32 u1 = ((CFF_CMapUniPair)pair1)->unicode; FT_UInt32 u2 = ((CFF_CMapUniPair)pair2)->unicode; - + if ( u1 < u2 ) return -1; - + if ( u1 > u2 ) return +1; - + return 0; - } + } FT_CALLBACK_DEF( FT_Error ) cff_cmap_unicode_init( CFF_CMapUnicode cmap ) { - FT_Error error; - FT_UInt count; - TT_Face face = (TT_Face)FT_CMAP_FACE( cmap ); - FT_Memory memory = FT_FACE_MEMORY( face ); - CFF_Font cff = (CFF_Font)face->extra.data; - CFF_Charset charset = &cff->charset; - PSNames_Service psnames = (PSNames_Service)cff->psnames; + FT_Error error; + FT_UInt count; + TT_Face face = (TT_Face)FT_CMAP_FACE( cmap ); + FT_Memory memory = FT_FACE_MEMORY( face ); + CFF_Font cff = (CFF_Font)face->extra.data; + CFF_Charset charset = &cff->charset; + FT_Service_PsNames psnames = (FT_Service_PsNames)cff->psnames; cmap->num_pairs = 0; @@ -169,7 +169,7 @@ gname = cff_index_get_sid_string( &cff->string_index, sid, psnames ); - + /* build unsorted pair table by matching glyph names */ if ( gname ) { @@ -181,7 +181,7 @@ pair->gindex = n; pair++; } - + FT_FREE( gname ); } } @@ -223,7 +223,7 @@ FT_Face face = FT_CMAP_FACE( cmap ); FT_Memory memory = FT_FACE_MEMORY( face ); - + FT_FREE( cmap->pairs ); cmap->num_pairs = 0; } diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 181c0d62f..e029e2742 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -22,7 +22,7 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_IDS_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_NAMES_H #include "cffdrivr.h" #include "cffgload.h" @@ -223,17 +223,15 @@ FT_Pointer buffer, FT_UInt buffer_max ) { - CFF_Font font = (CFF_Font)face->extra.data; - FT_Memory memory = FT_FACE_MEMORY( face ); - FT_String* gname; - FT_UShort sid; - PSNames_Service psnames; - FT_Error error; + CFF_Font font = (CFF_Font)face->extra.data; + FT_Memory memory = FT_FACE_MEMORY( face ); + FT_String* gname; + FT_UShort sid; + FT_Service_PsNames psnames; + FT_Error error; - psnames = (PSNames_Service)FT_Get_Module_Interface( - face->root.driver->root.library, "psnames" ); - + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); if ( !psnames ) { FT_ERROR(( "cff_get_glyph_name:" )); @@ -274,22 +272,20 @@ cff_get_name_index( CFF_Face face, FT_String* glyph_name ) { - CFF_Font cff; - CFF_Charset charset; - PSNames_Service psnames; - FT_Memory memory = FT_FACE_MEMORY( face ); - FT_String* name; - FT_UShort sid; - FT_UInt i; - FT_Int result; + CFF_Font cff; + CFF_Charset charset; + FT_Service_PsNames psnames; + FT_Memory memory = FT_FACE_MEMORY( face ); + FT_String* name; + FT_UShort sid; + FT_UInt i; + FT_Int result; cff = (CFF_FontRec *)face->extra.data; charset = &cff->charset; - psnames = (PSNames_Service)FT_Get_Module_Interface( - face->root.driver->root.library, "psnames" ); - + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); for ( i = 0; i < cff->num_glyphs; i++ ) { sid = charset->sids[i]; diff --git a/src/cff/cffload.c b/src/cff/cffload.c index cc95e790e..205b7ec5f 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -20,7 +20,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_NAMES_H #include FT_TRUETYPE_TAGS_H #include "cffload.h" @@ -1312,9 +1312,9 @@ FT_LOCAL_DEF( FT_String* ) - cff_index_get_sid_string( CFF_Index idx, - FT_UInt sid, - PSNames_Service psnames_service ) + cff_index_get_sid_string( CFF_Index idx, + FT_UInt sid, + FT_Service_PsNames psnames ) { /* if it is not a standard string, return it */ if ( sid > 390 ) @@ -1323,7 +1323,7 @@ /* that's a standard string, fetch a copy from the PSName module */ { FT_String* name = 0; - const char* adobe_name = psnames_service->adobe_std_strings( sid ); + const char* adobe_name = psnames->adobe_std_strings( sid ); FT_UInt len; diff --git a/src/cff/cffload.h b/src/cff/cffload.h index 4cadfe6bb..e5f12747f 100644 --- a/src/cff/cffload.h +++ b/src/cff/cffload.h @@ -22,7 +22,7 @@ #include #include FT_INTERNAL_CFF_TYPES_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_NAMES_H FT_BEGIN_HEADER @@ -36,9 +36,9 @@ FT_BEGIN_HEADER FT_UInt element ); FT_LOCAL( FT_String* ) - cff_index_get_sid_string( CFF_Index idx, - FT_UInt sid, - PSNames_Service psnames_interface ); + cff_index_get_sid_string( CFF_Index idx, + FT_UInt sid, + FT_Service_PsNames psnames ); FT_LOCAL( FT_Error ) diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index c0fdc05ea..e32731f13 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -24,7 +24,7 @@ #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H #include FT_INTERNAL_SFNT_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_NAMES_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H #include "cffobjs.h" #include "cffload.h" @@ -253,24 +253,31 @@ FT_Int num_params, FT_Parameter* params ) { - FT_Error error; - SFNT_Service sfnt; - PSNames_Service psnames; - PSHinter_Service pshinter; - FT_Bool pure_cff = 1; - FT_Bool sfnt_format = 0; + FT_Error error; + SFNT_Service sfnt; + FT_Service_PsNames psnames; + PSHinter_Service pshinter; + FT_Bool pure_cff = 1; + FT_Bool sfnt_format = 0; +#if 0 + FT_FACE_FIND_GLOBAL_SERVICE( face, sfnt, SFNT ); + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); + FT_FACE_FIND_GLOBAL_SERVICE( face, pshinter, POSTSCRIPT_HINTER ); + if ( !sfnt ) + goto Bad_Format; +#else sfnt = (SFNT_Service)FT_Get_Module_Interface( face->root.driver->root.library, "sfnt" ); if ( !sfnt ) goto Bad_Format; - psnames = (PSNames_Service)FT_Get_Module_Interface( - face->root.driver->root.library, "psnames" ); + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); pshinter = (PSHinter_Service)FT_Get_Module_Interface( face->root.driver->root.library, "pshinter" ); +#endif /* create input stream from resource */ if ( FT_STREAM_SEEK( 0 ) ) @@ -347,7 +354,7 @@ goto Exit; cff->pshinter = pshinter; - cff->psnames = psnames; + cff->psnames = (void*)psnames; /* Complement the root flags with some interesting information. */ /* Note that this is only necessary for pure CFF and CEF fonts. */ diff --git a/src/cff/cffobjs.h b/src/cff/cffobjs.h index cf60ecfb2..317b6070e 100644 --- a/src/cff/cffobjs.h +++ b/src/cff/cffobjs.h @@ -24,7 +24,7 @@ #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_CFF_TYPES_H #include FT_INTERNAL_TRUETYPE_TYPES_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_NAMES_H FT_BEGIN_HEADER diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index 5834cd834..5081231c5 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -23,7 +23,7 @@ #include "cidgload.h" #include "cidload.h" -#include FT_INTERNAL_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_NAMES_H #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H @@ -268,10 +268,10 @@ FT_Int num_params, FT_Parameter* params ) { - FT_Error error; - PSNames_Service psnames; - PSAux_Service psaux; - PSHinter_Service pshinter; + FT_Error error; + FT_Service_PsNames psnames; + PSAux_Service psaux; + PSHinter_Service pshinter; FT_UNUSED( num_params ); FT_UNUSED( params ); @@ -281,14 +281,7 @@ face->root.num_faces = 1; - psnames = (PSNames_Service)face->psnames; - if ( !psnames ) - { - psnames = (PSNames_Service)FT_Get_Module_Interface( - FT_FACE_LIBRARY( face ), "psnames" ); - - face->psnames = psnames; - } + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); psaux = (PSAux_Service)face->psaux; if ( !psaux ) diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index 704d47dbd..d0d084328 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -21,7 +21,6 @@ #include "cidgload.h" #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include "ciderrs.h" @@ -42,7 +41,7 @@ * POSTSCRIPT NAME SERVICE * */ - + static const char* cid_get_postscript_name( CID_Face face ) { @@ -55,8 +54,8 @@ return result; } - - static const FT_Service_PsNameRec cid_service_ps_name = + + static const FT_Service_PsFontNameRec cid_service_ps_name = { (FT_PsName_GetFunc) cid_get_postscript_name }; @@ -66,10 +65,10 @@ * SERVICE LIST * */ - + static const FT_ServiceDescRec cid_services[] = { - { FT_SERVICE_ID_POSTSCRIPT_NAME, &cid_service_ps_name }, + { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name }, { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CID }, { NULL, NULL } }; diff --git a/src/psaux/t1cmap.c b/src/psaux/t1cmap.c index 3fdf2ee3c..630f577f5 100644 --- a/src/psaux/t1cmap.c +++ b/src/psaux/t1cmap.c @@ -35,8 +35,8 @@ t1_cmap_std_init( T1_CMapStd cmap, FT_Int is_expert ) { - T1_Face face = (T1_Face)FT_CMAP_FACE( cmap ); - PSNames_Service psnames = (PSNames_Service)face->psnames; + T1_Face face = (T1_Face)FT_CMAP_FACE( cmap ); + FT_Service_PsNames psnames = (FT_Service_PsNames)face->psnames; cmap->num_glyphs = face->type1.num_glyphs; @@ -263,26 +263,26 @@ { FT_UInt32 u1 = ((T1_CMapUniPair)pair1)->unicode; FT_UInt32 u2 = ((T1_CMapUniPair)pair2)->unicode; - + if ( u1 < u2 ) return -1; - + if ( u1 > u2 ) return +1; - + return 0; - } + } FT_CALLBACK_DEF( FT_Error ) t1_cmap_unicode_init( T1_CMapUnicode cmap ) { - FT_Error error; - FT_UInt count; - T1_Face face = (T1_Face)FT_CMAP_FACE( cmap ); - FT_Memory memory = FT_FACE_MEMORY( face ); - PSNames_Service psnames = (PSNames_Service)face->psnames; + FT_Error error; + FT_UInt count; + T1_Face face = (T1_Face)FT_CMAP_FACE( cmap ); + FT_Memory memory = FT_FACE_MEMORY( face ); + FT_Service_PsNames psnames = (FT_Service_PsNames)face->psnames; cmap->num_pairs = 0; @@ -316,7 +316,7 @@ } } } - + new_count = (FT_UInt)( pair - cmap->pairs ); if ( new_count == 0 ) { diff --git a/src/psaux/t1cmap.h b/src/psaux/t1cmap.h index 0d68c999c..0b8c4fcfd 100644 --- a/src/psaux/t1cmap.h +++ b/src/psaux/t1cmap.h @@ -22,7 +22,6 @@ #include #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_TYPE1_TYPES_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H FT_BEGIN_HEADER @@ -47,16 +46,16 @@ FT_BEGIN_HEADER FT_UInt num_glyphs; const char* const* glyph_names; - + } T1_CMapStdRec; FT_CALLBACK_TABLE const FT_CMap_ClassRec t1_cmap_standard_class_rec; - + FT_CALLBACK_TABLE const FT_CMap_ClassRec t1_cmap_expert_class_rec; - + /*************************************************************************/ /*************************************************************************/ @@ -67,20 +66,20 @@ FT_BEGIN_HEADER /*************************************************************************/ typedef struct T1_CMapCustomRec_* T1_CMapCustom; - + typedef struct T1_CMapCustomRec_ { FT_CMapRec cmap; FT_UInt first; FT_UInt count; FT_UShort* indices; - + } T1_CMapCustomRec; FT_CALLBACK_TABLE const FT_CMap_ClassRec t1_cmap_custom_class_rec; - + /*************************************************************************/ /*************************************************************************/ @@ -97,7 +96,7 @@ FT_BEGIN_HEADER { FT_UInt32 unicode; FT_UInt gindex; - + } T1_CMapUniPairRec, *T1_CMapUniPair; @@ -115,7 +114,7 @@ FT_BEGIN_HEADER /* */ - + FT_END_HEADER #endif /* __T1CMAP_H__ */ diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index dd8719f12..76b688ff8 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -125,9 +125,9 @@ t1_lookup_glyph_by_stdcharcode( T1_Decoder decoder, FT_Int charcode ) { - FT_UInt n; - const FT_String* glyph_name; - PSNames_Service psnames = decoder->psnames; + FT_UInt n; + const FT_String* glyph_name; + FT_Service_PsNames psnames = decoder->psnames; /* check range of standard char code */ @@ -1129,11 +1129,10 @@ /* retrieve PSNames interface from list of current modules */ { - PSNames_Service psnames = 0; + FT_Service_PsNames psnames = 0; - psnames = (PSNames_Service)FT_Get_Module_Interface( - FT_FACE_LIBRARY(face), "psnames" ); + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); if ( !psnames ) { FT_ERROR(( "t1_decoder_init: " )); diff --git a/src/psaux/t1decode.h b/src/psaux/t1decode.h index fcb853ce8..4c714213b 100644 --- a/src/psaux/t1decode.h +++ b/src/psaux/t1decode.h @@ -22,7 +22,6 @@ #include #include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_TYPE1_TYPES_H diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c index af364285c..258b6d19e 100644 --- a/src/psnames/psmodule.c +++ b/src/psnames/psmodule.c @@ -17,8 +17,8 @@ #include -#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_OBJECTS_H +#include FT_SERVICE_POSTSCRIPT_NAMES_H #include "psmodule.h" #include "pstables.h" @@ -176,10 +176,10 @@ /* Builds a table that maps Unicode values to glyph indices */ static FT_Error - ps_build_unicode_table( FT_Memory memory, - FT_UInt num_glyphs, - const char** glyph_names, - PS_Unicodes* table ) + ps_unicodes_init( FT_Memory memory, + FT_UInt num_glyphs, + const char** glyph_names, + PS_Unicodes* table ) { FT_Error error; @@ -242,8 +242,8 @@ static FT_UInt - ps_lookup_unicode( PS_Unicodes* table, - FT_ULong unicode ) + ps_unicodes_char_index( PS_Unicodes* table, + FT_ULong unicode ) { PS_UniMap *min, *max, *mid; @@ -273,8 +273,8 @@ static FT_ULong - ps_next_unicode( PS_Unicodes* table, - FT_ULong unicode ) + ps_unicodes_char_next( PS_Unicodes* table, + FT_ULong unicode ) { PS_UniMap *min, *max, *mid; @@ -335,19 +335,21 @@ static - const PSNames_Interface psnames_interface = + const FT_Service_PsNamesRec psnames_interface = { #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST - (PS_Unicode_Value_Func) ps_unicode_value, - (PS_Build_Unicodes_Func) ps_build_unicode_table, - (PS_Lookup_Unicode_Func) ps_lookup_unicode, + (PS_Unicode_ValueFunc) ps_unicode_value, + (PS_Unicodes_InitFunc) ps_unicodes_init, + (PS_Unicodes_CharIndexFunc) ps_unicodes_char_index, + (PS_Unicodes_CharNextFunc) ps_unicodes_char_next, #else 0, 0, 0, + 0, #endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */ @@ -355,20 +357,29 @@ (PS_Adobe_Std_Strings_Func) ps_get_standard_strings, t1_standard_encoding, - t1_expert_encoding, + t1_expert_encoding + }; -#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST - (PS_Next_Unicode_Func) ps_next_unicode -#else - 0 -#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */ + static const FT_ServiceDescRec psnames_services[] = + { + { FT_SERVICE_ID_POSTSCRIPT_NAMES, & psnames_interface }, + { NULL, NULL } }; + static FT_Pointer + psnames_get_service( FT_Module module, + const char* service_id ) + { + FT_UNUSED( module ); + + return ft_service_list_lookup( psnames_services, service_id ); + } #endif /* !FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES */ + FT_CALLBACK_TABLE_DEF const FT_Module_Class psnames_module_class = { @@ -381,13 +392,15 @@ #ifdef FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES 0, + (FT_Module_Constructor)0, + (FT_Module_Destructor) 0, + (FT_Module_Requester) 0 #else (void*)&psnames_interface, /* module specific interface */ -#endif - (FT_Module_Constructor)0, (FT_Module_Destructor) 0, - (FT_Module_Requester) 0 + (FT_Module_Requester) psnames_get_service +#endif }; diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index cc186a68e..36b3b6b28 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -241,7 +241,7 @@ return result; } - static const FT_Service_PsNameRec sfnt_service_ps_name = + static const FT_Service_PsFontNameRec sfnt_service_ps_name = { (FT_PsName_GetFunc) sfnt_get_ps_name }; @@ -255,7 +255,7 @@ static const FT_ServiceDescRec sfnt_services[] = { - { FT_SERVICE_ID_POSTSCRIPT_NAME, & sfnt_service_ps_name }, + { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, & sfnt_service_ps_name }, #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES { FT_SERVICE_ID_GLYPH_DICT, & sfnt_service_glyph_dict }, #endif diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 64d8afbf9..e9f172f03 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -21,10 +21,9 @@ #include "ttload.h" #include "ttcmap0.h" #include FT_INTERNAL_SFNT_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H - +#include FT_SERVICE_POSTSCRIPT_NAMES_H #include "sferrors.h" @@ -365,11 +364,7 @@ face->goto_table = sfnt->goto_table; } - if ( !face->psnames ) - { - face->psnames = (PSNames_Service) - FT_Get_Module_Interface( library, "psnames" ); - } + FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_NAMES ); /* check that we have a valid TrueType file */ error = sfnt->load_sfnt_header( face, stream, face_index, &sfnt_header ); diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index 486ba3dd2..6647586b9 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -50,7 +50,7 @@ #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES -#include FT_INTERNAL_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_NAMES_H #define MAC_NAME( x ) ( (FT_String*)psnames->macintosh_name( x ) ) @@ -441,7 +441,7 @@ FT_Fixed format; #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES - PSNames_Service psnames; + FT_Service_PsNames psnames; #endif @@ -452,7 +452,7 @@ return SFNT_Err_Invalid_Glyph_Index; #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES - psnames = (PSNames_Service)face->psnames; + psnames = (FT_Service_PsNames)face->psnames; if ( !psnames ) return SFNT_Err_Unimplemented_Feature; #endif @@ -510,7 +510,7 @@ *PSname = MAC_NAME( idx ); } } - + /* nothing to do for format == 0x00030000L */ End: diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 3768dd6cb..e3a5c5113 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -23,7 +23,7 @@ #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H #include FT_INTERNAL_SFNT_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_NAMES_H #include "ttgload.h" #include "ttpload.h" diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index 35cde03d3..5c597b657 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -29,12 +29,12 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_SERVICE_MULTIPLE_MASTERS_H #include FT_SERVICE_GLYPH_DICT_H #include FT_SERVICE_XFREE86_NAME_H #include FT_SERVICE_POSTSCRIPT_NAME_H +#include FT_SERVICE_POSTSCRIPT_NAMES_H /*************************************************************************/ /* */ @@ -114,7 +114,7 @@ return (const char*) face->type1.font_name; } - static const FT_Service_PsNameRec t1_service_ps_name = + static const FT_Service_PsFontNameRec t1_service_ps_name = { (FT_PsName_GetFunc) t1_get_ps_name }; @@ -142,7 +142,7 @@ static const FT_ServiceDescRec t1_services[] = { - { FT_SERVICE_ID_POSTSCRIPT_NAME, &t1_service_ps_name }, + { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &t1_service_ps_name }, { FT_SERVICE_ID_GLYPH_DICT, &t1_service_glyph_dict }, { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TYPE_1 }, diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 9f3bed621..94452f56c 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -29,7 +29,7 @@ #include "t1afm.h" #endif -#include FT_INTERNAL_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_NAMES_H #include FT_INTERNAL_POSTSCRIPT_AUX_H @@ -279,7 +279,7 @@ FT_Parameter* params ) { FT_Error error; - PSNames_Service psnames; + FT_Service_PsNames psnames; PSAux_Service psaux; T1_Font type1 = &face->type1; PS_FontInfo info = &type1->font_info; @@ -292,9 +292,8 @@ face->root.num_faces = 1; - face->psnames = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), - "psnames" ); - psnames = (PSNames_Service)face->psnames; + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); + face->psnames = psnames; face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "psaux" ); diff --git a/src/type42/t42drivr.c b/src/type42/t42drivr.c index a86cafc8d..faa891e30 100644 --- a/src/type42/t42drivr.c +++ b/src/type42/t42drivr.c @@ -54,7 +54,7 @@ * GLYPH DICT SERVICE * */ - + static FT_Error t42_get_glyph_name( T42_Face face, FT_UInt glyph_index, @@ -116,15 +116,15 @@ */ static const char* - t42_get_ps_name( T42_Face face ) + t42_get_ps_font_name( T42_Face face ) { return (const char*)face->type1.font_name; } - static FT_Service_PsNameRec t42_service_ps_name = + static FT_Service_PsFontNameRec t42_service_ps_font_name = { - (FT_PsName_GetFunc)t42_get_ps_name + (FT_PsName_GetFunc)t42_get_ps_font_name }; @@ -136,9 +136,9 @@ static const FT_ServiceDescRec t42_services[] = { - { FT_SERVICE_ID_GLYPH_DICT, &t42_service_glyph_dict }, - { FT_SERVICE_ID_POSTSCRIPT_NAME, &t42_service_ps_name }, - { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TYPE_42 }, + { FT_SERVICE_ID_GLYPH_DICT, &t42_service_glyph_dict }, + { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &t42_service_ps_font_name }, + { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TYPE_42 }, { NULL, NULL } }; diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c index 37a45530f..e5a574817 100644 --- a/src/type42/t42objs.c +++ b/src/type42/t42objs.c @@ -150,7 +150,7 @@ FT_Parameter* params ) { FT_Error error; - PSNames_Service psnames; + FT_Service_PsNames psnames; PSAux_Service psaux; FT_Face root = (FT_Face)&face->root; T1_Font type1 = &face->type1; @@ -165,9 +165,8 @@ face->ttf_face = NULL; face->root.num_faces = 1; - face->psnames = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), - "psnames" ); - psnames = (PSNames_Service)face->psnames; + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); + face->psnames = psnames; face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "psaux" ); diff --git a/src/type42/t42objs.h b/src/type42/t42objs.h index 6fb176917..486718670 100644 --- a/src/type42/t42objs.h +++ b/src/type42/t42objs.h @@ -25,7 +25,7 @@ #include FT_INTERNAL_TYPE42_TYPES_H #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DRIVER_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_NAMES_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H