Krolyxon
Commit 278f0ce

Branches

Refs →

nsxiv278f0ce

Match fallback font FC_SIZE to original font

Author
Foldex
Date
2019-02-22 22:32 -0500
Committer
Bert Münnich · 2019-03-15 12:29 +0100
Parent
1ef5429
Commit
278f0ce94e047fd7a9506dd57d89b6682f123cf3

+4 −1

1 file changed

  1. M window.c +4 −1
M window.c View
@@ -48,6 +48,7 @@ static GC gc;
4848
4949 static XftFont *font;
5050 static int fontheight;
51+static double fontsize;
5152 static int barheight;
5253
5354 Atom atoms[ATOM_COUNT];
@@ -60,6 +61,7 @@ void win_init_font(const win_env_t *e, const char *fontstr)
6061 if ((font = XftFontOpenName(e->dpy, e->scr, fontstr)) == NULL)
6162 error(EXIT_FAILURE, 0, "Error loading font '%s'", fontstr);
6263 fontheight = font->ascent + font->descent;
64+ FcPatternGetDouble(font->pattern, FC_SIZE, 0, &fontsize);
6365 barheight = fontheight + 2 * V_TEXT_PAD;
6466 }
6567
@@ -414,7 +416,8 @@ int win_draw_text(win_t *win, XftDraw *d, const XftColor *color, int x, int y,
414416 fccharset = FcCharSetCreate();
415417 FcCharSetAddChar(fccharset, rune);
416418 f = XftFontOpen(win->env.dpy, win->env.scr, FC_CHARSET, FcTypeCharSet,
417− fccharset, FC_SCALABLE, FcTypeBool, FcTrue, NULL);
419+ fccharset, FC_SCALABLE, FcTypeBool, FcTrue,
420+ FC_SIZE, FcTypeDouble, fontsize, NULL);
418421 FcCharSetDestroy(fccharset);
419422 }
420423 XftTextExtentsUtf8(win->env.dpy, f, (XftChar8*)t, next - t, &ext);