Re: [AD] length-restricted text routines

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2008-09-14, Chris Robinson <chris.kcat@xxxxxxxxxx> wrote:
> On Sunday 14 September 2008 05:29:08 am Elias Pschernig wrote:
> > I agree. And if it was for me, we would completely get rid of all
> > al_textout* functions (as I said before). You can always use "%s" and
> > al_textprintf.
> 
> Wouldn't al_textout* be more efficient for cases where formatting isn't 
> needed? Even in best-case, al_textprintf has to run through vsprintf or 
> equivilant, get written to a temp (size-limited and/or allocated?) buffer, 
> and then have something like al_textout* called anyway.

It's easy enough to optimise the cases where:

- the format string is "%s"
- the format string contains no percent characters

But seeing as 'count' parameters make sense for textout* but
not for textprintf*, I suggest we:

- keep textout, which always take a count parameter. -1 would mean
  the whole string;

- keep textprintf, without the count parameter;

- add a flag to both functions to select right or centre alignment
  and delete the _right and _justify functions.

The flag could be extended to support right-to-left strings as well.

Peter





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/