[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
diff --git a/ChangeLog b/ChangeLog
index 70268d2..012fabd 100644
--- a/ChangeLog
+++ b/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>
Add `FT_Get_Var_Design_Coordinates' function.
diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h
index e139315..57d4ef0 100644
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -24,6 +24,8 @@
#include FT_INTERNAL_DRIVER_H
#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include FT_SERVICE_GLYPH_DICT_H
+
FT_BEGIN_HEADER
@@ -589,6 +591,11 @@ FT_BEGIN_HEADER
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;
@@ -628,7 +635,9 @@ FT_BEGIN_HEADER
set_sbit_strike_, \
load_strike_metrics_, \
get_metrics_, \
- get_name_ ) \
+ get_name_, \
+ get_glyph_name_, \
+ get_name_index_ ) \
static const SFNT_Interface class_ = \
{ \
goto_table_, \
@@ -661,6 +670,8 @@ FT_BEGIN_HEADER
load_strike_metrics_, \
get_metrics_, \
get_name_, \
+ get_glyph_name_, \
+ get_name_index_ \
};
#else /* FT_CONFIG_OPTION_PIC */
@@ -699,7 +710,9 @@ FT_BEGIN_HEADER
set_sbit_strike_, \
load_strike_metrics_, \
get_metrics_, \
- get_name_ ) \
+ get_name_, \
+ get_glyph_name_, \
+ get_name_index_ ) \
void \
FT_Init_Class_ ## class_( FT_Library library, \
SFNT_Interface* clazz ) \
@@ -736,6 +749,8 @@ FT_BEGIN_HEADER
clazz->load_strike_metrics = load_strike_metrics_; \
clazz->get_metrics = get_metrics_; \
clazz->get_name = get_name_; \
+ clazz->get_glyph_name = get_glyph_name; \
+ clazz->get_name_index = get_name_index_; \
}
#endif /* FT_CONFIG_OPTION_PIC */
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index b838d77..9cf6973 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -154,7 +154,7 @@
*/
static FT_Error
- sfnt_get_glyph_name( TT_Face face,
+ sfnt_get_glyph_name( FT_Face face,
FT_UInt glyph_index,
FT_Pointer buffer,
FT_UInt buffer_max )
@@ -163,7 +163,7 @@
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 )
FT_STRCPYN( buffer, gname, buffer_max );
@@ -172,26 +172,26 @@
static FT_UInt
- sfnt_get_name_index( TT_Face face,
+ sfnt_get_name_index( FT_Face face,
FT_String* glyph_name )
{
- FT_Face root = &face->root;
+ TT_Face ttface = (TT_Face)face;
FT_UInt i, max_gid = FT_UINT_MAX;
- if ( root->num_glyphs < 0 )
+ if ( face->num_glyphs < 0 )
return 0;
- else if ( (FT_ULong)root->num_glyphs < FT_UINT_MAX )
- max_gid = (FT_UInt)root->num_glyphs;
+ else if ( (FT_ULong)face->num_glyphs < FT_UINT_MAX )
+ max_gid = (FT_UInt)face->num_glyphs;
else
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++ )
{
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 )
@@ -528,7 +528,12 @@
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 */
)