On Thu, Aug 19, 2021 at 05:30:14AM +0200, Viktor Grigorov wrote: > This results in 1-character elements being unrendered. > I was wondering why two of my surfraw elvi were blank, they just were getting > drawn. > > Aug 16, 2021, 20:17 by suckl...@jochen.sprickerhof.de: > > > From: Jochen Sprickerhof <suckl...@jochen.sprickerhof.de> > > > > In case lpad * 2 > w, w - lpad * 2 wraps around and comparing it with ew > > is always true. > > Also shorten the text if the initial width does not fit with padding. > > --- > > drw.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drw.c b/drw.c > > index 9c39086..36b56df 100644 > > --- a/drw.c > > +++ b/drw.c > > @@ -310,8 +310,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++) > > + if (ew + lpad * 2 > w) > > + for (ew = 0, len = 0; ew + lpad * 2 < w && len > > < MIN(utf8strlen, sizeof(buf) - 1); len++) > > drw_font_getexts(usedfont, utf8str, len, &ew, NULL); > > else > > len = MIN(utf8strlen, sizeof(buf) - 1); > > -- > > 2.32.0 > > > >
Hi, I also get a blank character with this patch (but not in the master version). @Jochen: can you provide more details what the issue is and how to reproduce it (on master, with no custom patches of course)? -- Kind regards, Hiltjo