Page 1 of 1

word wrapping detection

Posted: 2011-04-20T08:20:41-07:00
by jpotter
Is there a way to determine where the word wrap will take place (specifically what is the text that is starting on the second line?)


Thanks

Re: word wrapping detection

Posted: 2011-04-20T16:28:28-07:00
by anthony
Nope not without doing all the calculations yourself!

It gets worse if you specify a full -size for caption but not pointsize. Then the font pointsize will become variable for best fit! That will make it even harder to determine!


Look at Determining Font Metrics
http://www.imagemagick.org/Usage/text/#font_info
this will give you a way to see how long a particular string will be rendered in a specific situation.

Re: word wrapping detection

Posted: 2011-04-20T16:55:15-07:00
by fmw42
jpotter wrote:Is there a way to determine where the word wrap will take place (specifically what is the text that is starting on the second line?)


Thanks

Why not just put a \n where you want the break to be!

convert -background lightblue -size 200x -fill blue -font candice label:"This is test 1\nand This is test2\nand test3" test.png

The longest line determines the pointsize for the given width. Thus you know exactly what letter will be at the beginning of each line