NYCPHP Meetup

NYPHP.org

[nycphp-talk] since we're talking about GD and text...

bpang at bpang.com bpang at bpang.com
Fri Mar 12 12:11:48 EST 2004


I've been using imagettftext when creating images on the fly and have been
running into some weirdness with text alignment

it varies from font to font, but what happens is that certain
strings/letter combinations shift the baseline from character to
character.

For example, using arial.ttf (ripped off WinXP, but why should that
matter?) the string "111"
appears as:
111
but each sequential digit's baseline is a pixel or so lower than the
previous digit.

But, the same string is ok when using verdana.ttf (again, ripped from WinXP)

However, verdana had a similar problem whenever an "a" followed a "T"
such that in the string "Tapioca"
the baseline for the letter "T" is a pixel or so HIGHER than the rest of
the string.

Has anyone else noticed this? I haven't seen anything on php.net or in
google searches. Would it be considered a bona-fide bug?

I have tried numerous solutions, short of drawing out each char and
imagecopymerge-ing them as has been suggested to Jeff for his Captcha. For
me, there is enough text that it would probably be really slow.





More information about the talk mailing list