From eb96c7172555f96b07969c6abf74740bb03e36f9 Mon Sep 17 00:00:00 2001 From: Squibby <34315567+squibbysquibby@users.noreply.github.com> Date: Wed, 6 Dec 2017 16:56:00 -0300 Subject: Try to match a fallback font if needed Fixes #276 Instead of rendering the entire filename at once, Xft will let us do it character by character. This will allow sxiv to query fontconfig for a font that can provide any missing codepoints, if needed. A known issue of this patch is that the "..." dots rendering will not work properly for very long multibyte filenames. That is because we cannot easily predict the final width of the rendered filename before drawing it. I couldn't figure out a clean way to deal with this, so I ended up just truncating the offending filenames. --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index ebe14c9..0bafac5 100644 --- a/main.c +++ b/main.c @@ -390,8 +390,8 @@ void update_info(void) if (ow_info) { fn = strlen(files[fileidx].name); if (fn < l->size && - win_textwidth(&win.env, files[fileidx].name, fn, true) + - win_textwidth(&win.env, r->buf, r->p - r->buf, true) < win.w) + win_textwidth(&win.env, files[fileidx].name, fn, true, NULL) + + win_textwidth(&win.env, r->buf, r->p - r->buf, true, NULL) < win.w) { strncpy(l->buf, files[fileidx].name, l->size); } else { -- cgit v1.2.3-54-g00ecf