php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72438 imagick3.4.2 setTextInterlineSpacing not work with IM7.0.1-2
Submitted: 2016-06-17 09:25 UTC Modified: 2017-05-07 22:10 UTC
Votes:3
Avg. Score:4.3 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: hanhongfei558 at 126 dot com Assigned: danack (profile)
Status: Closed Package: imagick (PECL)
PHP Version: 5.5.36 OS: centos 6.5
Private report: No CVE-ID: None
 [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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-17 09:30 UTC] hanhongfei558 at 126 dot com
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;
}
 [2016-06-17 22:13 UTC] danack@php.net
Hmm- I'm unable to reproduce your problem testing with 7.0.1-0.

Please could you try using the convert ImageMagick tool with:

convert                         label:'First\nSecond'  label_lspace_off.gif
convert -interline-spacing  5   label:'First\nSecond'  label_lspace_5.gif
convert -interline-spacing 10   label:'First\nSecond'  label_lspace_10.gif
convert -interline-spacing 20   label:'First\nSecond'  label_lspace_20.gif
convert -interline-spacing -5   label:'First\nSecond'  label_lspace-5.gif
convert -interline-spacing -10  label:'First\nSecond'  label_lspace-10.gif


just to make sure at least the command line version is behaving correctly?
 [2016-06-17 22:13 UTC] danack@php.net
-Assigned To: +Assigned To: danack
 [2016-06-18 06:16 UTC] hanhongfei558 at 126 dot com
i have update the evn to the latest imagick3.4.3RC1 with imagemagick-7.0.2-0
i try using the convert ImageMagick tool with:
convert                         label:'First\nSecond'  label_lspace_off.gif
convert -interline-spacing  5   label:'First\nSecond'  label_lspace_5.gif
convert -interline-spacing 10   label:'First\nSecond'  label_lspace_10.gif
convert -interline-spacing 20   label:'First\nSecond'  label_lspace_20.gif
convert -interline-spacing -5   label:'First\nSecond'  label_lspace-5.gif
convert -interline-spacing -10  label:'First\nSecond'  label_lspace-10.gif
at least the command line version is behaving correctly!

but in php it still has can not change the line spacing problems.

However, at latest evn when i set the line spacing to a negative number,it effective.set a positive number it not work.
 [2016-06-18 12:41 UTC] danack@php.net
I have no idea what could be causing this.

None of the code related to this function appears to have changed in either Imagick or ImageMagick ..... 

However, there does appear to be a possibly related issue with MagickQueryMultilineFontMetrics that I found while trying to investigate this issue: https://github.com/ImageMagick/ImageMagick/issues/222
 [2017-04-14 06:58 UTC] aleksey dot maksarov at gmail dot com
macOS Sierra 10.12.3
php 7.1.1
imagick 3.4.3
ImageMagick 7.0.5-0

Same problem with ImagickDraw::setTextKerning and ImagickDraw::setTextInterwordSpacing.

Similar behaving with negative number and command line version.
 [2017-04-14 18:14 UTC] danack@php.net
Aleksey,

"Similar behaving with negative number and command line version." 

Do you mean that the command line version works correctly, or that it behaves the same as the Imagick version?

Also, if you could paste the command you're running that would be useful.
 [2017-04-17 11:28 UTC] aleksey dot maksarov at gmail dot com
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
 [2017-05-07 12:54 UTC] danack@php.net
-Status: Assigned +Status: Analyzed
 [2017-05-07 12:54 UTC] danack@php.net
I think I've identified the problem and reported it upstream: https://github.com/ImageMagick/ImageMagick/issues/478
 [2017-05-07 22:10 UTC] danack@php.net
-Status: Analyzed +Status: Closed
 [2017-05-07 22:10 UTC] danack@php.net
This appears to be fixed upstream.

Please feel free to re-open if it isn't.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 09:01:28 2024 UTC