Text does not wrap correctly

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
arthur
Posts: 7
Joined: 2015-04-03T01:50:18-07:00
Authentication code: 6789

Text does not wrap correctly

Post by arthur »

Hello,

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:
Image

I would expect "wrap" to be on a new line.

Am I doing something wrong or is this a bug?

Tested 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
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Text does not wrap correctly

Post by Bonzo »

From what I know text does not automatically wrap in caption, draw or annotate but I believe it does in label.

You can force it to depending on what language you are using with \n or new lines.
arthur
Posts: 7
Joined: 2015-04-03T01:50:18-07:00
Authentication code: 6789

Re: Text does not wrap correctly

Post by arthur »

If I read the docs correctly, it's the other way around: does not wrap with label, wraps with caption
http://www.imagemagick.org/Usage/text/#caption
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Text does not wrap correctly

Post by snibgo »

"caption:" should wrap, and generally does, eg:

Code: Select all

convert -size 200x -pointsize 50 caption:"This does not wrap" caption_200.png
Image
But:

Code: Select all

convert -size 400x -pointsize 50 caption:"This does not wrap" caption_400.png
Image

Looks like a bug to me.

v6.9.5-3 on Windows 8.1.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Text does not wrap correctly

Post by fmw42 »

Caption will not split a word to wrap. But it should wrap between the not and wrap words.
arthur
Posts: 7
Joined: 2015-04-03T01:50:18-07:00
Authentication code: 6789

Re: Text does not wrap correctly

Post by arthur »

Thank you everybody.
I have opened a similar thread in the Bugs section and I think we should continue there: viewtopic.php?f=3&t=30376
Post Reply