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. --- sxiv.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sxiv.h') diff --git a/sxiv.h b/sxiv.h index 25443ea..2d026b1 100644 --- a/sxiv.h +++ b/sxiv.h @@ -362,6 +362,7 @@ int r_opendir(r_dir_t*, const char*, bool); int r_closedir(r_dir_t*); char* r_readdir(r_dir_t*); int r_mkdir(char*); +void* utf8codepoint(const void * __restrict__ str, long * __restrict__ out_codepoint); /* window.c */ @@ -442,7 +443,7 @@ void win_toggle_bar(win_t*); void win_clear(win_t*); void win_draw(win_t*); void win_draw_rect(win_t*, int, int, int, int, bool, int, unsigned long); -int win_textwidth(const win_env_t*, const char*, unsigned int, bool); +int win_textwidth(const win_env_t*, const char*, unsigned int, bool, XftFont*); void win_set_title(win_t*, const char*); void win_set_cursor(win_t*, cursor_t); void win_cursor_pos(win_t*, int*, int*); -- cgit v1.2.3-54-g00ecf