Page 1 of 2

caption is breaking words... ugh

Posted: 2010-09-22T11:02:30-07:00
by immortal26
Firstly running latest version... have all depend.. etc...

BUT
with a function as easy as:
convert -size (whatever size) -font myfont.ttf -background black -fill white caption:'jennifer winningham' comp.png

everything is irrelevant really because if I don't specify a pointsize imagemagick is supposed to fit it correctly, so specifeng size.

So if the caption was "Jennifer Winningham".. it's outlaying like this:
Jennifer
Wiinning
ham

ummmm, what's going on? lol

Re: caption is breaking words... ugh

Posted: 2010-09-22T11:09:46-07:00
by Bonzo
Everything is not irrelavent; if you have a long thin box it will be on one line but if you have a tall narrow box it will break up the text so what did you use for the size?

Re: caption is breaking words... ugh

Posted: 2010-09-22T11:28:08-07:00
by immortal26
Well silly me your right... hmmm... I just used a simple size of 100x100.. here is the exact code with simple syntax.

Code: Select all

<?php

// Set the path of convert command for imagemagick
$path = "/opt/local/bin/";

// Set which font we want to use
$font = "font/trace_edit.ttf";
$capfont = "font/corbel.ttf";


$text = "Jennifer\nwinningham";

$final = $path."convert -size 100x100 -font ".$capfont." -background black -fill white caption:\"".$text."\" final.png";
exec($final, $result);

header("Location: final.png");

?>
I could have swore caption resizes the pointsize to fill correctly, and not to break the word.
and not:
Jennifer
winning
ham

Re: caption is breaking words... ugh

Posted: 2010-09-22T12:17:59-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.6.4-6 Beta available by sometime tomorrow. Thanks.

Re: caption is breaking words... ugh

Posted: 2010-09-22T12:21:20-07:00
by immortal26
thanks magick ... knew something was amiss here :P

Re: caption is breaking words... ugh

Posted: 2010-09-22T12:35:20-07:00
by Bonzo
Well spotted I was not thinking about the word being split and have just tried it and have the same problem on 6.5.9

Out of interest I do not use the ( can not remember the word for it ) ". ." around variables and it still works and so would use;

Code: Select all

$final = "$path convert -size 100x100 -font $capfont -background black -fill white caption:\"$text\" final.png";
Not sure about the $path at the start as didn't test that. I tend to use convert all the time and so I would add the convert to the $path variable.

Re: caption is breaking words... ugh

Posted: 2010-09-22T18:31:42-07:00
by anthony
ASIDE:
Bonzo wrote:Out of interest I do not use the ( can not remember the word for it ) ". ." around variables and it still works and so would use;

Code: Select all

$final = "$path convert -size 100x100 -font $capfont -background black -fill white caption:\"$text\" final.png";
Not sure about the $path at the start as didn't test that. I tend to use convert all the time and so I would add the convert to the $path variable.
You will need to some how append without spaces $path and convert EG: $pathconvert however as that can not posibly work you also need to soemhow delimit the variable name in most languages (shell perl etc., don't know PHP) you use ${..} so that should be... "${path}convert ...."

however you can also use "$path/convert ..." as it does not matter if the slash on the end of $path gets doubled or not.

Re: caption is breaking words... ugh

Posted: 2010-09-23T13:02:27-07:00
by immortal26
Hey Magick,

Anything on a new patch for caption yet?
Thanks in advance!

Immortal

Re: caption is breaking words... ugh

Posted: 2010-09-23T16:30:32-07:00
by magick
The patch is available now in ImageMagick 6.6.4-6 Beta. 6.6.4-6 will be released within a few days.

Re: caption is breaking words... ugh

Posted: 2010-09-24T09:53:23-07:00
by immortal26
Hey Magick,

I appreciate all the help, but it seems I stumbled upon another problem with caption.
When trying to use kerning is seems to still wrap in the middle of a word without reducing the pointsize.
I would hope kerning would work... can you reproduce a kerning problem with latest build you released with caption.

Thanks again for the help.

Re: caption is breaking words... ugh

Posted: 2010-09-24T11:15:00-07:00
by magick
Post a caption command that fails. We need to reproduce the problem before we can comment.

Re: caption is breaking words... ugh

Posted: 2010-09-24T11:50:08-07:00
by immortal26

Code: Select all

$final = $path."convert  -font ".$capfont." -kerning 40 -background black -gravity center -fill white -size 1000x500 caption:\"".$text."\" final.png";

Re: caption is breaking words... ugh

Posted: 2010-09-24T12:17:36-07:00
by magick
What is an example text? We tried your command with a some text and the caption appeared ok. Are you using Windows or Linux?

Re: caption is breaking words... ugh

Posted: 2010-09-24T13:41:36-07:00
by fmw42
Just a thought, but perhaps his very large -kerning 40 is putting so much space between characters that IM is having a hard time distinguishing words.

Does this word breaking happen with a small or no kerning?

Re: caption is breaking words... ugh

Posted: 2010-09-26T18:34:38-07:00
by anthony
fmw42 wrote:Just a thought, but perhaps his very large -kerning 40 is putting so much space between characters that IM is having a hard time distinguishing words.

Does this word breaking happen with a small or no kerning?
word delimiting would not depend on kerning which is simply passed to the font rendering library.
All it does is make the words longer, so Im has trouble fitting the words into the specified width.