From 7760595f84a8edc365f280a9358d4075d42d51ea Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 29 Oct 2003 21:43:52 +0000 Subject: [PATCH] * include/freetype/internal/bdftypes.h: removed obsolete header * include/freetype/internal/cfftypes.h, src/cff/cfftypes.h, src/cff/cffload.h, src/cff/cffobjs.h, src/cff/cffparse.h, include/freetype/internal/services/svbdf.h: moving "cfftypes.h" from 'include/freetype/internal' to 'src/cff' since no other modules needs to known about these types * include/freetype/internal/t42types.h, include/freetype/internal/internal.h, src/type42/t42objs.h, src/type42/t42drivr.c, src/type42/t42types.h: moving "t42types.h" from 'include/freetype/internal' to 'src/type42' since no other modules needs to known about these types * src/gzip/infblock.c: removing compiler warning * include/freetype/internal/services/svpsinfo.h, include/freetype/internal/ftserv.h, src/cff/cffdrivr.c, src/cid/ciddrivr.c, src/type1/t1driver.c, src/type42/t42drivr.c, src/base/fttype1.c: migrating to FT_SERVICE_ID_POSTSCRIPT_INFO defined in "svpsinfo.h", removing some sad hacks. --- ChangeLog | 25 ++++++++ include/freetype/internal/bdftypes.h | 58 ------------------- include/freetype/internal/ftserv.h | 2 + include/freetype/internal/internal.h | 3 - include/freetype/internal/psaux.h | 4 +- include/freetype/internal/services/svbdf.h | 4 +- .../services/{svpsname.h => svpscmap.h} | 12 ++-- include/freetype/internal/services/svpsinfo.h | 30 ++++++++++ include/freetype/internal/t1types.h | 2 +- include/freetype/internal/tttypes.h | 2 +- src/base/ftbdf.c | 1 - src/base/fttype1.c | 54 +++++------------ src/cff/cffcmap.c | 2 +- src/cff/cffdrivr.c | 35 ++++++++--- src/cff/cffload.c | 4 +- src/cff/cffload.h | 6 +- src/cff/cffobjs.c | 8 +-- src/cff/cffobjs.h | 4 +- src/cff/cffparse.h | 2 +- .../freetype/internal => src/cff}/cfftypes.h | 0 src/cid/cidobjs.c | 6 +- src/cid/cidriver.c | 22 +++++++ src/gzip/infblock.c | 3 +- src/psaux/t1cmap.c | 4 +- src/psaux/t1decode.c | 6 +- src/psnames/psmodule.c | 12 ++-- src/sfnt/sfobjs.c | 4 +- src/sfnt/ttpost.c | 6 +- src/type1/t1driver.c | 30 +++++++++- src/type1/t1objs.c | 6 +- src/type42/t42drivr.c | 28 +++++++++ src/type42/t42objs.c | 4 +- src/type42/t42objs.h | 4 +- .../internal => src/type42}/t42types.h | 0 34 files changed, 233 insertions(+), 160 deletions(-) delete mode 100644 include/freetype/internal/bdftypes.h rename include/freetype/internal/services/{svpsname.h => svpscmap.h} (92%) create mode 100644 include/freetype/internal/services/svpsinfo.h rename {include/freetype/internal => src/cff}/cfftypes.h (100%) rename {include/freetype/internal => src/type42}/t42types.h (100%) diff --git a/ChangeLog b/ChangeLog index 1d82f6467..f14267655 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2003-10-29 David Turner + + * include/freetype/internal/bdftypes.h: removed obsolete header + + * include/freetype/internal/cfftypes.h, src/cff/cfftypes.h, + src/cff/cffload.h, src/cff/cffobjs.h, src/cff/cffparse.h, + include/freetype/internal/services/svbdf.h: moving "cfftypes.h" from + 'include/freetype/internal' to 'src/cff' since no other modules needs + to known about these types + + * include/freetype/internal/t42types.h, + include/freetype/internal/internal.h, src/type42/t42objs.h, + src/type42/t42drivr.c, src/type42/t42types.h: moving "t42types.h" from + 'include/freetype/internal' to 'src/type42' since no other modules needs + to known about these types + + * src/gzip/infblock.c: removing compiler warning + + * include/freetype/internal/services/svpsinfo.h, + include/freetype/internal/ftserv.h, src/cff/cffdrivr.c, + src/cid/ciddrivr.c, src/type1/t1driver.c, src/type42/t42drivr.c, + src/base/fttype1.c: migrating to FT_SERVICE_ID_POSTSCRIPT_INFO defined + in "svpsinfo.h", removing some sad hacks. + + 2003-10-22 Werner Lemberg * src/type1/t1load.c (parse_encoding): Handle `/Encoding [ ... ]'. diff --git a/include/freetype/internal/bdftypes.h b/include/freetype/internal/bdftypes.h deleted file mode 100644 index 3a1ec6435..000000000 --- a/include/freetype/internal/bdftypes.h +++ /dev/null @@ -1,58 +0,0 @@ -/* bdftypes.h - - FreeType font driver for bdf fonts - - Copyright (C) 2001, 2002 by - Francesco Zappa Nardelli - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -#ifndef __BDFTYPES_H__ -#define __BDFTYPES_H__ - -#include -#include FT_FREETYPE_H -#include FT_BDF_H - - -FT_BEGIN_HEADER - - - typedef struct BDF_Public_FaceRec_ - { - FT_FaceRec root; - - char* charset_encoding; - char* charset_registry; - - } BDF_Public_FaceRec, *BDF_Public_Face; - - - typedef FT_Error (*BDF_GetPropertyFunc)( FT_Face face, - const char* prop_name, - BDF_PropertyRec *aproperty ); - -FT_END_HEADER - - -#endif /* __BDFTYPES_H__ */ - - -/* END */ diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h index 561d6f584..e0596ad48 100644 --- a/include/freetype/internal/ftserv.h +++ b/include/freetype/internal/ftserv.h @@ -241,6 +241,8 @@ FT_BEGIN_HEADER #define FT_SERVICE_MULTIPLE_MASTERS_H #define FT_SERVICE_POSTSCRIPT_NAME_H #define FT_SERVICE_POSTSCRIPT_NAMES_H +#define FT_SERVICE_POSTSCRIPT_CMAPS_H +#define FT_SERVICE_POSTSCRIPT_INFO_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 3b030cfbb..034878942 100644 --- a/include/freetype/internal/internal.h +++ b/include/freetype/internal/internal.h @@ -37,9 +37,6 @@ #define FT_INTERNAL_TRUETYPE_TYPES_H #define FT_INTERNAL_TYPE1_TYPES_H -#define FT_INTERNAL_TYPE42_TYPES_H -#define FT_INTERNAL_CFF_TYPES_H -#define FT_INTERNAL_BDF_TYPES_H #define FT_INTERNAL_POSTSCRIPT_AUX_H #define FT_INTERNAL_POSTSCRIPT_HINTS_H diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index bc36da7af..e013d52fa 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -24,7 +24,7 @@ #include #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_TYPE1_TYPES_H -#include FT_SERVICE_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H FT_BEGIN_HEADER @@ -651,7 +651,7 @@ FT_BEGIN_HEADER T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1]; T1_Decoder_Zone zone; - FT_Service_PsNames psnames; /* for seac */ + FT_Service_PsCMaps psnames; /* for seac */ FT_UInt num_glyphs; FT_Byte** glyph_names; diff --git a/include/freetype/internal/services/svbdf.h b/include/freetype/internal/services/svbdf.h index 276354f29..0f7fc6115 100644 --- a/include/freetype/internal/services/svbdf.h +++ b/include/freetype/internal/services/svbdf.h @@ -19,6 +19,7 @@ #ifndef __SVBDF_H__ #define __SVBDF_H__ +#include FT_BDF_H #include FT_INTERNAL_SERVICE_H @@ -27,7 +28,6 @@ FT_BEGIN_HEADER #define FT_SERVICE_ID_BDF "bdf" - typedef FT_Error (*FT_BDF_GetCharsetIdFunc)( FT_Face face, const char* *acharset_encoding, @@ -47,7 +47,7 @@ FT_BEGIN_HEADER /* */ - + FT_END_HEADER diff --git a/include/freetype/internal/services/svpsname.h b/include/freetype/internal/services/svpscmap.h similarity index 92% rename from include/freetype/internal/services/svpsname.h rename to include/freetype/internal/services/svpscmap.h index 279afdac1..374503ba6 100644 --- a/include/freetype/internal/services/svpsname.h +++ b/include/freetype/internal/services/svpscmap.h @@ -1,8 +1,8 @@ /***************************************************************************/ /* */ -/* svpsname.h */ +/* svpscmap.h */ /* */ -/* The FreeType glyph PS name services (specification). */ +/* The FreeType PostScript charmap service (specification) */ /* */ /* Copyright 2003 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ @@ -16,14 +16,14 @@ /***************************************************************************/ -#ifndef __SVPSNAME_H__ -#define __SVPSNAME_H__ +#ifndef __SVPSCMAP_H__ +#define __SVPSCMAP_H__ FT_BEGIN_HEADER -#define FT_SERVICE_ID_POSTSCRIPT_NAMES "postscript-names" +#define FT_SERVICE_ID_POSTSCRIPT_CMAPS "postscript-cmaps" /* @@ -87,7 +87,7 @@ FT_BEGIN_HEADER FT_ULong unicode ); - FT_DEFINE_SERVICE( PsNames ) + FT_DEFINE_SERVICE( PsCMaps ) { PS_Unicode_ValueFunc unicode_value; diff --git a/include/freetype/internal/services/svpsinfo.h b/include/freetype/internal/services/svpsinfo.h new file mode 100644 index 000000000..5bf7c49f6 --- /dev/null +++ b/include/freetype/internal/services/svpsinfo.h @@ -0,0 +1,30 @@ +#ifndef __SVPSINFO_H__ +#define __SVPSINFO_H__ + +#include FT_INTERNAL_SERVICE_H +#include FT_INTERNAL_TYPE1_TYPES_H + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_POSTSCRIPT_INFO "postscript-info" + + typedef FT_Error (*PS_GetFontInfoFunc)( FT_Face face, + PS_FontInfoRec* afont_info ); + + typedef FT_Int (*PS_HasGlyphNamesFunc)( FT_Face face ); + + FT_DEFINE_SERVICE( PsInfo ) + { + PS_GetFontInfoFunc ps_get_font_info; + PS_HasGlyphNamesFunc ps_has_glyph_names; + }; + + /* */ + + +FT_END_HEADER + + + +#endif /* __SVPSINFO_H__ */ diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h index 3d290d52e..08bdfb1a2 100644 --- a/include/freetype/internal/t1types.h +++ b/include/freetype/internal/t1types.h @@ -25,7 +25,7 @@ #include FT_TYPE1_TABLES_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H #include FT_INTERNAL_SERVICE_H -#include FT_SERVICE_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H FT_BEGIN_HEADER diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index 4b71b95e7..2b419f105 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1500,7 +1500,7 @@ FT_BEGIN_HEADER /* the basic TrueType tables in the face object */ void* sfnt; - /* a typeless pointer to the FT_Service_PsNamesRec table used to */ + /* a typeless pointer to the FT_Service_PsCMapsRec table used to */ /* handle glyph names <-> unicode & Mac values */ void* psnames; diff --git a/src/base/ftbdf.c b/src/base/ftbdf.c index 59e5d2018..d2f133db7 100644 --- a/src/base/ftbdf.c +++ b/src/base/ftbdf.c @@ -17,7 +17,6 @@ #include -#include FT_INTERNAL_BDF_TYPES_H #include FT_INTERNAL_OBJECTS_H #include FT_SERVICE_BDF_H diff --git a/src/base/fttype1.c b/src/base/fttype1.c index d8b188647..7b4513911 100644 --- a/src/base/fttype1.c +++ b/src/base/fttype1.c @@ -17,9 +17,9 @@ #include -#include FT_INTERNAL_TYPE1_TYPES_H -#include FT_INTERNAL_TYPE42_TYPES_H #include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_SERVICE_H +#include FT_SERVICE_POSTSCRIPT_INFO_H /* documentation is in t1tables.h */ @@ -28,58 +28,36 @@ FT_Get_PS_Font_Info( FT_Face face, PS_FontInfoRec* afont_info ) { - PS_FontInfo font_info = NULL; - FT_Error error = FT_Err_Invalid_Argument; - const char* driver_name; + FT_Error error = FT_Err_Invalid_Argument; - - if ( face && face->driver && face->driver->root.clazz ) + if ( face ) { - driver_name = face->driver->root.clazz->module_name; - if ( ft_strcmp( driver_name, "type1" ) == 0 ) - font_info = &((T1_Face)face)->type1.font_info; - else if ( ft_strcmp( driver_name, "t1cid" ) == 0 ) - font_info = &((CID_Face)face)->cid.font_info; - else if ( ft_strcmp( driver_name, "type42" ) == 0 ) - font_info = &((T42_Face)face)->type1.font_info; - } - if ( font_info != NULL ) - { - *afont_info = *font_info; - error = FT_Err_Ok; - } + FT_Service_PsInfo service = NULL; + FT_FACE_FIND_SERVICE( service, face, POSTSCRIPT_INFO ); + + if ( service && service->ps_get_font_info ) + error = service->ps_get_font_info( face, afont_info ); + } return error; } - /* XXX: Bad hack, but I didn't want to change several drivers here. */ - /* documentation is in t1tables.h */ FT_EXPORT_DEF( FT_Int ) FT_Has_PS_Glyph_Names( FT_Face face ) { - FT_Int result = 0; - const char* driver_name; + FT_Int result = 0; + FT_Service_PsInfo service = NULL; - - if ( face && face->driver && face->driver->root.clazz ) + if ( face ) { - /* Currently, only the type1, type42, and cff drivers provide */ - /* reliable glyph names... */ + FT_FACE_FIND_SERVICE( service, face, POSTSCRIPT_INFO ); - /* We could probably hack the TrueType driver to recognize */ - /* certain cases where the glyph names are most certainly */ - /* correct (e.g. using a 20 or 22 format `post' table), but */ - /* this will probably happen later... */ - - driver_name = face->driver->root.clazz->module_name; - result = ( ft_strcmp( driver_name, "type1" ) == 0 || - ft_strcmp( driver_name, "type42" ) == 0 || - ft_strcmp( driver_name, "cff" ) == 0 ); + if ( service && service->ps_has_glyph_names ) + result = service->ps_has_glyph_names( face ); } - return result; } diff --git a/src/cff/cffcmap.c b/src/cff/cffcmap.c index 46f959495..c50718a74 100644 --- a/src/cff/cffcmap.c +++ b/src/cff/cffcmap.c @@ -146,7 +146,7 @@ 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; + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames; cmap->num_pairs = 0; diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index fe50b2683..6099fdff2 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -22,7 +22,8 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_IDS_H -#include FT_SERVICE_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H +#include FT_SERVICE_POSTSCRIPT_INFO_H #include "cffdrivr.h" #include "cffgload.h" @@ -227,11 +228,11 @@ FT_Memory memory = FT_FACE_MEMORY( face ); FT_String* gname; FT_UShort sid; - FT_Service_PsNames psnames; + FT_Service_PsCMaps psnames; FT_Error error; - FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); if ( !psnames ) { FT_ERROR(( "cff_get_glyph_name:" )); @@ -274,7 +275,7 @@ { CFF_Font cff; CFF_Charset charset; - FT_Service_PsNames psnames; + FT_Service_PsCMaps psnames; FT_Memory memory = FT_FACE_MEMORY( face ); FT_String* name; FT_UShort sid; @@ -285,7 +286,7 @@ cff = (CFF_FontRec *)face->extra.data; charset = &cff->charset; - FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); for ( i = 0; i < cff->num_glyphs; i++ ) { sid = charset->sids[i]; @@ -314,6 +315,25 @@ (FT_GlyphDict_NameIndexFunc)cff_get_name_index, }; + /* + * POSTSCRIPT INFO SERVICE + * + */ + + static FT_Int + cff_ps_has_glyph_names( FT_Face face ) + { + FT_UNUSED( face ); + return 1; + } + + static const FT_Service_PsInfoRec cff_service_ps_info = + { + (PS_GetFontInfoFunc) NULL, /* unsupported with CFF fonts */ + (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names + }; + + /*************************************************************************/ /*************************************************************************/ @@ -329,9 +349,10 @@ static const FT_ServiceDescRec cff_services[] = { - { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF }, + { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF }, + { FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info }, #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES - { FT_SERVICE_ID_GLYPH_DICT, &cff_service_glyph_dict }, + { FT_SERVICE_ID_GLYPH_DICT, &cff_service_glyph_dict }, #endif { NULL, NULL } }; diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 205b7ec5f..e6c27d881 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_SERVICE_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_TRUETYPE_TAGS_H #include "cffload.h" @@ -1314,7 +1314,7 @@ FT_LOCAL_DEF( FT_String* ) cff_index_get_sid_string( CFF_Index idx, FT_UInt sid, - FT_Service_PsNames psnames ) + FT_Service_PsCMaps psnames ) { /* if it is not a standard string, return it */ if ( sid > 390 ) diff --git a/src/cff/cffload.h b/src/cff/cffload.h index 4c4ae2093..fa8ac518b 100644 --- a/src/cff/cffload.h +++ b/src/cff/cffload.h @@ -21,8 +21,8 @@ #include -#include FT_INTERNAL_CFF_TYPES_H -#include FT_SERVICE_POSTSCRIPT_NAMES_H +#include "cfftypes.h" +#include FT_SERVICE_POSTSCRIPT_CMAPS_H FT_BEGIN_HEADER @@ -38,7 +38,7 @@ FT_BEGIN_HEADER FT_LOCAL( FT_String* ) cff_index_get_sid_string( CFF_Index idx, FT_UInt sid, - FT_Service_PsNames psnames ); + FT_Service_PsCMaps psnames ); FT_LOCAL( FT_Error ) diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index e32731f13..7da95821a 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_SERVICE_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H #include "cffobjs.h" #include "cffload.h" @@ -255,7 +255,7 @@ { FT_Error error; SFNT_Service sfnt; - FT_Service_PsNames psnames; + FT_Service_PsCMaps psnames; PSHinter_Service pshinter; FT_Bool pure_cff = 1; FT_Bool sfnt_format = 0; @@ -273,7 +273,7 @@ if ( !sfnt ) goto Bad_Format; - FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); pshinter = (PSHinter_Service)FT_Get_Module_Interface( face->root.driver->root.library, "pshinter" ); @@ -324,7 +324,7 @@ /* FreeType 2 */ } - /* now, load the CFF part of the file */ + /* now, load the CFF part of the file */ error = face->goto_table( face, TTAG_CFF, stream, 0 ); if ( error ) goto Exit; diff --git a/src/cff/cffobjs.h b/src/cff/cffobjs.h index afcc22200..68ebecaf0 100644 --- a/src/cff/cffobjs.h +++ b/src/cff/cffobjs.h @@ -22,9 +22,9 @@ #include #include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_CFF_TYPES_H +#include "cfftypes.h" #include FT_INTERNAL_TRUETYPE_TYPES_H -#include FT_SERVICE_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H FT_BEGIN_HEADER diff --git a/src/cff/cffparse.h b/src/cff/cffparse.h index 2de95a2c5..b78c28609 100644 --- a/src/cff/cffparse.h +++ b/src/cff/cffparse.h @@ -21,7 +21,7 @@ #include -#include FT_INTERNAL_CFF_TYPES_H +#include "cfftypes.h" #include FT_INTERNAL_OBJECTS_H diff --git a/include/freetype/internal/cfftypes.h b/src/cff/cfftypes.h similarity index 100% rename from include/freetype/internal/cfftypes.h rename to src/cff/cfftypes.h diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index 5081231c5..ebf45e8aa 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -23,7 +23,7 @@ #include "cidgload.h" #include "cidload.h" -#include FT_SERVICE_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H @@ -269,7 +269,7 @@ FT_Parameter* params ) { FT_Error error; - FT_Service_PsNames psnames; + FT_Service_PsCMaps psnames; PSAux_Service psaux; PSHinter_Service pshinter; @@ -281,7 +281,7 @@ face->root.num_faces = 1; - FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); psaux = (PSAux_Service)face->psaux; if ( !psaux ) diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index 268bd4ec8..2f3908aa5 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -26,6 +26,7 @@ #include FT_SERVICE_POSTSCRIPT_NAME_H #include FT_SERVICE_XFREE86_NAME_H +#include FT_SERVICE_POSTSCRIPT_INFO_H /*************************************************************************/ /* */ @@ -61,6 +62,26 @@ }; + /* + * POSTSCRIPT INFO SERVICE + * + */ + + static FT_Error + cid_ps_get_font_info( FT_Face face, + PS_FontInfoRec* afont_info ) + { + *afont_info = ((CID_Face)face)->cid.font_info; + return 0; + } + + static const FT_Service_PsInfoRec cid_service_ps_info = + { + (PS_GetFontInfoFunc) cid_ps_get_font_info, + (PS_HasGlyphNamesFunc) NULL /* unsupported with CID fonts */ + }; + + /* * SERVICE LIST * @@ -70,6 +91,7 @@ { { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name }, { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CID }, + { FT_SERVICE_ID_POSTSCRIPT_INFO, &cid_service_ps_info }, { NULL, NULL } }; diff --git a/src/gzip/infblock.c b/src/gzip/infblock.c index 8d3e21042..d6e2dc297 100644 --- a/src/gzip/infblock.c +++ b/src/gzip/infblock.c @@ -156,7 +156,8 @@ int r ) uInt bl, bd; inflate_huft *tl, *td; - inflate_trees_fixed(&bl, &bd, &tl, &td, z); + inflate_trees_fixed(&bl, &bd, (const inflate_huft**)&tl, + (const inflate_huft**)&td, z); s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z); if (s->sub.decode.codes == Z_NULL) { diff --git a/src/psaux/t1cmap.c b/src/psaux/t1cmap.c index 9734c6e0b..dcd99be49 100644 --- a/src/psaux/t1cmap.c +++ b/src/psaux/t1cmap.c @@ -36,7 +36,7 @@ FT_Int is_expert ) { T1_Face face = (T1_Face)FT_CMAP_FACE( cmap ); - FT_Service_PsNames psnames = (FT_Service_PsNames)face->psnames; + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; cmap->num_glyphs = face->type1.num_glyphs; @@ -282,7 +282,7 @@ 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; + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; cmap->num_pairs = 0; diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index 6cc0948cd..a982d6f56 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -127,7 +127,7 @@ { FT_UInt n; const FT_String* glyph_name; - FT_Service_PsNames psnames = decoder->psnames; + FT_Service_PsCMaps psnames = decoder->psnames; /* check range of standard char code */ @@ -1129,10 +1129,10 @@ /* retrieve PSNames interface from list of current modules */ { - FT_Service_PsNames psnames = 0; + FT_Service_PsCMaps psnames = 0; - FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); if ( !psnames ) { FT_ERROR(( "t1_decoder_init: " )); diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c index f558bee85..f6d6ae328 100644 --- a/src/psnames/psmodule.c +++ b/src/psnames/psmodule.c @@ -18,7 +18,7 @@ #include #include FT_INTERNAL_OBJECTS_H -#include FT_SERVICE_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H #include "psmodule.h" #include "pstables.h" @@ -335,7 +335,7 @@ static - const FT_Service_PsNamesRec psnames_interface = + const FT_Service_PsCMapsRec pscmaps_interface = { #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST @@ -361,9 +361,9 @@ }; - static const FT_ServiceDescRec psnames_services[] = + static const FT_ServiceDescRec pscmaps_services[] = { - { FT_SERVICE_ID_POSTSCRIPT_NAMES, &psnames_interface }, + { FT_SERVICE_ID_POSTSCRIPT_CMAPS, &pscmaps_interface }, { NULL, NULL } }; @@ -374,7 +374,7 @@ { FT_UNUSED( module ); - return ft_service_list_lookup( psnames_services, service_id ); + return ft_service_list_lookup( pscmaps_services, service_id ); } #endif /* !FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES */ @@ -397,7 +397,7 @@ (FT_Module_Destructor) 0, (FT_Module_Requester) 0 #else - (void*)&psnames_interface, /* module specific interface */ + (void*)&pscmaps_interface, /* module specific interface */ (FT_Module_Constructor)0, (FT_Module_Destructor) 0, (FT_Module_Requester) psnames_get_service diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index e9f172f03..237fc969a 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -23,7 +23,7 @@ #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H -#include FT_SERVICE_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H #include "sferrors.h" @@ -364,7 +364,7 @@ face->goto_table = sfnt->goto_table; } - FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_NAMES ); + FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_CMAPS ); /* 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 cc5e101f4..3d526db4c 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -50,7 +50,7 @@ #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES -#include FT_SERVICE_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H #define MAC_NAME( x ) ( (FT_String*)psnames->macintosh_name( x ) ) @@ -441,7 +441,7 @@ FT_Fixed format; #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES - FT_Service_PsNames psnames; + FT_Service_PsCMaps psnames; #endif @@ -452,7 +452,7 @@ return SFNT_Err_Invalid_Glyph_Index; #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES - psnames = (FT_Service_PsNames)face->psnames; + psnames = (FT_Service_PsCMaps)face->psnames; if ( !psnames ) return SFNT_Err_Unimplemented_Feature; #endif diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index b28c2df98..5aafca33e 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -34,7 +34,8 @@ #include FT_SERVICE_GLYPH_DICT_H #include FT_SERVICE_XFREE86_NAME_H #include FT_SERVICE_POSTSCRIPT_NAME_H -#include FT_SERVICE_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H +#include FT_SERVICE_POSTSCRIPT_INFO_H /*************************************************************************/ /* */ @@ -135,6 +136,32 @@ #endif + /* + * POSTSCRIPT INFO SERVICE + * + */ + + static FT_Error + t1_ps_get_font_info( FT_Face face, + PS_FontInfoRec* afont_info ) + { + *afont_info = ((T1_Face)face)->type1.font_info; + return 0; + } + + static FT_Int + t1_ps_has_glyph_names( FT_Face face ) + { + FT_UNUSED( face ); + return 1; + } + + static const FT_Service_PsInfoRec t1_service_ps_info = + { + (PS_GetFontInfoFunc) t1_ps_get_font_info, + (PS_HasGlyphNamesFunc) t1_ps_has_glyph_names + }; + /* * SERVICE LIST * @@ -145,6 +172,7 @@ { 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 }, + { FT_SERVICE_ID_POSTSCRIPT_INFO, &t1_service_ps_info }, #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT { FT_SERVICE_ID_MULTI_MASTERS, &t1_service_multi_masters }, diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 39598852a..6a4f98862 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -29,7 +29,7 @@ #include "t1afm.h" #endif -#include FT_SERVICE_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_INTERNAL_POSTSCRIPT_AUX_H @@ -276,7 +276,7 @@ FT_Parameter* params ) { FT_Error error; - FT_Service_PsNames psnames; + FT_Service_PsCMaps psnames; PSAux_Service psaux; T1_Font type1 = &face->type1; PS_FontInfo info = &type1->font_info; @@ -289,7 +289,7 @@ face->root.num_faces = 1; - FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); face->psnames = psnames; face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), diff --git a/src/type42/t42drivr.c b/src/type42/t42drivr.c index 92cccaed5..deb7f2898 100644 --- a/src/type42/t42drivr.c +++ b/src/type42/t42drivr.c @@ -43,6 +43,7 @@ #include FT_SERVICE_XFREE86_NAME_H #include FT_SERVICE_GLYPH_DICT_H #include FT_SERVICE_POSTSCRIPT_NAME_H +#include FT_SERVICE_POSTSCRIPT_INFO_H #undef FT_COMPONENT #define FT_COMPONENT trace_t42 @@ -127,6 +128,33 @@ }; + /* + * POSTSCRIPT INFO SERVICE + * + */ + + static FT_Error + t42_ps_get_font_info( FT_Face face, + PS_FontInfoRec* afont_info ) + { + *afont_info = ((T42_Face)face)->type1.font_info; + return 0; + } + + static FT_Int + t42_ps_has_glyph_names( FT_Face face ) + { + FT_UNUSED( face ); + return 1; + } + + static const FT_Service_PsInfoRec t42_service_ps_info = + { + (PS_GetFontInfoFunc) t42_ps_get_font_info, + (PS_HasGlyphNamesFunc) t42_ps_has_glyph_names + }; + + /* * * SERVICE LIST diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c index 685c38023..a3763c811 100644 --- a/src/type42/t42objs.c +++ b/src/type42/t42objs.c @@ -154,7 +154,7 @@ FT_Parameter* params ) { FT_Error error; - FT_Service_PsNames psnames; + FT_Service_PsCMaps psnames; PSAux_Service psaux; FT_Face root = (FT_Face)&face->root; T1_Font type1 = &face->type1; @@ -169,7 +169,7 @@ face->ttf_face = NULL; face->root.num_faces = 1; - FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); + FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); face->psnames = psnames; face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), diff --git a/src/type42/t42objs.h b/src/type42/t42objs.h index c15595103..623809573 100644 --- a/src/type42/t42objs.h +++ b/src/type42/t42objs.h @@ -22,10 +22,10 @@ #include FT_FREETYPE_H #include FT_TYPE1_TABLES_H #include FT_INTERNAL_TYPE1_TYPES_H -#include FT_INTERNAL_TYPE42_TYPES_H +#include "t42types.h" #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DRIVER_H -#include FT_SERVICE_POSTSCRIPT_NAMES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H diff --git a/include/freetype/internal/t42types.h b/src/type42/t42types.h similarity index 100% rename from include/freetype/internal/t42types.h rename to src/type42/t42types.h