* 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
This commit is contained in:
David Turner 2003-09-29 20:33:37 +00:00
parent a259b6dddb
commit b72d8a8521
36 changed files with 351 additions and 447 deletions

View File

@ -1,3 +1,25 @@
2003-09-29 David Turner <david@freetype.org>
* 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 <wl@gnu.org>
* include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE):

View File

@ -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 );
/* */

View File

@ -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 <freetype/internal/services/svmm.h>
#define FT_SERVICE_POSTSCRIPT_NAME_H <freetype/internal/services/svpostnm.h>
#define FT_SERVICE_POSTSCRIPT_NAMES_H <freetype/internal/services/svpsname.h>
#define FT_SERVICE_GLYPH_DICT_H <freetype/internal/services/svgldict.h>
#define FT_SERVICE_BDF_H <freetype/internal/services/svbdf.h>
#define FT_SERVICE_XFREE86_NAME_H <freetype/internal/services/svxf86nm.h>

View File

@ -41,7 +41,6 @@
#define FT_INTERNAL_CFF_TYPES_H <freetype/internal/cfftypes.h>
#define FT_INTERNAL_BDF_TYPES_H <freetype/internal/bdftypes.h>
#define FT_INTERNAL_POSTSCRIPT_NAMES_H <freetype/internal/psnames.h>
#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>
#define FT_INTERNAL_POSTSCRIPT_HINTS_H <freetype/internal/pshints.h>
#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <freetype/internal/psglobal.h>

View File

@ -24,6 +24,7 @@
#include <ft2build.h>
#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;

View File

@ -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 <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <FuncType> */
/* PS_Unicode_Value_Func */
/* */
/* <Description> */
/* A function used to return the Unicode index corresponding to a */
/* given glyph name. */
/* */
/* <Input> */
/* glyph_name :: The glyph name. */
/* */
/* <Return> */
/* The Unicode character index resp. the non-Unicode value 0xFFFF if */
/* the glyph name has no known Unicode meaning. */
/* */
/* <Note> */
/* 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 );
/*************************************************************************/
/* */
/* <FuncType> */
/* PS_Unicode_Index_Func */
/* */
/* <Description> */
/* A function used to return the glyph index corresponding to a given */
/* Unicode value. */
/* */
/* <Input> */
/* num_glyphs :: The number of glyphs in the face. */
/* */
/* glyph_names :: An array of glyph name pointers. */
/* */
/* unicode :: The Unicode value. */
/* */
/* <Return> */
/* The glyph index resp. 0xFFFF if no glyph corresponds to this */
/* Unicode value. */
/* */
/* <Note> */
/* 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 );
/*************************************************************************/
/* */
/* <FuncType> */
/* PS_Macintosh_Name_Func */
/* */
/* <Description> */
/* A function used to return the glyph name corresponding to an Apple */
/* glyph name index. */
/* */
/* <Input> */
/* name_index :: The index of the Mac name. */
/* */
/* <Return> */
/* The glyph name, or 0 if the index is invalid. */
/* */
/* <Note> */
/* 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;
/*************************************************************************/
/* */
/* <Struct> */
/* PS_Unicodes */
/* */
/* <Description> */
/* 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. */
/* */
/* <Fields> */
/* 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. */
/* */
/* <Note> */
/* 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 );
/*************************************************************************/
/* */
/* <Struct> */
/* PSNames_Interface */
/* */
/* <Description> */
/* This structure defines the PSNames interface. */
/* */
/* <Fields> */
/* 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. */
/* */
/* <Note> */
/* `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 */

View File

@ -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;
};
/* */

View File

@ -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__ */

View File

@ -23,8 +23,9 @@
#include <ft2build.h>
#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;

View File

@ -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

View File

@ -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;

View File

@ -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, &registry );
@ -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 );

View File

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

View File

@ -28,9 +28,7 @@
if ( face )
FT_FACE_FIND_SERVICE( result,
face,
XF86_NAME );
FT_FACE_FIND_SERVICE( face, result, XF86_NAME );
return result;
}

View File

@ -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;
}

View File

@ -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];

View File

@ -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;

View File

@ -22,7 +22,7 @@
#include <ft2build.h>
#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 )

View File

@ -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. */

View File

@ -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

View File

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

View File

@ -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 }
};

View File

@ -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 )
{

View File

@ -22,7 +22,6 @@
#include <ft2build.h>
#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__ */

View File

@ -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: " ));

View File

@ -22,7 +22,6 @@
#include <ft2build.h>
#include FT_INTERNAL_POSTSCRIPT_AUX_H
#include FT_INTERNAL_POSTSCRIPT_NAMES_H
#include FT_INTERNAL_TYPE1_TYPES_H

View File

@ -17,8 +17,8 @@
#include <ft2build.h>
#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,
#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
(PS_Next_Unicode_Func) ps_next_unicode
#else
0
#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
t1_expert_encoding
};
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,
#else
(void*)&psnames_interface, /* module specific interface */
#endif
(FT_Module_Constructor)0,
(FT_Module_Destructor) 0,
(FT_Module_Requester) 0
#else
(void*)&psnames_interface, /* module specific interface */
(FT_Module_Constructor)0,
(FT_Module_Destructor) 0,
(FT_Module_Requester) psnames_get_service
#endif
};

View File

@ -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

View File

@ -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 );

View File

@ -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:

View File

@ -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"

View File

@ -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 },

View File

@ -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" );

View File

@ -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 }
};

View File

@ -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" );

View File

@ -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