Page 1 of 1
Text does not wrap correctly
Posted: 2016-08-29T07:23:53-07:00
by arthur
Hello,
I'm reposting this here since I think it's a bug and not an error on my side.
Can a mod close this duplicate topic
viewtopic.php?f=1&t=30375 ?
I am having some issue trying to wrap text in a given width and pointsize.
Here is what I run:
Code: Select all
convert -size 400x -pointsize 50 caption:'This does not wrap' out.png
And this is what I get:
I would expect "wrap" to be on a new line.
I get this result with imagemagick 6.9.5 on OSX and imagemagick 6.7.7 on Ubuntu
Probably same issue
http://stackoverflow.com/questions/1158 ... -font-size
Thank you for your help
Arthur
Re: Text does not wrap correctly
Posted: 2016-08-29T09:05:52-07:00
by snibgo
I agree it seems to be a bug.
I won't remove the other topic as it contains information that might be useful. I would merge the topics but when I try clever things like that I end up deleting the universe.
Re: Text does not wrap correctly
Posted: 2016-08-29T09:34:57-07:00
by fmw42
I can repeat it on IM 6.9.5.7 Q16 Mac OSX Snow Leopard. It would seem to be a bug.
But note that if you really do not want the text to wrap, you should use label:. That works fine for the same command.
Re: Text does not wrap correctly
Posted: 2016-08-29T10:03:41-07:00
by arthur
Thank you for your responses. I will try to look around in the code to see I understand anything…
For the label: option, I really do want the text to wrap
I have a fixed pointsize and width and a variable height.
Re: Text does not wrap correctly
Posted: 2016-08-29T10:18:16-07:00
by fmw42
arthur wrote:For the label: option, I really do want the text to wrap
I have a fixed pointsize and width and a variable height.
Understood. I was just checking to be sure.
I note that you did not specify a font and took the system default font which on Mac is Arial, I believe. Does it fail for other fonts?
I think the IM developers will need to look into this.
Re: Text does not wrap correctly
Posted: 2016-08-29T10:59:44-07:00
by GeeMack
fmw42 wrote:I note that you did not specify a font and took the system default font which on Mac is Arial, I believe. Does it fail for other fonts?
I tested this with a few different fonts running IM7 on Windows 10 64. For example, using this command...
Code: Select all
magick ^
-fill black ^
-background white ^
-font myriad-web-pro ^
( -pointsize 15 -size 100x caption:"This does not wrap" ) ^
( -pointsize 30 -size 200x caption:"This does not wrap" ) ^
( -pointsize 40 -size 300x caption:"This does not wrap" ) ^
( -pointsize 45 -size 300x caption:"This does not wrap" ) ^
( -pointsize 46 -size 300x caption:"This does not wrap" ) ^
( -pointsize 48 -size 300x caption:"This does not wrap" ) ^
( -pointsize 48 -size 320x caption:"This does not wrap" ) ^
( -pointsize 49 -size 350x caption:"This does not wrap" ) ^
( -pointsize 50 -size 350x caption:"This does not wrap" ) ^
( -pointsize 50 -size 400x caption:"This does not wrap" ) ^
( -pointsize 55 -size 450x caption:"This does not wrap" ) ^
( -pointsize 60 -size 450x caption:"This does not wrap" ) ^
-bordercolor black ^
-border 2x2 ^
-bordercolor white ^
-border 10x10 ^
-append ^
-shave 10x10 ^
-border 20x20 ^
caption_myriad-web-pro.png
... I get this as the output image...
The error seems to be hit and miss and occurs either with the default font or any specified font. It happens with no "-gravity" setting or with a setting like "-gravity center". It appears to be making the wrapping decision using a fairly narrow combination of pointsize and width, so sometimes it doesn't look like a problem, but changing one factor by just a bit can make it happen.
Re: Text does not wrap correctly
Posted: 2016-08-30T06:27:07-07:00
by arthur
I think I found the issue, I have submitted a pull request to the Github clone
https://github.com/ImageMagick/ImageMagick/pull/260
Can a dev let me know if this should be submitted elsewhere?
Re: Text does not wrap correctly
Posted: 2016-08-30T09:09:37-07:00
by dlemstra
Thanks for the patch and that is the correct place. Will take a look at it tonight.