aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSean Whitton2022-01-04 19:07:29 -0700
committerEli Zaretskii2022-01-12 16:42:27 +0200
commitf373b52ba91ff9b1e04578e6c42efd2414ddf1fa (patch)
tree47315937b1c244d2da9459b2cb05de1675ab01c6 /src
parent492bf1e06edb4324a643ccb15dd6062762145f17 (diff)
downloademacs-f373b52ba91ff9b1e04578e6c42efd2414ddf1fa.tar.gz
emacs-f373b52ba91ff9b1e04578e6c42efd2414ddf1fa.zip
Skip virtual FcPattern entries for variable weight fonts
* src/ftfont.c (ftfont_list): Pass FC_VARIABLE to FcObjectSetBuild. * src/ftfont.c (ftfont_pattern_entity): Skip meta/virtual FcPattern entries for variable weight fonts (Bug#52888).
Diffstat (limited to 'src')
-rw-r--r--src/ftfont.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ftfont.c b/src/ftfont.c
index 2bdcce306bc..5797300d231 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -189,6 +189,24 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
189 return Qnil; 189 return Qnil;
190 if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch) 190 if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch)
191 return Qnil; 191 return Qnil;
192#ifdef FC_VARIABLE
193 /* This is a virtual/meta FcPattern for a variable weight font, from
194 which it is possible to extract an FcRange value specifying the
195 minimum and maximum weights available in this file. We don't
196 need to know that information explicitly, so skip it. We will be
197 called with an FcPattern for each actually available, non-virtual
198 weight.
199
200 Fontconfig started generating virtual/meta patterns for variable
201 weight fonts in the same release that FC_VARIABLE was added, so
202 we conditionalize on that constant. This also ensures that
203 FcPatternGetRange is available. */
204 FcRange *range;
205 if (FcPatternGetRange (p, FC_WEIGHT, 0, &range) == FcResultMatch
206 && FcPatternGetBool (p, FC_VARIABLE, 0, &b) == FcResultMatch
207 && b == FcTrue)
208 return Qnil;
209#endif /* FC_VARIABLE */
192 210
193 file = (char *) str; 211 file = (char *) str;
194 key = Fcons (build_unibyte_string (file), make_fixnum (idx)); 212 key = Fcons (build_unibyte_string (file), make_fixnum (idx));
@@ -863,6 +881,9 @@ ftfont_list (struct frame *f, Lisp_Object spec)
863#if defined HAVE_XFT && defined FC_COLOR 881#if defined HAVE_XFT && defined FC_COLOR
864 FC_COLOR, 882 FC_COLOR,
865#endif 883#endif
884#ifdef FC_VARIABLE
885 FC_VARIABLE,
886#endif /* FC_VARIABLE */
866 NULL); 887 NULL);
867 if (! objset) 888 if (! objset)
868 goto err; 889 goto err;