From edacde60e3974371dbab156c2d2b06b3f000e4b2 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Sun, 24 Sep 2017 22:20:38 +0200 Subject: [PATCH] Add new service for inter-module calls. NOTE: Does not compile! This is to allow CFF functions moved to `psaux' to call functions declared in `src/cff/cffload.h'. * include/freetype/internal/services/svcfftl.h: New file, setting up a `CFFLoad' service. * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC10, FT_DEFINE_SERVICEDESCREC): New macros. (FT_SERVICE_CFF_TABLE_LOAD_H): New macro. * src/cff/cffdrivr.c, src/cff/cffpic.h: Register the new service. * src/cff/cfftypes.h (CFF_FontRec), src/psaux/cf2font.h (CF2_FontRec): Add service interface. * src/cff/cffobjs.c, src/psaux/cf2font.c, src/psaux/cf2ft.c, src/psaux/cf2intrp.c, src/psaux/cffdecode.c: Use the new service. --- ChangeLog | 24 +++++ include/freetype/internal/ftserv.h | 90 ++++++++++++++++++- include/freetype/internal/services/svcfftl.h | 94 ++++++++++++++++++++ src/cff/cffdrivr.c | 78 ++++++++++------ src/cff/cffobjs.c | 4 + src/cff/cffpic.h | 5 +- src/cff/cfftypes.h | 3 + src/psaux/cf2font.c | 17 ++-- src/psaux/cf2font.h | 5 +- src/psaux/cf2ft.c | 2 + src/psaux/cf2intrp.c | 19 ++-- src/psaux/cffdecode.c | 25 +++++- 12 files changed, 313 insertions(+), 53 deletions(-) create mode 100644 include/freetype/internal/services/svcfftl.h diff --git a/ChangeLog b/ChangeLog index 0114f4843..a92581018 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2017-09-24 Ewald Hew + + [psaux, cff] Add new service for inter-module calls. + + NOTE: Does not compile! + + This is to allow CFF functions moved to `psaux' to call functions + declared in `src/cff/cffload.h'. + + * include/freetype/internal/services/svcfftl.h: New file, setting up + a `CFFLoad' service. + + * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC10, + FT_DEFINE_SERVICEDESCREC): New macros. + (FT_SERVICE_CFF_TABLE_LOAD_H): New macro. + + * src/cff/cffdrivr.c, src/cff/cffpic.h: Register the new service. + + * src/cff/cfftypes.h (CFF_FontRec), src/psaux/cf2font.h + (CF2_FontRec): Add service interface. + + * src/cff/cffobjs.c, src/psaux/cf2font.c, src/psaux/cf2ft.c, + src/psaux/cf2intrp.c, src/psaux/cffdecode.c: Use the new service. + 2017-09-24 Ewald Hew [psaux, cff] Add callbacks for inter-module calls. diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h index 71ef9cac3..23f2878cc 100644 --- a/include/freetype/internal/ftserv.h +++ b/include/freetype/internal/ftserv.h @@ -330,6 +330,32 @@ FT_BEGIN_HEADER { NULL, NULL } \ }; +#define FT_DEFINE_SERVICEDESCREC10( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4, \ + serv_id_5, serv_data_5, \ + serv_id_6, serv_data_6, \ + serv_id_7, serv_data_7, \ + serv_id_8, serv_data_8, \ + serv_id_9, serv_data_9, \ + serv_id_10, serv_data_10) \ + static const FT_ServiceDescRec class_[] = \ + { \ + { serv_id_1, serv_data_1 }, \ + { serv_id_2, serv_data_2 }, \ + { serv_id_3, serv_data_3 }, \ + { serv_id_4, serv_data_4 }, \ + { serv_id_5, serv_data_5 }, \ + { serv_id_6, serv_data_6 }, \ + { serv_id_7, serv_data_7 }, \ + { serv_id_8, serv_data_8 }, \ + { serv_id_9, serv_data_9 }, \ + { serv_id_10, serv_data_10 }, \ + { NULL, NULL } \ + }; + #else /* FT_CONFIG_OPTION_PIC */ #define FT_DEFINE_SERVICEDESCREC1( class_, \ @@ -755,6 +781,68 @@ FT_BEGIN_HEADER return FT_Err_Ok; \ } +#define FT_DEFINE_SERVICEDESCREC10( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4, \ + serv_id_5, serv_data_5, \ + serv_id_6, serv_data_6, \ + serv_id_7, serv_data_7, \ + serv_id_8, serv_data_8, \ + serv_id_9, serv_data_9, \ + serv_id_10, serv_data_10 ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + \ + \ + if ( clazz ) \ + FT_FREE( clazz ); \ + } \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec** output_class) \ + { \ + FT_ServiceDescRec* clazz = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 11 ) ) \ + return error; \ + \ + clazz[0].serv_id = serv_id_1; \ + clazz[0].serv_data = serv_data_1; \ + clazz[1].serv_id = serv_id_2; \ + clazz[1].serv_data = serv_data_2; \ + clazz[2].serv_id = serv_id_3; \ + clazz[2].serv_data = serv_data_3; \ + clazz[3].serv_id = serv_id_4; \ + clazz[3].serv_data = serv_data_4; \ + clazz[4].serv_id = serv_id_5; \ + clazz[4].serv_data = serv_data_5; \ + clazz[5].serv_id = serv_id_6; \ + clazz[5].serv_data = serv_data_6; \ + clazz[6].serv_id = serv_id_7; \ + clazz[6].serv_data = serv_data_7; \ + clazz[7].serv_id = serv_id_8; \ + clazz[7].serv_data = serv_data_8; \ + clazz[8].serv_id = serv_id_9; \ + clazz[8].serv_data = serv_data_9; \ + clazz[9].serv_id = serv_id_10; \ + clazz[9].serv_data = serv_data_10; \ + clazz[10].serv_id = NULL; \ + clazz[10].serv_data = NULL; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ + } + #endif /* FT_CONFIG_OPTION_PIC */ @@ -916,7 +1004,7 @@ FT_BEGIN_HEADER #define FT_SERVICE_WINFNT_H #define FT_SERVICE_FONT_FORMAT_H #define FT_SERVICE_TRUETYPE_GLYF_H - +#define FT_SERVICE_CFF_TABLE_LOAD_H /* */ FT_END_HEADER diff --git a/include/freetype/internal/services/svcfftl.h b/include/freetype/internal/services/svcfftl.h new file mode 100644 index 000000000..18e2276a9 --- /dev/null +++ b/include/freetype/internal/services/svcfftl.h @@ -0,0 +1,94 @@ +#ifndef SVCFFTL_H_ +#define SVCFFTL_H_ + +#include FT_INTERNAL_SERVICE_H + + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_CFF_LOAD "cff-load" + + + typedef FT_UShort + (*FT_Get_Standard_Encoding_Func)( FT_UInt charcode ); + + typedef FT_Error + (*FT_Load_Private_Dict_Func)( CFF_Font font, + CFF_SubFont subfont, + FT_UInt lenNDV, + FT_Fixed* NDV ); + + typedef FT_Byte + (*FT_FD_Select_Get_Func)( CFF_FDSelect fdselect, + FT_UInt glyph_index ); + + typedef FT_Bool + (*FT_Blend_Check_Vector_Func)( CFF_Blend blend, + FT_UInt vsindex, + FT_UInt lenNDV, + FT_Fixed* NDV ); + + typedef FT_Error + (*FT_Blend_Build_Vector_Func)( CFF_Blend blend, + FT_UInt vsindex, + FT_UInt lenNDV, + FT_Fixed* NDV ); + + + FT_DEFINE_SERVICE( CFFLoad ) + { + FT_Get_Standard_Encoding_Func get_standard_encoding; + FT_Load_Private_Dict_Func load_private_dict; + FT_FD_Select_Get_Func fd_select_get; + FT_Blend_Check_Vector_Func blend_check_vector; + FT_Blend_Build_Vector_Func blend_build_vector; + }; + + +#ifndef FT_CONFIG_OPTION_PIC + +#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \ + get_standard_encoding_, \ + load_private_dict_, \ + fd_select_get_, \ + blend_check_vector_, \ + blend_build_vector_ ) \ + static const FT_Service_CFFLoadRec class_ = \ + { \ + get_standard_encoding_, \ + load_private_dict_, \ + fd_select_get_, \ + blend_check_vector_, \ + blend_build_vector_ \ + }; + +#else /* FT_CONFIG_OPTION_PIC */ + +#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \ + get_standard_encoding_, \ + load_private_dict_, \ + fd_select_get_, \ + blend_check_vector_, \ + blend_build_vector_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Service_CFFLoadRec* clazz ) \ + { \ + clazz->get_standard_encoding = get_standard_encoding_; \ + clazz->load_private_dict = load_private_dict_; \ + clazz->fd_select_get = fd_select_get_; \ + clazz->blend_check_vector = blend_check_vector_; \ + clazz->blend_build_vector = blend_build_vector_; \ + } + +#endif /* FT_CONFIG_OPTION_PIC */ + + + + +FT_END_HEADER + +#endif + + +/* END */ diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 38bfc2ca3..689f22979 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -25,6 +25,7 @@ #include FT_SERVICE_POSTSCRIPT_INFO_H #include FT_SERVICE_POSTSCRIPT_NAME_H #include FT_SERVICE_TT_CMAP_H +#include FT_SERVICE_CFF_TABLE_LOAD_H #include "cffdrivr.h" #include "cffgload.h" @@ -1088,6 +1089,21 @@ #endif + /* + * CFFLOAD SERVICE + * + */ + + FT_DEFINE_SERVICE_CFFLOADREC( + cff_service_cff_load, + + (FT_Get_Standard_Encoding_Func) cff_get_standard_encoding, + (FT_Load_Private_Dict_Func) cff_load_private_dict, + (FT_FD_Select_Get_Func) cff_fd_select_get, + (FT_Blend_Check_Vector_Func) cff_blend_check_vector, + (FT_Blend_Build_Vector_Func) cff_blend_build_vector + ) + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -1102,6 +1118,34 @@ #if !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES && \ defined TT_CONFIG_OPTION_GX_VAR_SUPPORT + FT_DEFINE_SERVICEDESCREC10( + cff_services, + + FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, + FT_SERVICE_ID_MULTI_MASTERS, &CFF_SERVICE_MULTI_MASTERS_GET, + FT_SERVICE_ID_METRICS_VARIATIONS, &CFF_SERVICE_METRICS_VAR_GET, + FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, + FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, + FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, + FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET + ) +#elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES + FT_DEFINE_SERVICEDESCREC8( + cff_services, + + FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, + FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, + FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, + FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, + FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET + ) +#elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_DEFINE_SERVICEDESCREC9( cff_services, @@ -1110,46 +1154,22 @@ FT_SERVICE_ID_METRICS_VARIATIONS, &CFF_SERVICE_METRICS_VAR_GET, FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET ) -#elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES +#else FT_DEFINE_SERVICEDESCREC7( cff_services, FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET - ) -#elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_DEFINE_SERVICEDESCREC8( - cff_services, - - FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, - FT_SERVICE_ID_MULTI_MASTERS, &CFF_SERVICE_MULTI_MASTERS_GET, - FT_SERVICE_ID_METRICS_VARIATIONS, &CFF_SERVICE_METRICS_VAR_GET, - FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, - FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET - ) -#else - FT_DEFINE_SERVICEDESCREC6( - cff_services, - - FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, - FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, - FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, - FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET, + FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET ) #endif diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index b0d275c73..ed154664f 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -496,6 +496,7 @@ FT_Service_PsCMaps psnames; PSHinter_Service pshinter; PSAux_Service psaux; + FT_Service_CFFLoad cffload; FT_Bool pure_cff = 1; FT_Bool cff2 = 0; FT_Bool sfnt_format = 0; @@ -526,6 +527,8 @@ } face->psaux = psaux; + FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD ); + FT_TRACE2(( "CFF driver\n" )); /* create input stream from resource */ @@ -627,6 +630,7 @@ cff->pshinter = pshinter; cff->psnames = psnames; + cff->cffload = cffload; cffface->face_index = face_index & 0xFFFF; diff --git a/src/cff/cffpic.h b/src/cff/cffpic.h index 5db39cd62..a7e01973e 100644 --- a/src/cff/cffpic.h +++ b/src/cff/cffpic.h @@ -22,7 +22,6 @@ #include FT_INTERNAL_PIC_H - #ifndef FT_CONFIG_OPTION_PIC #define CFF_SERVICE_PS_INFO_GET cff_service_ps_info @@ -34,6 +33,7 @@ #define CFF_SERVICES_GET cff_services #define CFF_SERVICE_MULTI_MASTERS_GET cff_service_multi_masters #define CFF_SERVICE_METRICS_VAR_GET cff_service_metrics_variations +#define CFF_SERVICE_CFF_LOAD_GET cff_service_cff_load #define CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec #define CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec #define CFF_FIELD_HANDLERS_GET cff_field_handlers @@ -65,6 +65,7 @@ FT_BEGIN_HEADER FT_Service_PropertiesRec cff_service_properties; FT_Service_MultiMastersRec cff_service_multi_masters; FT_Service_MetricsVariationsRec cff_service_metrics_variations; + FT_Service_CFFLoadRec cff_service_cff_load; FT_CMap_ClassRec cff_cmap_encoding_class_rec; FT_CMap_ClassRec cff_cmap_unicode_class_rec; @@ -92,6 +93,8 @@ FT_BEGIN_HEADER ( GET_PIC( library )->cff_service_multi_masters ) #define CFF_SERVICE_METRICS_VAR_GET \ ( GET_PIC( library )->cff_service_metrics_variations ) +#define CFF_SERVICE_CFF_LOAD_GET \ + ( GET_PIC( library )->cff_service_cff_load ) #define CFF_CMAP_ENCODING_CLASS_REC_GET \ ( GET_PIC( library )->cff_cmap_encoding_class_rec ) #define CFF_CMAP_UNICODE_CLASS_REC_GET \ diff --git a/src/cff/cfftypes.h b/src/cff/cfftypes.h index 74f569f08..d6de1f33c 100644 --- a/src/cff/cfftypes.h +++ b/src/cff/cfftypes.h @@ -381,6 +381,9 @@ FT_BEGIN_HEADER /* interface to Postscript Names service */ FT_Service_PsCMaps psnames; + /* interface to CFFLoad service */ + const void* cffload; + /* since version 2.3.0 */ PS_FontInfoRec* font_info; /* font info dictionary */ diff --git a/src/psaux/cf2font.c b/src/psaux/cf2font.c index 4ac71a8d7..8d0dfc601 100644 --- a/src/psaux/cf2font.c +++ b/src/psaux/cf2font.c @@ -260,6 +260,7 @@ CF2_UInt lenNormalizedV = 0; FT_Fixed* normalizedV = NULL; + FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)font->cffload; /* clear previous error */ font->error = FT_Err_Ok; @@ -287,16 +288,16 @@ if ( font->error ) return; - if ( cff_blend_check_vector( &subFont->blend, - subFont->private_dict.vsindex, - lenNormalizedV, - normalizedV ) ) + if ( cffload->blend_check_vector( &subFont->blend, + subFont->private_dict.vsindex, + lenNormalizedV, + normalizedV ) ) { /* blend has changed, reparse */ - cff_load_private_dict( decoder->cff, - subFont, - lenNormalizedV, - normalizedV ); + cffload->load_private_dict( decoder->cff, + subFont, + lenNormalizedV, + normalizedV ); needExtraSetup = TRUE; } #endif diff --git a/src/psaux/cf2font.h b/src/psaux/cf2font.h index 17ecd17bb..94a31ca72 100644 --- a/src/psaux/cf2font.h +++ b/src/psaux/cf2font.h @@ -40,9 +40,10 @@ #define CF2FONT_H_ +#include FT_SERVICE_CFF_TABLE_LOAD_H + #include "cf2ft.h" #include "cf2blues.h" -#include "cffload.h" FT_BEGIN_HEADER @@ -111,6 +112,8 @@ FT_BEGIN_HEADER /* counterclockwise winding */ CF2_BluesRec blues; /* computed zone data */ + + FT_Service_CFFLoad cffload; /* Pointer to cff functions */ }; diff --git a/src/psaux/cf2ft.c b/src/psaux/cf2ft.c index 169e1160b..ee8133c58 100644 --- a/src/psaux/cf2ft.c +++ b/src/psaux/cf2ft.c @@ -42,6 +42,7 @@ #include "cf2font.h" #include "cf2error.h" +#include FT_SERVICE_CFF_TABLE_LOAD_H #define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */ @@ -324,6 +325,7 @@ font = (CF2_Font)decoder->cff->cf2_instance.data; font->memory = memory; + font->cffload = (FT_Service_CFFLoad)decoder->cff->cffload; /* initialize a client outline, to be shared by each glyph rendered */ cf2_outline_init( &font->outline, font->memory, &font->error ); diff --git a/src/psaux/cf2intrp.c b/src/psaux/cf2intrp.c index a81628074..3e7ad5763 100644 --- a/src/psaux/cf2intrp.c +++ b/src/psaux/cf2intrp.c @@ -38,6 +38,7 @@ #include "cf2ft.h" #include FT_INTERNAL_DEBUG_H +#include FT_SERVICE_CFF_TABLE_LOAD_H #include "cf2glue.h" #include "cf2font.h" @@ -47,8 +48,6 @@ #include "cf2error.h" -#include "cffload.h" - /*************************************************************************/ /* */ @@ -689,15 +688,15 @@ } /* check cached blend vector */ - if ( cff_blend_check_vector( &font->blend, - font->vsindex, - font->lenNDV, - font->NDV ) ) + if ( font->cffload->blend_check_vector( &font->blend, + font->vsindex, + font->lenNDV, + font->NDV ) ) { - lastError = cff_blend_build_vector( &font->blend, - font->vsindex, - font->lenNDV, - font->NDV ); + lastError = font->cffload->blend_build_vector( &font->blend, + font->vsindex, + font->lenNDV, + font->NDV ); if ( lastError ) goto exit; } diff --git a/src/psaux/cffdecode.c b/src/psaux/cffdecode.c index baa318bbe..dceb91652 100644 --- a/src/psaux/cffdecode.c +++ b/src/psaux/cffdecode.c @@ -1,6 +1,8 @@ #include +#include FT_INTERNAL_SERVICE_H +#include FT_SERVICE_CFF_TABLE_LOAD_H #include "cffdecode.h" #include "psobjs.h" @@ -390,7 +392,7 @@ { FT_UInt n; FT_UShort glyph_sid; - + FT_Service_CFFLoad cffload; /* CID-keyed fonts don't have glyph names */ if ( !cff->charset.sids ) @@ -400,8 +402,24 @@ if ( charcode < 0 || charcode > 255 ) return -1; +#if 0 + /* retrieve cffload from list of current modules */ + FT_Service_CFFLoad cffload; + { + FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD ); + if ( !cffload ) + { + FT_ERROR(( "cff_lookup_glyph_by_stdcharcode:" + " the `cffload' module is not available\n" )); + return FT_THROW( Unimplemented_Feature ); + } + } +#endif + + cffload = (FT_Service_CFFLoad)cff->cffload; + /* Get code to SID mapping from `cff_standard_encoding'. */ - glyph_sid = cff_get_standard_encoding( (FT_UInt)charcode ); + glyph_sid = cffload->get_standard_encoding( (FT_UInt)charcode ); for ( n = 0; n < cff->num_glyphs; n++ ) { @@ -2271,11 +2289,12 @@ CFF_SubFont sub = &cff->top_font; FT_Error error = FT_Err_Ok; + FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)cff->cffload; /* manage CID fonts */ if ( cff->num_subfonts ) { - FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index ); + FT_Byte fd_index = cffload->fd_select_get( &cff->fd_select, glyph_index ); if ( fd_index >= cff->num_subfonts )