From fa9a4599720703932d1c4f16b9aeee1f91f96263 Mon Sep 17 00:00:00 2001 From: Spencer Phippen Date: Wed, 23 Nov 2016 19:17:59 +0100 Subject: [PATCH 1/3] Fixed 'missing glyph doesn't use fontconfig config substitutions' bug XftFontMatch does display-specific font configuration (commit 528241a). 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 commit 4242027. [1]: https://cgit.freedesktop.org/xorg/lib/libXft/tree/src/xftfont.c --- st.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/st.c b/st.c index e50e884..031272f 100644 --- a/st.c +++ b/st.c @@ -3373,16 +3373,32 @@ xgeommasktogravity(int mask) int xloadfont(Font *f, FcPattern *pattern) { + FcPattern *configured; FcPattern *match; FcResult result; XGlyphInfo extents; 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; + 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))) { + FcPatternDestroy(configured); FcPatternDestroy(match); return 1; } @@ -3414,7 +3430,7 @@ xloadfont(Font *f, FcPattern *pattern) strlen(ascii_printable), &extents); f->set = NULL; - f->pattern = FcPatternDuplicate(pattern); + f->pattern = configured; f->ascent = f->match->ascent; f->descent = f->match->descent; From e44832408bb3147826c346872b49de105a4d0e0b Mon Sep 17 00:00:00 2001 From: "Roberto E. Vargas Caballero" Date: Thu, 24 Nov 2016 20:21:19 +0100 Subject: [PATCH 2/3] Revert "Initial font size issue." This reverts commit 424202798b02554092ba84dd59fb7b79b59b7b75. --- st.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/st.c b/st.c index 031272f..d6fe58a 100644 --- a/st.c +++ b/st.c @@ -3488,9 +3488,6 @@ xloadfonts(char *fontstr, double fontsize) if (usedfontsize < 0) { FcPatternGetDouble(dc.font.match->pattern, FC_PIXEL_SIZE, 0, &fontval); - FcPatternAddDouble(pattern, FC_PIXEL_SIZE, fontval); - if (xloadfont(&dc.font, pattern)) - die("st: can't open font %s\n", fontstr); usedfontsize = fontval; if (fontsize == 0) defaultfontsize = fontval; From c63a87cd936c1eeef14c4c21572e5b782d3df4bc Mon Sep 17 00:00:00 2001 From: fpqc Date: Wed, 14 Dec 2016 06:51:27 +0000 Subject: [PATCH 3/3] Move column and row default numbers into config.h --- config.def.h | 7 +++++++ st.c | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config.def.h b/config.def.h index 32d107d..a719e36 100644 --- a/config.def.h +++ b/config.def.h @@ -130,6 +130,13 @@ static unsigned int defaultrcs = 257; */ static unsigned int cursorshape = 2; +/* + * Default columns and rows numbers + */ + +static unsigned int cols = 80; +static unsigned int rows = 24; + /* * Default colour and shape of the mouse cursor */ diff --git a/st.c b/st.c index d6fe58a..fbcd9e0 100644 --- a/st.c +++ b/st.c @@ -4471,8 +4471,6 @@ usage(void) int main(int argc, char *argv[]) { - uint cols = 80, rows = 24; - xw.l = xw.t = 0; xw.isfixed = False; xw.cursor = cursorshape;