diff --git a/ChangeLog b/ChangeLog index 59986bddb..3079fed7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2007-07-16 Werner Lemberg + + * docs/CHANGES: Updated. + +2007-07-16 Derek Clegg + + Add new service for getting the ROS from a CID font. + + * include/freetype/config/ftheader.h (FT_CID_H): New macro. + * include/freetype/ftcid.h: New file. + + * include/freetype/internal/ftserv.h (FT_SERVIVE_CID_H): New macro. + * include/freetype/internal/services/svcid.h: New file. + + * src/base/ftcid.c: New file. + + * src/cff/cffdrivr.c: Include FT_SERVICE_CID_H. + (cff_get_ros): New function. + (cff_service_cid_info): New service structure. + (cff_services): Register it. + + * src/cff/cffload.c (cff_font_done): Free registry and ordering. + + * src/cff/cfftypes.h (CFF_FontRec): Add `registry' and `ordering'. + + * modules.cfg (BASE_EXTENSIONS): Add ftcid.c. + 2007-07-11 Derek Clegg Add support for postscript name service to CFF driver. diff --git a/docs/CHANGES b/docs/CHANGES index 79fd77861..1c42b8657 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -1,4 +1,16 @@ +CHANGES BETWEEN 2.3.6 and 2.3.5 + + II. IMPORTANT CHANGES + + - The new function `FT_Get_CID_Registry_Ordering_Supplement' gives + access to those fields in a CID-keyed font. The code has been + contributed by Derek Clegg. + + +====================================================================== + + CHANGES BETWEEN 2.3.5 and 2.3.4 I. IMPORTANT BUG FIXES diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h index b957d05be..31aa3d55e 100644 --- a/include/freetype/config/ftheader.h +++ b/include/freetype/config/ftheader.h @@ -383,6 +383,20 @@ #define FT_BDF_H + /************************************************************************* + * + * @macro: + * FT_CID_H + * + * @description: + * A macro used in #include statements to name the file containing the + * definitions of an API which access CID font information from a + * face. + * + */ +#define FT_CID_H + + /************************************************************************* * * @macro: diff --git a/include/freetype/ftchapters.h b/include/freetype/ftchapters.h index bd812c8e6..9f1eb3f69 100644 --- a/include/freetype/ftchapters.h +++ b/include/freetype/ftchapters.h @@ -54,6 +54,7 @@ /* type1_tables */ /* sfnt_names */ /* bdf_fonts */ +/* cid_fonts */ /* pfr_fonts */ /* winfnt_fonts */ /* font_formats */ diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h index 45d2fa918..2db3e8790 100644 --- a/include/freetype/internal/ftserv.h +++ b/include/freetype/internal/ftserv.h @@ -301,6 +301,7 @@ FT_BEGIN_HEADER */ #define FT_SERVICE_BDF_H +#define FT_SERVICE_CID_H #define FT_SERVICE_GLYPH_DICT_H #define FT_SERVICE_GX_VALIDATE_H #define FT_SERVICE_KERNING_H diff --git a/modules.cfg b/modules.cfg index 6d8a95eac..525866adb 100644 --- a/modules.cfg +++ b/modules.cfg @@ -152,6 +152,11 @@ BASE_EXTENSIONS += ftbbox.c # See include/freetype/ftbdf.h for the API. BASE_EXTENSIONS += ftbdf.c +# Access CID font information. +# +# See include/freetype/ftcid.h for the API. +BASE_EXTENSIONS += ftcid.c + # Utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp bitmaps into # 8bpp format, and for emboldening of bitmap glyphs. # diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 99740d1b7..d2f0a4d76 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -22,6 +22,7 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_IDS_H +#include FT_SERVICE_CID_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H #include FT_SERVICE_POSTSCRIPT_INFO_H #include FT_SERVICE_POSTSCRIPT_NAME_H @@ -420,6 +421,66 @@ }; + /* + * CID INFO SERVICE + * + */ + static FT_Error + cff_get_ros( CFF_Face face, + const char* *registry, + const char* *ordering, + FT_Int *supplement ) + { + FT_Error error = CFF_Err_Ok; + CFF_Font cff = (CFF_Font)face->extra.data; + + + if ( cff ) + { + CFF_FontRecDict dict = &cff->top_font.font_dict; + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames; + + + if ( dict->cid_registry == 0xFFFFU ) + { + error = CFF_Err_Invalid_Argument; + goto Fail; + } + + if ( registry ) + { + if ( cff->registry == NULL ) + cff->registry = cff_index_get_sid_string( &cff->string_index, + dict->cid_registry, + psnames ); + *registry = cff->registry; + } + + if ( ordering ) + { + if ( cff->ordering == NULL ) + cff->ordering = cff_index_get_sid_string( &cff->string_index, + dict->cid_ordering, + psnames ); + *ordering = cff->ordering; + } + + if ( supplement ) + *supplement = dict->cid_supplement; + + } + + Fail: + return error; + } + + + static const FT_Service_CIDRec cff_service_cid_info = + { + (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros + }; + + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -441,6 +502,7 @@ { FT_SERVICE_ID_GLYPH_DICT, &cff_service_glyph_dict }, #endif { FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info }, + { FT_SERVICE_ID_CID, &cff_service_cid_info }, { NULL, NULL } }; diff --git a/src/cff/cffload.c b/src/cff/cffload.c index dd2f1133d..242c06a39 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1590,6 +1590,9 @@ FT_FREE( font->font_info ); } + FT_FREE( font->registry ); + FT_FREE( font->ordering ); + FT_FREE( font->global_subrs ); FT_FREE( font->font_name ); } diff --git a/src/cff/cfftypes.h b/src/cff/cfftypes.h index 306e5aab6..b5e5115f1 100644 --- a/src/cff/cfftypes.h +++ b/src/cff/cfftypes.h @@ -259,6 +259,10 @@ FT_BEGIN_HEADER /* since version 2.3.0 */ PS_FontInfoRec* font_info; /* font info dictionary */ + /* since version 2.3.6 */ + FT_String* registry; + FT_String* ordering; + } CFF_FontRec, *CFF_Font;