[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.
This commit is contained in:
Werner Lemberg 2017-03-05 19:06:41 +01:00
parent 99fb3c3ab8
commit 0c7fb43d05
3 changed files with 59 additions and 9 deletions

View File

@ -1,3 +1,16 @@
2017-03-04 Werner Lemberg <wl@gnu.org>
[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 <wl@gnu.org>
[truetype] Make `TT_Set_MM_Blend' set named instance index.

View File

@ -455,6 +455,37 @@ FT_BEGIN_HEADER
FT_String** name );
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Get_Name_ID_Func */
/* */
/* <Description> */
/* Search whether an ENGLISH version for a given name ID is in the */
/* `name' table. */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
/* */
/* nameid :: The name id of the name record to return. */
/* */
/* <Out> */
/* 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. */
/* */
/* <Return> */
/* 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 );
/*************************************************************************/
/* */
/* <FuncType> */
@ -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 */

View File

@ -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 */
)