X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=fbcd9e02154fe586066648bdd3bafdff06820693;hb=c63a87cd936c1eeef14c4c21572e5b782d3df4bc;hp=e50e8848c50ebabc5e64f451123e001dc2fcc68a;hpb=424202798b02554092ba84dd59fb7b79b59b7b75;p=st.git diff --git a/st.c b/st.c index e50e884..fbcd9e0 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; @@ -3472,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; @@ -4458,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;