libsl

shared code master of various suckless projects
git clone git://git.suckless.org/libsl
Log | Files | Refs | LICENSE

commit 86f1eafc2d02340e202c799a2b0db4fae9519f4e
parent 1faf5f475161b2362b077be9f3ddde84a95514ce
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri, 20 Aug 2021 23:10:12 +0200

Revert "sync drw.c: improve speed of large fonts and free fontset"

This reverts commit 1faf5f475161b2362b077be9f3ddde84a95514ce.

Diffstat:
Mdrw.c | 8++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drw.c b/drw.c @@ -95,7 +95,6 @@ drw_free(Drw *drw) { XFreePixmap(drw->dpy, drw->drawable); XFreeGC(drw->dpy, drw->gc); - drw_fontset_free(drw->fonts); free(drw); } @@ -310,11 +309,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp if (utf8strlen) { drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL); /* shorten text if necessary */ - if (ew > w) - for (ew = 0, len = 0; ew < w - lpad * 2 && len < MIN(utf8strlen, sizeof(buf) - 1); len++) - drw_font_getexts(usedfont, utf8str, len, &ew, NULL); - else - len = MIN(utf8strlen, sizeof(buf) - 1); + for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--) + drw_font_getexts(usedfont, utf8str, len, &ew, NULL); if (len) { memcpy(buf, utf8str, len);