t* My version of sent URI git clone git://git.codevoid.de/sent-sdk.git DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR commit a9ca2473fd72462eaf90346258119c13c74bddcb DIR parent 4a114392bbdef9fc23d7f346ad1dab4f855bed17 URI Author: Markus Teich <markus.teich@stusta.mhn.de> Date: Sat, 31 Oct 2015 18:07:07 +0100 fix font width calculations Diffstat: M drw.c | 2 +- M sent.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) --- DIR diff --git a/drw.c b/drw.c t@@ -379,7 +379,7 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text) { if (!drw || !drw->fonts || !text) return 0; - return drw_text(drw, 0, 0, 0, 0, text, 0) + drw->fonts->h; + return drw_text(drw, 0, 0, 0, 0, text, 0); } void DIR diff --git a/sent.c b/sent.c t@@ -312,17 +312,18 @@ void pngdraw(Image *img) void getfontsize(char *str, unsigned int *width, unsigned int *height) { size_t i; - size_t len = strlen(str); for (i = 0; i < NUMFONTSCALES; i++) { drw_setfontset(d, fonts[i]); - drw_font_getexts(fonts[i], str, len, width, height); + *height = fonts[i]->h; + *width = drw_fontset_getwidth(d, str); if (*width > xw.uw || *height > xw.uh) break; } if (i > 0) { drw_setfontset(d, fonts[i-1]); - drw_font_getexts(fonts[i-1], str, len, width, height); + *height = fonts[i-1]->h; + *width = drw_fontset_getwidth(d, str); } *width += d->fonts->h; }