iFixed 'missing glyph doesn't use fontconfig config substitutions' bug - st - Simple Terminal Err gopher.r-36.net 70 i Err gopher.r-36.net 70 1Log /scm/st//log.gph gopher.r-36.net 70 1Files /scm/st//files.gph gopher.r-36.net 70 1Refs /scm/st//refs.gph gopher.r-36.net 70 1README /scm/st//file/README.gph gopher.r-36.net 70 1LICENSE /scm/st//file/LICENSE.gph gopher.r-36.net 70 i--- Err gopher.r-36.net 70 1commit fa9a4599720703932d1c4f16b9aeee1f91f96263 /scm/st//commit/fa9a4599720703932d1c4f16b9aeee1f91f96263.gph gopher.r-36.net 70 1parent 740ada1447a0bf9eb7db327d9433fa0b96e0a4d8 /scm/st//commit/740ada1447a0bf9eb7db327d9433fa0b96e0a4d8.gph gopher.r-36.net 70 hAuthor: Spencer Phippen URL:mailto:spencer.phippen@gmail.com gopher.r-36.net 70 iDate: Wed, 23 Nov 2016 19:17:59 +0100 Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iFixed 'missing glyph doesn't use fontconfig config substitutions' bug Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iXftFontMatch does display-specific font configuration (commit 528241a). Err gopher.r-36.net 70 iNice. Unfortunately, when we switched from FcFontMatch, we also stopped Err gopher.r-36.net 70 istoring the post-Fc{Config,Default}Substitute FcPattern for future Err gopher.r-36.net 70 ilookups. The result is that if a glyph isn't found in the primary font, Err gopher.r-36.net 70 isecondary font lookups use the original FcPattern, not the configured Err gopher.r-36.net 70 ione. If you have custom fontconfig rules (like me), this can be Err gopher.r-36.net 70 idisappointing. Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iI basically just copied the guts out of XftFontMatch[1] and saved Err gopher.r-36.net 70 ithe intermediate configured FcPattern. Could be related to the bug that Err gopher.r-36.net 70 iinspired commit 4242027. Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i[1]: https://cgit.freedesktop.org/xorg/lib/libXft/tree/src/xftfont.c Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iDiffstat: Err gopher.r-36.net 70 i st.c | 22 +++++++++++++++++++--- Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i1 file changed, 19 insertions(+), 3 deletions(-) Err gopher.r-36.net 70 i--- Err gopher.r-36.net 70 1diff --git a/st.c b/st.c /scm/st//file/st.c.gph gopher.r-36.net 70 i@@ -3373,16 +3373,32 @@ xgeommasktogravity(int mask) Err gopher.r-36.net 70 i int Err gopher.r-36.net 70 i xloadfont(Font *f, FcPattern *pattern) Err gopher.r-36.net 70 i { Err gopher.r-36.net 70 i+ FcPattern *configured; Err gopher.r-36.net 70 i FcPattern *match; Err gopher.r-36.net 70 i FcResult result; Err gopher.r-36.net 70 i XGlyphInfo extents; Err gopher.r-36.net 70 i int wantattr, haveattr; Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i- match = XftFontMatch(xw.dpy, xw.scr, pattern, &result); Err gopher.r-36.net 70 i- if (!match) Err gopher.r-36.net 70 i+ /* Err gopher.r-36.net 70 i+ * Manually configure instead of calling XftMatchFont Err gopher.r-36.net 70 i+ * so that we can use the configured pattern for Err gopher.r-36.net 70 i+ * "missing glyph" lookups. Err gopher.r-36.net 70 i+ */ Err gopher.r-36.net 70 i+ configured = FcPatternDuplicate(pattern); Err gopher.r-36.net 70 i+ if (!configured) Err gopher.r-36.net 70 i+ return 1; Err gopher.r-36.net 70 i+ Err gopher.r-36.net 70 i+ FcConfigSubstitute(NULL, configured, FcMatchPattern); Err gopher.r-36.net 70 i+ XftDefaultSubstitute(xw.dpy, xw.scr, configured); Err gopher.r-36.net 70 i+ Err gopher.r-36.net 70 i+ match = FcFontMatch(NULL, configured, &result); Err gopher.r-36.net 70 i+ if (!match) { Err gopher.r-36.net 70 i+ FcPatternDestroy(configured); Err gopher.r-36.net 70 i return 1; Err gopher.r-36.net 70 i+ } Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i if (!(f->match = XftFontOpenPattern(xw.dpy, match))) { Err gopher.r-36.net 70 i+ FcPatternDestroy(configured); Err gopher.r-36.net 70 i FcPatternDestroy(match); Err gopher.r-36.net 70 i return 1; Err gopher.r-36.net 70 i } Err gopher.r-36.net 70 i@@ -3414,7 +3430,7 @@ xloadfont(Font *f, FcPattern *pattern) Err gopher.r-36.net 70 i strlen(ascii_printable), &extents); Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i f->set = NULL; Err gopher.r-36.net 70 i- f->pattern = FcPatternDuplicate(pattern); Err gopher.r-36.net 70 i+ f->pattern = configured; Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i f->ascent = f->match->ascent; Err gopher.r-36.net 70 i f->descent = f->match->descent; Err gopher.r-36.net 70 .