diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2021-11-08 21:16:08 -0800 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2021-11-09 20:04:52 +0900 |
commit | 14c265a10a96008bcbcb9ad517232abbe9e2f7e7 (patch) | |
tree | c0fd4c696cb35574babe84cc44d2a9012c8911a0 | |
parent | ad70d785974992c569b30108923875e5b5e9dc5e (diff) | |
download | fontconfig-14c265a10a96008bcbcb9ad517232abbe9e2f7e7.tar.gz |
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
-rw-r--r-- | src/fcfreetype.c | 23 |
1 files changed, 19 insertions, 4 deletions
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; |