Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pixel font size in imagettftext instead of point size

Tags:

php

gd

I'm trying to use imagettftext, but apparently it uses point size in GD2, but all of my sizes are in pixels, is there any other function that I can use, or any way to convert pixels to points ?

like image 385
Sina Fathieh Avatar asked Dec 05 '10 06:12

Sina Fathieh


2 Answers

If you're super-lazy, then this might work as an approximation:

$fontsizeinPT = ($fontsizeinPX*3)/4;
like image 125
markashworth Avatar answered Sep 28 '22 01:09

markashworth


See http://reeddesign.co.uk/test/points-pixels.html

like image 30
Tyler Eaves Avatar answered Sep 28 '22 01:09

Tyler Eaves