Re: [AD] ALLEGRO_ALIGN_CENTRE and integer alignment

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


On 04/11/12 00:07, Peter Wang wrote:
Hi,

How should ALLEGRO_ALIGN_CENTRE behave now that we don't try to align
text drawing to integral offsets?  The user may pass in (x,y) which are
both integer-aligned, but because the text length is an odd value
(x - text_length*0.5) is no longer integer aligned.
You can see the effect in ex_audio_chain (the "Mixer" label).

One solution is use an integer division, so that
(x - text_length/2) remains integral if x was integral.

Any problem with that?

Peter
As far as I can tell the original motivation for disabling integer alignment was that:
- It produced jittering when the text was moved by fractional amounts
- It was very difficult to work around
Doing integer divide (I'd probably do proper rounding instead of truncation though) for the text width is neither of those, there'll be no jittering due to movement and it's trivial to work around if need be.

Now the real doozy is al_draw_justified_text, I'm not too sure how that function should work.

-SL




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