ID: 15656 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Closed Bug Type: GD related Operating System: SuSE 7.0/kernel 2.2.16 PHP Version: 4.0.6 New Comment:
The fact that GD changed from using pixel size to point size shouldn't matter a lot since we render mostly screen images at 72 dpi and there are 72 points in an inch (72,... but it's generally rounded to 72 per inch). This means that in fact we were used to having for example a 10 point size text rendered to 10 pixels. Now in comes GD 2, there we have in gd.h /* resolution affects ttf font rendering, particularly hinting */ #define GD_RESOLUTION 96 /* pixels per inch */ So this means that for font rendering in GD uses 96 dpi. This means that if you use this like we used to (1 point == 1 pixel) GD 2 will have 1 point == 1 pixel/72 * 96, giving 1,333 pixel per point, rendering our beautifull charts in GD 1.x into ugly ones because all the text is too large now... It took me a while before I found this out (several months of passive searching and since I thought Freetype was at the cause I was looking in the wrong direction...) Now The case is that this thing comes close to a religious thing (Windows PCs use 96 dpi screen resolution, Macs were like using the 72 dpi resolution), fact is that this is still very noticable in my enviroment. I received marked up email from PC/Windows users that is simply to small to read, Word (office in general) documents from a PC that are sent to me are at 75% zoom out, making the text illegible on the mac, so I need to change the zoom factor every time... Verry funny that in this day and age there is such a difference in the very hart of these systems, that they will never be the same :)) Ok, now for the solution, either change the #define in gd.h or use font sizes of for example 10/96*72 (for a 10 pixel font size). If you use a lot of small text on the images I recon changing the #define is better that entering fractional sizes.... Previous Comments: ------------------------------------------------------------------------ [2002-08-10 07:35:30] [EMAIL PROTECTED] Well, if you specify a font size of 18 points, how tall, in pixels, is the character 'M' in your output? And how high do you want it to be? ------------------------------------------------------------------------ [2002-08-10 07:33:35] [EMAIL PROTECTED] IIRC, GD changed from using pixel size for fonts to using point size. That explains the difference in size. Fortunately, it is easy to compensate: 1 point = 1/72 of an inch. 10 points using a 96 dpi screen = 10/72*96 = 13.3 pixels. So, to correct the size, divide the size you are passing into the functions by 1.3 (96/72). ------------------------------------------------------------------------ [2002-08-10 06:09:24] [EMAIL PROTECTED] > Compensating for this is luckily very easy. But you fail to say how? Another Fermat? I've tried simply manually scaling down the font size, but I can't get ttf's in php 4.1.2 to look the same as they did in 4.0.6 (which looked nice!) Please fill us in! Thanks. ------------------------------------------------------------------------ [2002-07-01 12:09:54] [EMAIL PROTECTED] PHP's gd interface currently uses an output resolution of 72dpi. This means that a letterform 72 points (= one inch) high will result in output that is 72 pixels high. If you are used to some other dpi setting, the text gd outputs may appear either too big or too small. Compensating for this is luckily very easy. ------------------------------------------------------------------------ [2002-06-28 04:13:14] [EMAIL PROTECTED] Thank you for taking the time to report a problem with PHP. Unfortunately your version of PHP is too old -- the problem might already be fixed. Please download a new PHP version from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PHP. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/15656 -- Edit this bug report at http://bugs.php.net/?id=15656&edit=1