diff --git a/ChangeLog b/ChangeLog index af5b3439a..491543642 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-03-04 Werner Lemberg + + [sfnt] Add `get_name_id' service. + + * include/freetype/internal/sfnt.h (TT_Get_Name_ID_Func): New + typedef. + (SFNT_Interface): Add `get_name_id' field. + (FT_DEFINE_SFNT_INTERFACE): Updated. + + * src/sfnt/sfdriver.c (search_name_id): Rename to... + (sfnt_get_name_id): ... this. + (sfnt_get_ps_name, sfnt_interface): Udpated. + 2017-03-04 Werner Lemberg [truetype] Make `TT_Set_MM_Blend' set named instance index. diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h index 348b5a943..b8667a003 100644 --- a/include/freetype/internal/sfnt.h +++ b/include/freetype/internal/sfnt.h @@ -455,6 +455,37 @@ FT_BEGIN_HEADER FT_String** name ); + /*************************************************************************/ + /* */ + /* */ + /* TT_Get_Name_ID_Func */ + /* */ + /* */ + /* Search whether an ENGLISH version for a given name ID is in the */ + /* `name' table. */ + /* */ + /* */ + /* face :: A handle to the source face object. */ + /* */ + /* nameid :: The name id of the name record to return. */ + /* */ + /* */ + /* win :: If non-negative, an index into the `name' table with */ + /* the corresponding (3,1) or (3,0) Windows entry. */ + /* */ + /* apple :: If non-negative, an index into the `name' table with */ + /* the corresponding (1,0) Apple entry. */ + /* */ + /* */ + /* 1 if there is either a win or apple entry (or both), 0 otheriwse. */ + /* */ + typedef FT_Bool + (*TT_Get_Name_ID_Func)( TT_Face face, + FT_UShort nameid, + FT_Int *win, + FT_Int *apple ); + + /*************************************************************************/ /* */ /* */ @@ -588,6 +619,7 @@ FT_BEGIN_HEADER TT_Get_Metrics_Func get_metrics; TT_Get_Name_Func get_name; + TT_Get_Name_ID_Func get_name_id; } SFNT_Interface; @@ -628,7 +660,8 @@ FT_BEGIN_HEADER set_sbit_strike_, \ load_strike_metrics_, \ get_metrics_, \ - get_name_ ) \ + get_name_, \ + get_name_id_ ) \ static const SFNT_Interface class_ = \ { \ goto_table_, \ @@ -661,6 +694,7 @@ FT_BEGIN_HEADER load_strike_metrics_, \ get_metrics_, \ get_name_, \ + get_name_id_ \ }; #else /* FT_CONFIG_OPTION_PIC */ @@ -699,7 +733,8 @@ FT_BEGIN_HEADER set_sbit_strike_, \ load_strike_metrics_, \ get_metrics_, \ - get_name_ ) \ + get_name_, \ + get_name_id_ ) \ void \ FT_Init_Class_ ## class_( FT_Library library, \ SFNT_Interface* clazz ) \ @@ -736,6 +771,7 @@ FT_BEGIN_HEADER clazz->load_strike_metrics = load_strike_metrics_; \ clazz->get_metrics = get_metrics_; \ clazz->get_name = get_name_; \ + clazz->get_name_id = get_name_id_; \ } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 274ef805d..f13266975 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -381,11 +381,11 @@ } - static int - search_name_id( TT_Face face, - FT_Int id, - FT_Int *win, - FT_Int *apple ) + static FT_Bool + sfnt_get_name_id( TT_Face face, + FT_UShort id, + FT_Int *win, + FT_Int *apple ) { FT_Int n; @@ -424,7 +424,7 @@ /* scan the name table to see whether we have a Postscript name here, */ /* either in Macintosh or Windows platform encodings */ - found = search_name_id( face, 6, &win, &apple ); + found = sfnt_get_name_id( face, 6, &win, &apple ); if ( found ) { @@ -646,7 +646,8 @@ tt_face_get_metrics, /* TT_Get_Metrics_Func get_metrics */ - tt_face_get_name /* TT_Get_Name_Func get_name */ + tt_face_get_name, /* TT_Get_Name_Func get_name */ + sfnt_get_name_id /* TT_Get_Name_ID_Func get_name_id */ )