aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFoldex <foldex@pm.me>2019-02-22 22:32:36 -0500
committerBert Münnich <ber.t@posteo.de>2019-03-15 12:29:44 +0100
commit278f0ce94e047fd7a9506dd57d89b6682f123cf3 (patch)
tree716639a135034c75d239d1efa1d8dfa6f3c09c34
parent1ef5429702f3abd054b1887028d41fe4754bbd14 (diff)
Match fallback font FC_SIZE to original font
-rw-r--r--window.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/window.c b/window.c
index de1dbd1..9879880 100644
--- a/window.c
+++ b/window.c
@@ -48,6 +48,7 @@ static GC gc;
static XftFont *font;
static int fontheight;
+static double fontsize;
static int barheight;
Atom atoms[ATOM_COUNT];
@@ -60,6 +61,7 @@ void win_init_font(const win_env_t *e, const char *fontstr)
if ((font = XftFontOpenName(e->dpy, e->scr, fontstr)) == NULL)
error(EXIT_FAILURE, 0, "Error loading font '%s'", fontstr);
fontheight = font->ascent + font->descent;
+ FcPatternGetDouble(font->pattern, FC_SIZE, 0, &fontsize);
barheight = fontheight + 2 * V_TEXT_PAD;
}
@@ -414,7 +416,8 @@ int win_draw_text(win_t *win, XftDraw *d, const XftColor *color, int x, int y,
fccharset = FcCharSetCreate();
FcCharSetAddChar(fccharset, rune);
f = XftFontOpen(win->env.dpy, win->env.scr, FC_CHARSET, FcTypeCharSet,
- fccharset, FC_SCALABLE, FcTypeBool, FcTrue, NULL);
+ fccharset, FC_SCALABLE, FcTypeBool, FcTrue,
+ FC_SIZE, FcTypeDouble, fontsize, NULL);
FcCharSetDestroy(fccharset);
}
XftTextExtentsUtf8(win->env.dpy, f, (XftChar8*)t, next - t, &ext);