From 0cf7a196163d51c344361bb2b79c145003dc3555 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 22 Jul 2021 21:23:59 +0200 Subject: render: csd_title(): use a custom font, sized based on the title bar’s height MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We still use the primary font, but use a custom size, based on the title bar’s height. This fixes an issue where the window title could be way too small, or way too big. And changed size when the terminal font size was changed. --- render.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index 82720d22..8fb810b9 100644 --- a/render.c +++ b/render.c @@ -1675,9 +1675,14 @@ render_csd_title(struct terminal *term, const struct csd_data *info, title_text = _title_text; } - const int margin = 10 * term->scale; - render_osd(term, surf->surf, surf->sub, buf, title_text, fg, bg, - margin, (buf->height - term->fonts[0]->height) / 2); + struct wl_window *win = term->window; + const int margin = win->csd.font->space_advance.x > 0 + ? win->csd.font->space_advance.x + : win->csd.font->max_advance.x; + + render_osd(term, surf->surf, surf->sub, win->csd.font, + buf, title_text, fg, bg, margin, + (buf->height - win->csd.font->height) / 2); csd_commit(term, surf->surf, buf); free(_title_text); -- cgit v1.3