diff --git a/ChangeLog b/ChangeLog index b028391a0..b1cd95e8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,27 +1,122 @@ -2003-09-29 David Turner - - * src/base/ftglyph.c (FT_Get_Glyph): fixing small bug, thanks - to Henry Maddocks for spotting this - - * 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 ??) +2003-09-29 Werner Lemberg + * include/freetype/internal/t1types.h: Don't include + FT_INTERNAL_OBJECTS_H but FT_INTERNAL_SERVICE_H. + * src/truetype/ttobjs.c: Don't include + FT_SERVICE_POSTSCRIPT_NAMES_H. - * 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-29 David Turner + 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 names for a given face. + (Should we merge these two services into a single header?) + + * include/freetype/internal/psnames.h: Removed. Most of its + contents is moved to... + * include/freetype/internal/services/svpsname.h: New file. + + * include/freetype/internal/services/svpostnm.h + (FT_SERVICE_ID_POSTSCRIPT_NAME): Replaced with... + (FT_SERVICE_ID_POSTSCRIPT_FONT_NAME): New macro. + (PsName): Service named changed to... + (PsFontName): This. + Updated `FT_Service_PsName' -> `FT_Service_PsFontName' and + `POSTSCRIPT_NAME' -> `POSTSCRIPT_FONT_NAME' everywhere. + + * include/freetype/internal/internal.h + (FT_INTERNAL_POSTSCRIPT_NAMES_H): Removed. + * include/freetype/internal/psaux.h: Include + FT_SERVICE_POSTSCRIPT_NAMES_H. + (T1_DecoderRec): Updated type of `psnames'. + * include/freetype/internal/t1types.h: Don't include + FT_INTERNAL_POSTSCRIPT_NAMES_H but FT_SERVICE_POSTSCRIPT_NAMES_H. + Include FT_INTERNAL_OBJECTS_H. + * include/freetype/internal/t42types.h: Don't include + FT_INTERNAL_POSTSCRIPT_NAMES_H. + * include/freetype/internal/tttypes.h (TT_FaceRec): Updated. + + * include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE): Changed + order of parameters. All callers updated. + (FT_FACE_FIND_GLOBAL_SERVICE): New macro to look up a service + globally, checking all modules. + (FT_ServiceCacheRec): Updated. + (FT_SERVICE_POSTSCRIPT_NAMES_H): New macro for accessing + `svpsname.h'. + + * include/freetype/internal/ftobjs.h, src/base/ftobjs.c + (ft_module_get_service): New function. + + * src/cff/cffdrivr.c: Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H + but FT_SERVICE_POSTSCRIPT_NAMES_H. + (cff_get_glyph_name, cff_get_name_index): Use new POSTSCRIPT_NAMES + service. + * src/cff/cffcmap.c (cff_cmap_unicode_init): Updated. + * src/cff/cffload.c, src/cff/cffload.h: Don't include + FT_INTERNAL_POSTSCRIPT_NAMES_H but FT_SERVICE_POSTSCRIPT_NAMES_H. + (cff_index_get_sid_string): Updated. + * src/cff/cffobjs.c: Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H + but FT_SERVICE_POSTSCRIPT_NAMES_H. + (cff_face_init): Use new POSTSCRIPT_NAMES service. + * src/cff/cffobjs.h: Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H + but FT_SERVICE_POSTSCRIPT_NAMES_H. + + * src/cid/cidobjs.c: Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H + but FT_SERVICE_POSTSCRIPT_NAMES_H. + (cid_face_init): Use new POSTSCRIPT_NAMES service. + * src/cid/cidriver.c: Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H. + + * src/psaux/t1cmap.c (t1_cmap_std_init, t1_cmap_unicode_init): Use + new POSTSCRIPT_NAMES service. + * src/psaux/t1decode.h (t1_lookup_glyph_by_stdcharcode, + t1_decode_init): Use new POSTSCRIPT_NAMES service. + * src/psaux/t1cmap.h, src/psaux/t1decode.h: Dont' include + FT_INTERNAL_POSTSCRIPT_NAMES_H. + + * src/psnames/psmodule.c: Don't include + FT_INTERNAL_POSTSCRIPT_NAMES_H but FT_SERVICE_POSTSCRIPT_NAMES_H. + (ps_build_unicode_table): Renamed to... + (ps_unicodes_init): This. + (ps_lookup_unicode): Renamed to... + (ps_unicodes_char_index): This. + (ps_next_unicode): Renamed to... + (ps_unicodes_char_next): This. + (psnames_interface): Updated. + (psnames_services): New services list. + (psnames_get_service): New function. + (psnames_module_class): Updated. + + * src/sfnt/sfobjs.c: Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H + but FT_SERVICE_POSTSCRIPT_NAMES_H. + (sfnt_init_face): Use new POSTSCRIPT_NAMES service. + * src/sfnt/ttpost.c: Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H + but FT_SERVICE_POSTSCRIPT_NAMES_H. + (tt_face_get_ps_name): Updated. + + * src/truetype/ttobjs.c: Don't include + FT_INTERNAL_POSTSCRIPT_NAMES_H but FT_SERVICE_POSTSCRIPT_NAMES_H. + + * src/type1/t1driver.c: Don't include + FT_INTERNAL_POSTSCRIPT_NAMES_H but FT_SERVICE_POSTSCRIPT_NAMES_H. + * src/type1/t1objs.c: Don't include + FT_INTERNAL_POSTSCRIPT_NAMES_H but FT_SERVICE_POSTSCRIPT_NAMES_H. + (T1_Face_Init): Use new POSTSCRIPT_NAMES service. + + * src/type42/t42drivr.c (t42_get_ps_name): Renamed to... + (t42_get_ps_font_name): This. + (t42_service_ps_name): Renamed to... + (t42_service_ps_font_name): This. + (t42_services): Updated. + * src/type42/t42objs.c (T42_Face_Init): Use new POSTSCRIPT_NAMES + service. + * src/type42/t42objs.h: Don't include + FT_INTERNAL_POSTSCRIPT_NAMES_H but FT_SERVICE_POSTSCRIPT_NAMES_H. + + + * src/base/ftglyph.c (FT_Get_Glyph): Don't access `slot' before + testing its validity. Reported by Henry Maddocks + . 2003-09-21 Werner Lemberg diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h index bf17497f4..e0ee7cc10 100644 --- a/include/freetype/internal/ftserv.h +++ b/include/freetype/internal/ftserv.h @@ -40,18 +40,18 @@ FT_BEGIN_HEADER * FT_FACE_FIND_SERVICE * * @description: - * This macro is used to lookup a service from a face's driver module. + * This macro is used to look up a service from a face's driver module. * * @input: + * face :: + * The source face handle. + * * id :: * A string describing the service as defined in the service's * header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to * `multi-masters'). It is automatically prefixed with * `FT_SERVICE_ID_'. * - * face :: - * The source face handle. - * * @output: * ptr :: * A variable that receives the service pointer. Will be NULL @@ -60,23 +60,49 @@ FT_BEGIN_HEADER #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 ); \ + /* + * @macro: + * FT_FACE_FIND_GLOBAL_SERVICE + * + * @description: + * This macro is used to look up a service from all modules. + * + * @input: + * face :: + * The source face handle. + * + * id :: + * A string describing the service as defined in the service's + * header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to + * `multi-masters'). It is automatically prefixed with + * `FT_SERVICE_ID_'. + * + * @output: + * ptr :: + * A variable that receives the service pointer. Will be NULL + * if not found. + */ +#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \ + FT_BEGIN_STMNT \ + FT_Module module = FT_MODULE( FT_FACE(face)->driver ); \ + /* the strange cast is to allow C++ compilation */ \ + FT_Pointer* Pptr = (FT_Pointer*) &(ptr); \ + \ + \ + *Pptr = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \ FT_END_STMNT + /*************************************************************************/ /*************************************************************************/ /***** *****/ diff --git a/include/freetype/internal/services/svpsname.h b/include/freetype/internal/services/svpsname.h index 5a56179cb..279afdac1 100644 --- a/include/freetype/internal/services/svpsname.h +++ b/include/freetype/internal/services/svpsname.h @@ -1,36 +1,61 @@ +/***************************************************************************/ +/* */ +/* svpsname.h */ +/* */ +/* The FreeType glyph PS name services (specification). */ +/* */ +/* Copyright 2003 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 __SVPSNAME_H__ #define __SVPSNAME_H__ + FT_BEGIN_HEADER -#define FT_SERVICE_ID_POSTSCRIPT_NAMES "postscript-names" - /* Adobe glyph name to unicode value - */ +#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 - */ + /* + * 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 - */ + /* + * 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 - */ + /* + * 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 - */ + /* + * Simple unicode -> glyph index charmap built from font glyph names + * table. + */ typedef struct PS_UniMap_ { FT_UInt unicode; @@ -61,6 +86,7 @@ FT_BEGIN_HEADER (*PS_Unicodes_CharNextFunc)( PS_Unicodes* unicodes, FT_ULong unicode ); + FT_DEFINE_SERVICE( PsNames ) { PS_Unicode_ValueFunc unicode_value; @@ -77,6 +103,8 @@ FT_BEGIN_HEADER /* */ + FT_END_HEADER + #endif /* __SVPSNAME_H__ */ diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h index 851baa8be..c688067af 100644 --- a/include/freetype/internal/t1types.h +++ b/include/freetype/internal/t1types.h @@ -23,8 +23,8 @@ #include #include FT_TYPE1_TABLES_H -#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_POSTSCRIPT_HINTS_H +#include FT_INTERNAL_SERVICE_H #include FT_SERVICE_POSTSCRIPT_NAMES_H diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index 7e9db90d2..4b71b95e7 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1375,7 +1375,9 @@ FT_BEGIN_HEADER /* It must be called after the header was */ /* read, and before the `forget'. */ /* */ - /* sfnt :: A pointer to the SFNT `driver' interface. */ + /* sfnt :: A pointer to the SFNT service. */ + /* */ + /* psnames :: A pointer to the PostScript names service. */ /* */ /* hdmx :: The face's horizontal device metrics */ /* (`hdmx' table). This table is optional in */ @@ -1494,14 +1496,15 @@ FT_BEGIN_HEADER TT_Loader_ReadGlyphFunc read_simple_glyph; TT_Loader_ReadGlyphFunc read_composite_glyph; - /* a typeless pointer to the SFNT_Interface table used to load */ - /* the basic TrueType tables in the face object */ + /* a typeless pointer to the SFNT_Interface table used to load */ + /* the basic TrueType tables in the face object */ void* sfnt; - /* a typeless pointer to the FT_Service_PsNamesRec table used to */ - /* handle glyph names <-> unicode & Mac values */ + /* a typeless pointer to the FT_Service_PsNamesRec table used to */ + /* handle glyph names <-> unicode & Mac values */ void* psnames; + /***********************************************************************/ /* */ /* Optional TrueType/OpenType tables */ diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c index 258b6d19e..f558bee85 100644 --- a/src/psnames/psmodule.c +++ b/src/psnames/psmodule.c @@ -339,10 +339,10 @@ { #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST - (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, + (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 @@ -353,8 +353,8 @@ #endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */ - (PS_Macintosh_Name_Func) ps_get_macintosh_name, - (PS_Adobe_Std_Strings_Func) ps_get_standard_strings, + (PS_Macintosh_Name_Func) ps_get_macintosh_name, + (PS_Adobe_Std_Strings_Func)ps_get_standard_strings, t1_standard_encoding, t1_expert_encoding @@ -363,10 +363,11 @@ static const FT_ServiceDescRec psnames_services[] = { - { FT_SERVICE_ID_POSTSCRIPT_NAMES, & psnames_interface }, + { FT_SERVICE_ID_POSTSCRIPT_NAMES, &psnames_interface }, { NULL, NULL } }; + static FT_Pointer psnames_get_service( FT_Module module, const char* service_id ) diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index e3a5c5113..30da6d3b3 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -23,7 +23,6 @@ #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H #include FT_INTERNAL_SFNT_H -#include FT_SERVICE_POSTSCRIPT_NAMES_H #include "ttgload.h" #include "ttpload.h"