[truetype] Fix thinko related to PS name of default named instance. * src/truetype/ttgxvar.c (TT_Get_MM_Var): `strid' and `psid' are name ID values, not indices into the array of name entries.
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
diff --git a/ChangeLog b/ChangeLog
index a2afd15..9dc20c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-03-29 Werner Lemberg <wl@gnu.org>
+
+ [truetype] Fix thinko related to PS name of default named instance.
+
+ * src/truetype/ttgxvar.c (TT_Get_MM_Var): `strid' and `psid' are
+ name ID values, not indices into the array of name entries.
+
2017-03-27 Werner Lemberg <wl@gnu.org>
[cid, truetype] Don't use `index' as a variable name.
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 55b7b0d..a87913d 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -2171,42 +2171,43 @@
{
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
- FT_Int found, win, apple;
+ FT_Int found, dummy1, dummy2;
+ FT_UInt strid = 0xFFFFFFFFUL;
/* the default instance is missing in array the */
/* of named instances; try to synthesize an entry */
found = sfnt->get_name_id( face,
TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY,
- &win,
- &apple );
- if ( !found )
+ &dummy1,
+ &dummy2 );
+ if ( found )
+ strid = TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY;
+ else
+ {
found = sfnt->get_name_id( face,
TT_NAME_ID_FONT_SUBFAMILY,
- &win,
- &apple );
+ &dummy1,
+ &dummy2 );
+ if ( found )
+ strid = TT_NAME_ID_FONT_SUBFAMILY;
+ }
if ( found )
{
- FT_Int strid = win >= 0 ? win : apple;
-
-
found = sfnt->get_name_id( face,
TT_NAME_ID_PS_NAME,
- &win,
- &apple );
+ &dummy1,
+ &dummy2 );
if ( found )
{
- FT_Int psid = win >= 0 ? win : apple;
-
-
FT_TRACE5(( "TT_Get_MM_Var:"
" Adding default instance to named instances\n" ));
ns = &mmvar->namedstyle[fvar_head.instanceCount];
- ns->strid = (FT_UInt)strid;
- ns->psid = (FT_UInt)psid;
+ ns->strid = strid;
+ ns->psid = TT_NAME_ID_PS_NAME;
a = mmvar->axis;
c = ns->coords;