|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-06-17 09:25 UTC] hanhongfei558 at 126 dot com
Description: ------------ os centos 6.5 php 5.5.36 imagick 3.4.2 imagemagick 7.0.1-2 When i use setTextInterlineSpacing like this $draw->setTextInterlineSpacing($spacing); in PHP, it not work. Regardless of the value of the $spacing is how much the output of the row spacing does not change. But imagick-3.4.2 with imagemagick-6.9.4 it work well PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 03:00:02 2025 UTC |
os centos 6.5 php 5.5.36 imagick 3.4.2 imagemagick 7.0.1-2 When i use setTextInterlineSpacing like this $draw->setTextInterlineSpacing($spacing); in PHP, it not work. Regardless of the value of the $spacing is how much the output of the row spacing does not change. But imagick-3.4.2 with imagemagick-6.9.4 it work well. Test script: function createText($content = "Line1\r\nLine2\r\nLine3", $color = "#000000"){ $img = new Imagick(); $img->setResolution(300,300); $img->newimage(600,300, 'none'); $draw = new ImagickDraw(); $draw->setFontSize(20); $draw->setStrokeColor($color); $draw->setFillColor($color); $spacingArr = array(-20, -10, 0, 10, 20, 40, 80); foreach ($spacingArr as $key => $value) { $draw->setTextInterlineSpacing($value); $img->annotateImage($draw, $key * 100, 50, 0, $content); } $img->drawImage($draw); $img->setImageFormat('png'); header("Content-Type: image/png"); echo $img; }macOS Sierra 10.12.3 php 7.1.1 imagick 3.4.3 ImageMagick 7.0.5-0 $draw = new \ImagickDraw(); foreach (range(-3, 3) as $val) { $draw->clear(); $draw->setTextInterwordSpacing($val); echo $draw->getTextInterwordSpacing() . PHP_EOL; } output: -3 -2 -1 0 0 0 0 if not use $draw->clear() method: $draw = new \ImagickDraw(); foreach (range(-3, 3) as $val) { //$draw->clear(); $draw->setTextInterwordSpacing($val); echo $draw->getTextInterwordSpacing() . PHP_EOL; } output will be: -3 -3 -3 -3 -3 -3 -3 Same result with $draw->setTextKerning($val), $draw->getTextKerning(). Identical code on: php 5.6.10 imagick 3.1.2 ImageMagick 6.8.9-7 $draw = new \ImagickDraw(); foreach (range(-3, 3) as $val) { $draw->clear(); $draw->setTextInterwordSpacing($val); echo $draw->getTextInterwordSpacing() . PHP_EOL; } output: -3 -2 -1 0 1 2 3 The result does not depend on whether method $draw->clear() is used or not. And command line examples work correctly in ImageMagick 7.0.5-0 and 6.8.9-7 convert -pointsize 12 label:Anthony label_kerning_0.gif convert -pointsize 12 -kerning 1 label:Anthony label_kerning_1.gif convert -pointsize 12 -kerning 2.5 label:Anthony label_kerning_2.gif convert -pointsize 12 -kerning 5 label:Anthony label_kerning_5.gif convert -pointsize 12 -kerning -1 label:Anthony label_kerning-1.gif