[sfnt] Add `get_glyph_name' and `get_name_index' to SFNT interface.
CFF2 fonts will need access to those two functions. * include/freetype/internal/sfnt.h: Include FT_SERVICE_GLYPH_DICT_H. (SFNT_Interface): Add `get_glyph_name' and `get_name_index' members. (FT_DEFINE_SFNT_INTERFACE): Updated. * src/sfnt/sfdriver.c (sfnt_get_glyph_name, sfnt_get_name_index): Fix signatures to exactly correspond to the glyph dict service function typedefs. (sfnt_interface): Updated.
This commit is contained in:
parent
ffd8f62236
commit
29aa957767
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2016-12-08 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
|
[sfnt] Add `get_glyph_name' and `get_name_index' to SFNT interface.
|
||||||
|
|
||||||
|
CFF2 fonts will need access to those two functions.
|
||||||
|
|
||||||
|
* include/freetype/internal/sfnt.h: Include FT_SERVICE_GLYPH_DICT_H.
|
||||||
|
(SFNT_Interface): Add `get_glyph_name' and `get_name_index' members.
|
||||||
|
(FT_DEFINE_SFNT_INTERFACE): Updated.
|
||||||
|
|
||||||
|
* src/sfnt/sfdriver.c (sfnt_get_glyph_name, sfnt_get_name_index):
|
||||||
|
Fix signatures to exactly correspond to the glyph dict service
|
||||||
|
function typedefs.
|
||||||
|
(sfnt_interface): Updated.
|
||||||
|
|
||||||
2016-12-06 Dave Arnold <darnold@adobe.com>
|
2016-12-06 Dave Arnold <darnold@adobe.com>
|
||||||
|
|
||||||
Add `FT_Get_Var_Design_Coordinates' function.
|
Add `FT_Get_Var_Design_Coordinates' function.
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include FT_INTERNAL_DRIVER_H
|
#include FT_INTERNAL_DRIVER_H
|
||||||
#include FT_INTERNAL_TRUETYPE_TYPES_H
|
#include FT_INTERNAL_TRUETYPE_TYPES_H
|
||||||
|
|
||||||
|
#include FT_SERVICE_GLYPH_DICT_H
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
||||||
|
|
||||||
|
@ -589,6 +591,11 @@ FT_BEGIN_HEADER
|
||||||
|
|
||||||
TT_Get_Name_Func get_name;
|
TT_Get_Name_Func get_name;
|
||||||
|
|
||||||
|
/* since 2.7.1; */
|
||||||
|
/* this is the SFNT specific part of the glyph dict service */
|
||||||
|
FT_GlyphDict_GetNameFunc get_glyph_name;
|
||||||
|
FT_GlyphDict_NameIndexFunc get_name_index;
|
||||||
|
|
||||||
} SFNT_Interface;
|
} SFNT_Interface;
|
||||||
|
|
||||||
|
|
||||||
|
@ -628,7 +635,9 @@ FT_BEGIN_HEADER
|
||||||
set_sbit_strike_, \
|
set_sbit_strike_, \
|
||||||
load_strike_metrics_, \
|
load_strike_metrics_, \
|
||||||
get_metrics_, \
|
get_metrics_, \
|
||||||
get_name_ ) \
|
get_name_, \
|
||||||
|
get_glyph_name_, \
|
||||||
|
get_name_index_ ) \
|
||||||
static const SFNT_Interface class_ = \
|
static const SFNT_Interface class_ = \
|
||||||
{ \
|
{ \
|
||||||
goto_table_, \
|
goto_table_, \
|
||||||
|
@ -661,6 +670,8 @@ FT_BEGIN_HEADER
|
||||||
load_strike_metrics_, \
|
load_strike_metrics_, \
|
||||||
get_metrics_, \
|
get_metrics_, \
|
||||||
get_name_, \
|
get_name_, \
|
||||||
|
get_glyph_name_, \
|
||||||
|
get_name_index_ \
|
||||||
};
|
};
|
||||||
|
|
||||||
#else /* FT_CONFIG_OPTION_PIC */
|
#else /* FT_CONFIG_OPTION_PIC */
|
||||||
|
@ -699,7 +710,9 @@ FT_BEGIN_HEADER
|
||||||
set_sbit_strike_, \
|
set_sbit_strike_, \
|
||||||
load_strike_metrics_, \
|
load_strike_metrics_, \
|
||||||
get_metrics_, \
|
get_metrics_, \
|
||||||
get_name_ ) \
|
get_name_, \
|
||||||
|
get_glyph_name_, \
|
||||||
|
get_name_index_ ) \
|
||||||
void \
|
void \
|
||||||
FT_Init_Class_ ## class_( FT_Library library, \
|
FT_Init_Class_ ## class_( FT_Library library, \
|
||||||
SFNT_Interface* clazz ) \
|
SFNT_Interface* clazz ) \
|
||||||
|
@ -736,6 +749,8 @@ FT_BEGIN_HEADER
|
||||||
clazz->load_strike_metrics = load_strike_metrics_; \
|
clazz->load_strike_metrics = load_strike_metrics_; \
|
||||||
clazz->get_metrics = get_metrics_; \
|
clazz->get_metrics = get_metrics_; \
|
||||||
clazz->get_name = get_name_; \
|
clazz->get_name = get_name_; \
|
||||||
|
clazz->get_glyph_name = get_glyph_name; \
|
||||||
|
clazz->get_name_index = get_name_index_; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FT_CONFIG_OPTION_PIC */
|
#endif /* FT_CONFIG_OPTION_PIC */
|
||||||
|
|
|
@ -154,7 +154,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
sfnt_get_glyph_name( TT_Face face,
|
sfnt_get_glyph_name( FT_Face face,
|
||||||
FT_UInt glyph_index,
|
FT_UInt glyph_index,
|
||||||
FT_Pointer buffer,
|
FT_Pointer buffer,
|
||||||
FT_UInt buffer_max )
|
FT_UInt buffer_max )
|
||||||
|
@ -163,7 +163,7 @@
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
|
|
||||||
|
|
||||||
error = tt_face_get_ps_name( face, glyph_index, &gname );
|
error = tt_face_get_ps_name( (TT_Face)face, glyph_index, &gname );
|
||||||
if ( !error )
|
if ( !error )
|
||||||
FT_STRCPYN( buffer, gname, buffer_max );
|
FT_STRCPYN( buffer, gname, buffer_max );
|
||||||
|
|
||||||
|
@ -172,26 +172,26 @@
|
||||||
|
|
||||||
|
|
||||||
static FT_UInt
|
static FT_UInt
|
||||||
sfnt_get_name_index( TT_Face face,
|
sfnt_get_name_index( FT_Face face,
|
||||||
FT_String* glyph_name )
|
FT_String* glyph_name )
|
||||||
{
|
{
|
||||||
FT_Face root = &face->root;
|
TT_Face ttface = (TT_Face)face;
|
||||||
|
|
||||||
FT_UInt i, max_gid = FT_UINT_MAX;
|
FT_UInt i, max_gid = FT_UINT_MAX;
|
||||||
|
|
||||||
|
|
||||||
if ( root->num_glyphs < 0 )
|
if ( face->num_glyphs < 0 )
|
||||||
return 0;
|
return 0;
|
||||||
else if ( (FT_ULong)root->num_glyphs < FT_UINT_MAX )
|
else if ( (FT_ULong)face->num_glyphs < FT_UINT_MAX )
|
||||||
max_gid = (FT_UInt)root->num_glyphs;
|
max_gid = (FT_UInt)face->num_glyphs;
|
||||||
else
|
else
|
||||||
FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08x\n",
|
FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08x\n",
|
||||||
FT_UINT_MAX, root->num_glyphs ));
|
FT_UINT_MAX, face->num_glyphs ));
|
||||||
|
|
||||||
for ( i = 0; i < max_gid; i++ )
|
for ( i = 0; i < max_gid; i++ )
|
||||||
{
|
{
|
||||||
FT_String* gname;
|
FT_String* gname;
|
||||||
FT_Error error = tt_face_get_ps_name( face, i, &gname );
|
FT_Error error = tt_face_get_ps_name( ttface, i, &gname );
|
||||||
|
|
||||||
|
|
||||||
if ( error )
|
if ( error )
|
||||||
|
@ -528,7 +528,12 @@
|
||||||
|
|
||||||
tt_face_get_metrics, /* TT_Get_Metrics_Func get_metrics */
|
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 */
|
||||||
|
|
||||||
|
PUT_PS_NAMES( sfnt_get_glyph_name ),
|
||||||
|
/* FT_GlyphDict_GetNameFunc get_glyph_name */
|
||||||
|
PUT_PS_NAMES( sfnt_get_name_index )
|
||||||
|
/* FT_GlyphDict_NameIndexFunc get_name_index */
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue