imageTTFText with GD2, problems converting from pixels to points

imageTTFText with GD2, problems converting from pixels to points

am 20.09.2007 19:22:44 von Nitzan Tomer

hi everyone,

i created a script that outputs an image (transparent with text) based
on parameters passed by $_GET.
everything in my application works with 'pixels' and since GD2 this
function (imagettftext) uses 'points' as the text size unit.

i've searched everywhere for a solution to convert from pixels to
points (or the other way around) but with no luck... each place says
something different and i can't find a good answer.

any ideas of how to solve this?

thanks a lot!
nitzan.

Re: imageTTFText with GD2, problems converting from pixels to points

am 21.09.2007 02:26:50 von Csaba

"Nitzan Tomer" wrote in message
news:1190308964.618963.11670@19g2000hsx.googlegroups.com...
> hi everyone,
>
> i created a script that outputs an image (transparent with text) based
> on parameters passed by $_GET.
> everything in my application works with 'pixels' and since GD2 this
> function (imagettftext) uses 'points' as the text size unit.
>
> i've searched everywhere for a solution to convert from pixels to
> points (or the other way around) but with no luck... each place says
> something different and i can't find a good answer.
>
> any ideas of how to solve this?
>
> thanks a lot!
> nitzan.
>

Hi,
as far as I know pixels are for (computer) screens, and points are for
printing.

1 point (assuming Postscript) = 1/72 th of an inch
( http://www.cl.cam.ac.uk/~mgk25/metric-typo/ )

How those relate depends on the resolution of the screen.
The resolution of your screen depends on the screen settings, and is not a
fixed value.
Some people assume 72 DPI for screen. Some OS's use 96 DPI. Most of the time
you can adjust DPI somewhere in computer settings. For Windows that used to
be for type only, not for images.

Basically it all means: there is no real way to convert between points and
pixels... because there is no general relationship between the two.

I usually try until things look good on as much screens I can try it on.
How is that for helping you? ;-)

Good luck,
Richard.

Re: imageTTFText with GD2, problems converting from pixels to points

am 21.09.2007 03:05:25 von unknown

Post removed (X-No-Archive: yes)