Fixed 'missing glyph doesn't use fontconfig config substitutions' bug
XftFontMatch does display-specific font configuration (commit528241a
). Nice. Unfortunately, when we switched from FcFontMatch, we also stopped storing the post-Fc{Config,Default}Substitute FcPattern for future lookups. The result is that if a glyph isn't found in the primary font, secondary font lookups use the original FcPattern, not the configured one. If you have custom fontconfig rules (like me), this can be disappointing. I basically just copied the guts out of XftFontMatch[1] and saved the intermediate configured FcPattern. Could be related to the bug that inspired commit4242027
. [1]: https://cgit.freedesktop.org/xorg/lib/libXft/tree/src/xftfont.c
This commit is contained in:
parent
740ada1447
commit
fa9a459972
22
st.c
22
st.c
|
@ -3373,16 +3373,32 @@ xgeommasktogravity(int mask)
|
||||||
int
|
int
|
||||||
xloadfont(Font *f, FcPattern *pattern)
|
xloadfont(Font *f, FcPattern *pattern)
|
||||||
{
|
{
|
||||||
|
FcPattern *configured;
|
||||||
FcPattern *match;
|
FcPattern *match;
|
||||||
FcResult result;
|
FcResult result;
|
||||||
XGlyphInfo extents;
|
XGlyphInfo extents;
|
||||||
int wantattr, haveattr;
|
int wantattr, haveattr;
|
||||||
|
|
||||||
match = XftFontMatch(xw.dpy, xw.scr, pattern, &result);
|
/*
|
||||||
if (!match)
|
* Manually configure instead of calling XftMatchFont
|
||||||
|
* so that we can use the configured pattern for
|
||||||
|
* "missing glyph" lookups.
|
||||||
|
*/
|
||||||
|
configured = FcPatternDuplicate(pattern);
|
||||||
|
if (!configured)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
FcConfigSubstitute(NULL, configured, FcMatchPattern);
|
||||||
|
XftDefaultSubstitute(xw.dpy, xw.scr, configured);
|
||||||
|
|
||||||
|
match = FcFontMatch(NULL, configured, &result);
|
||||||
|
if (!match) {
|
||||||
|
FcPatternDestroy(configured);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(f->match = XftFontOpenPattern(xw.dpy, match))) {
|
if (!(f->match = XftFontOpenPattern(xw.dpy, match))) {
|
||||||
|
FcPatternDestroy(configured);
|
||||||
FcPatternDestroy(match);
|
FcPatternDestroy(match);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -3414,7 +3430,7 @@ xloadfont(Font *f, FcPattern *pattern)
|
||||||
strlen(ascii_printable), &extents);
|
strlen(ascii_printable), &extents);
|
||||||
|
|
||||||
f->set = NULL;
|
f->set = NULL;
|
||||||
f->pattern = FcPatternDuplicate(pattern);
|
f->pattern = configured;
|
||||||
|
|
||||||
f->ascent = f->match->ascent;
|
f->ascent = f->match->ascent;
|
||||||
f->descent = f->match->descent;
|
f->descent = f->match->descent;
|
||||||
|
|
Loading…
Reference in New Issue