From a6a169572204dd86f4ab462ef505d98fdfd82d76 Mon Sep 17 00:00:00 2001 From: msizanoen1 Date: Wed, 22 Feb 2023 21:53:17 +0700 Subject: [PATCH] Reload MM/VF metadata for each font face in font collection This ensures that the MM/VF metadata is the correct metadata for each font face instead of whatever happens to be in the first one in the collection. --- src/fcfreetype.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 8ae88bd..636ee4f 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -2350,12 +2350,26 @@ skip: cs = NULL; FT_Done_Face (face); face = NULL; +#ifdef HAVE_FT_DONE_MM_VAR + FT_Done_MM_Var (ftLibrary, mm_var); +#else + free (mm_var); +#endif + mm_var = NULL; face_num++; instance_num = set_instance_num; if (FT_New_Face (ftLibrary, (const char *) file, face_num, &face)) break; + + num_instances = face->style_flags >> 16; + if (num_instances && (!index_set || instance_num)) + { + FT_Get_MM_Var (face, &mm_var); + if (!mm_var) + num_instances = 0; + } } } while (!err && (!index_set || face_num == set_face_num) && face_num < num_faces);