src/fcfreetype.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) New commits: commit 5841bd012df892ce9c48f45781fd9018a6952de5 Author: Akira TAGOH <akira@xxxxxxxxx> Date: Tue Nov 9 20:42:52 2021 +0900 Fix some testcase fails for 14c265a1 Add an extra code to ignore an error of FT_Get_MM_Var() only when FT_MM_Var variable isn't used in any case. diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 70819e0..c477774 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -1232,6 +1232,7 @@ FcFreeTypeQueryFaceInternal (const FT_Face face, int st; FcBool symbol = FcFalse; + FT_Error ftresult; FcInitDebug (); /* We might be called with no initizalization whatsoever. */ @@ -1257,11 +1258,13 @@ FcFreeTypeQueryFaceInternal (const FT_Face face, goto bail1; } - if (FT_Get_MM_Var (face, &master)) - goto bail1; + ftresult = FT_Get_MM_Var (face, &master); if (id >> 16) { + if (ftresult) + goto bail1; + if (id >> 16 == 0x8000) { /* Query variable font itself. */ @@ -1353,19 +1356,25 @@ FcFreeTypeQueryFaceInternal (const FT_Face face, } else { - unsigned int i; - for (i = 0; i < master->num_axis; i++) - { - switch (master->axis[i].tag) - { + if (!ftresult) + { + unsigned int i; + for (i = 0; i < master->num_axis; i++) + { + switch (master->axis[i].tag) + { case FT_MAKE_TAG ('o','p','s','z'): - if (!FcPatternObjectAddDouble (pat, FC_SIZE_OBJECT, master->axis[i].def / (double) (1U << 16))) - goto bail1; - variable_size = FcTrue; - break; - } - - } + if (!FcPatternObjectAddDouble (pat, FC_SIZE_OBJECT, master->axis[i].def / (double) (1U << 16))) + goto bail1; + variable_size = FcTrue; + break; + } + } + } + else + { + /* ignore an error of FT_Get_MM_Var() */ + } } if (!FcPatternObjectAddBool (pat, FC_VARIABLE_OBJECT, variable)) goto bail1; commit 14c265a10a96008bcbcb9ad517232abbe9e2f7e7 Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Nov 8 21:16:08 2021 -0800 If a varfont has 'opsz' axis, set FC_SIZE on default instant pattern Otherwise default-instance pattern would match as an "all sizes", which would be wrong. See: https://gitlab.gnome.org/GNOME/pango/-/issues/621#note_1305844 diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 0a5743f..70819e0 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -1257,16 +1257,15 @@ FcFreeTypeQueryFaceInternal (const FT_Face face, goto bail1; } + if (FT_Get_MM_Var (face, &master)) + goto bail1; + if (id >> 16) { - if (FT_Get_MM_Var (face, &master)) - goto bail1; - if (id >> 16 == 0x8000) { /* Query variable font itself. */ unsigned int i; - for (i = 0; i < master->num_axis; i++) { double min_value = master->axis[i].minimum / (double) (1U << 16); @@ -1352,6 +1351,22 @@ FcFreeTypeQueryFaceInternal (const FT_Face face, else goto bail1; } + else + { + unsigned int i; + for (i = 0; i < master->num_axis; i++) + { + switch (master->axis[i].tag) + { + case FT_MAKE_TAG ('o','p','s','z'): + if (!FcPatternObjectAddDouble (pat, FC_SIZE_OBJECT, master->axis[i].def / (double) (1U << 16))) + goto bail1; + variable_size = FcTrue; + break; + } + + } + } if (!FcPatternObjectAddBool (pat, FC_VARIABLE_OBJECT, variable)) goto bail1;