|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-11-20 09:00 UTC] wizard at imagemagick dot org
[2010-11-20 20:37 UTC] george at sogetthis dot com
[2010-11-21 06:38 UTC] mkoppanen@php.net
[2010-11-21 06:58 UTC] mkoppanen@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 10:00:01 2025 UTC |
Description: ------------ If $im->SetResolution is used to set a resolution, queryfontmetrics doesn't respect the value. Changing the $print_resolution in the reproduce code doesn't affect the queryfontmetrics textWidth measurement, whereas the actual image dimension as calculated by drawImage'ing the data does. Also, is the input to queryfontmetric point size or pixel height? Reproduce code: --------------- <?php $print_resolution = 300; $string = "Hello World"; $fontsize = 72; $im = new Imagick(); $im->setResolution($print_resolution,$print_resolution); $im->newImage(9040,3400, "white","png"); $im->setImageUnits(1); $draw = new ImagickDraw(); $draw->setFont('/path/to/arial.ttf'); $draw->setFontSize($fontsize); $draw->setFillColor('#ff0000'); $data = $im->queryFontMetrics($draw, $string); // draw image to test actual height $draw->annotation(0, $data['ascender'] * ($print_resolution / 72), $string); $im->drawImage($draw); $im->trimImage(0); //header('content-type:image/png'); //die($im); $dataii = $im->identifyimage(); print ":identifyimage height:" . $dataii['geometry']['height']; print "<br/>-----------------------------<br/>"; print ":queryfontmetrics height: " . $data['textHeight']; Expected result: ---------------- changing the $print_resolution gives different values from identifyimage, but the output to queryfontmetrics does not change.