Re: [hackers] [sent] add slide numbers with configurable position and size

From: <ssd_AT_mailless.org>
Date: Sat, 2 Sep 2017 13:53:27 +0200

* Hiltjo Posthuma 2017-09-02 12:08
> I think its better to do:
>
> > + snprintf(idxstr, sizeof(idxstr), "%d", idx);
 
point taken. less magic numbers. I'll wait a bit in case someone else
may want to review and will update the patch.

btw, this part below is pure heuristics, which turn out to work in the
cases I tested. feel free to sugest other magic numbers.

> > + drw_setfontset(d, fonts[numfontidx]);
> > + drw_text(d,
> > + xw.w / 2 + numpos * (xw.w / 2 - 3 * fonts[numfontidx]->h),
> > + xw.h - 3 * fonts[numfontidx]->h,
> > + 4 * d->fonts->h,
> > + d->fonts->h,
> > + 1,
> > + idxstr,
> > + 0);

Just had a look and will change it a bit: will pad the numbers with
spaces

> > + snprintf(idxstr, sizeof(idxstr), "% 3d", idx);

and have 3 times the hight, rather than 4 as width. should be enough to
suit most fonts.

cheers
--s
Received on Sat Sep 02 2017 - 13:53:27 CEST

This archive was generated by hypermail 2.3.0 : Sat Sep 02 2017 - 14:00:54 CEST