Re: [hackers] [libsl|dmenu][PATCH v2] Fix truncation issues and improve performance
> On Mon, Mar 28, 2022 at 05:57:48PM +0600, NRK wrote:
> > And on the topic of ellipsis_width, we currently don't account for
> > fallback font:
> >
> > usedfont = drw->fonts;
> > drw_font_getexts(usedfont, "...", 3, &ellipsis_width, NULL);
> >
> > The assumption here was that every font should have '.' but if that
> > turns out to be wrong, then the font width will be incorrect.
I think that we can have as a requirement that the system provides a
font with the glyph for dot.
> Attached a patch fixing this issue, as well as a patch guarding against
> calling drw_text() with 0 width.
>
> Think both these issues should be extremely rare, but can't hurt dealing
> with them anyways.
>
> - NRK
> _AT_@ -283,7 +284,10 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
> }
>
> usedfont = drw->fonts;
> - drw_font_getexts(usedfont, "...", 3, &ellipsis_width, NULL);
> + if (ellipsis_width < 0) {
> + ellipsis_width = 0; /* stop infinite recursion */
> + ellipsis_width = drw_fontset_getwidth(drw, "...");
I don't understand how setting it twice in a row stops a recursion.
Will not the drw_fontset_getwidth() call *always* overwrite any value set before?
> + }
> while (1) {
> ew = ellipsis_len = utf8strlen = 0;
> utf8str = text;
Received on Tue Mar 29 2022 - 19:33:27 CEST
This archive was generated by hypermail 2.3.0
: Tue Mar 29 2022 - 19:36:34 CEST