Sunday, October 07, 2012

PHP Convert font size pixels to points

So I'm trying to work with some text fabric.js and manipulate it in PHP using imagettftext. The deal is that I'm using GD version 2 and the parameter for font size is taken as points size, wheras the text coming from fabric.js is given in pixel size.

I'm going to try this one, which is kinda an approximation. Naturally it is going to be different for different monitors and resolutions. So if anyone has a better way to do it then I'd love to know:

$fontsizeinPT = ($fontsizeinPX*3)/4;



1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete