Page 1 of 1

Problem caption outside of area

Posted: 2012-12-29T04:50:34-07:00
by badabou
Hello,

I have a problem with a text that exceeds the defined area for the caption.

Here is the command :

Code: Select all

convert -background black -fill "#ffffff" -gravity Center -font "one-stroke-script.ttf" -size 460x70 caption:"Quem Sai" result.png
The font is here: http://depositfiles.com/files/ab0vp3bio

And here is the result :

Image

One can clearly see that the letters are cut up.
How can I solve this problem ?

Thank's

Re: Problem caption outside of area

Posted: 2012-12-29T07:14:12-07:00
by magick
Caption is partially data driven based on the font metrics. This font has a large descender metric which suggests one or more characters are rendered well below the baseline. Caption centers based on the sum of the ascent and descent which works well for almost all fonts. This exception would benefit from centering based on the trimmed descent of the characters. However, that is problematic if you want to render two different captions with the same font and try to align them side-by-side. We will look into correcting the algorithm so it does not cut off the top of the Q. In the mean-time you will either need to manually position the text or use the Pango layout engine @ http://www.imagemagick.org/Usage/text/#pango, or use a different font.

Re: Problem caption outside of area

Posted: 2015-02-15T05:10:58-07:00
by badabou
Hi,

I come to you as to whether you'll soon fix this bug?

I have the latest version of Imagemagick 6.9.0 and I still have this problem.

Thank you

Re: Problem caption outside of area

Posted: 2015-02-17T20:49:22-07:00
by badabou
Here is another example with the font ChopinScript.otf and Imagemagick 6.9.0-5 :

Image

Code: Select all

convert -background black -fill "#ffffff" -gravity Center -font "ChopinScript.otf" -size 460x70 caption:"A test with other font" result.png
Please, can you give me a date, even approximate, to correct this bug?

Thank you

Re: Problem caption outside of area

Posted: 2015-02-17T21:59:38-07:00
by fmw42
Perhaps the font metrics on that font are incorrect. That could cause the problem.

Try putting the -size argument at the beginning, though it may not make a difference.

convert -size 460x70 -background black -fill "#ffffff" -gravity Center -font "ChopinScript.otf" caption:"A test with other font" result.png

Since you are not wrapping the text to multiple lines try label: rather than caption:

Re: Problem caption outside of area

Posted: 2015-02-17T22:05:06-07:00
by fmw42
Seems to fit and not get chopped off for me if I use -gravity west. Also label: works fine with gravity center and centers properly.

Code: Select all

convert -size 460x70 -background black -fill "#ffffff" -gravity west \
-font /Library/Fonts/ChopinScript.otf caption:"A test with other font" result1.png

Code: Select all

convert -size 460x70 -background black -fill "#ffffff" -gravity center \
-font /Library/Fonts/ChopinScript.otf label:"A test with other font" result2.png
So it could be a problem with caption: vs label: centering

Re: Problem caption outside of area

Posted: 2015-02-18T04:04:53-07:00
by badabou
That's exactly right, Fred.

This demonstrates that this is a bug in Imagemagick. It would not be a bug in the font metrics.

I hope there will soon be a bug fix.

Re: Problem caption outside of area

Posted: 2015-02-22T00:29:26-07:00
by badabou
I downloaded the new Version 6.9.0-7 but the problem is still present.

Yet there indicated in the changelog that the problem is corrected : http://www.imagemagick.org/script/changelog.php
2015-02-15 6.9.0-7 Cristy <quetzlzacatenango@image...>
Line strokes appeared too thin (reference viewtopic.php?f=3&t=26927).
Keep text in caption area (reference viewtopic.php?f=3&t=22504).

Re: Problem caption outside of area

Posted: 2015-02-22T12:38:49-07:00
by fmw42
The thin lines are fixed. I do not know about the other issue.

Re: Problem caption outside of area

Posted: 2015-02-22T12:56:19-07:00
by badabou
Yes Fred. The lines bug from this topic report are fixed : viewtopic.php?f=3&t=27067

But for the caption area problem, the bug are not fixed. For test just compare label and caption with center gravity with ChopinScript font.

Re: Problem caption outside of area

Posted: 2015-02-22T13:50:08-07:00
by fmw42
I believe you. I just am not involved in that bug or fix. The IM developer will need to check it.

Re: Problem caption outside of area

Posted: 2015-02-24T04:01:47-07:00
by badabou
- The first problem is however very easy to reproduce :

CAPTION:

Code: Select all

convert -background black -fill "#ffffff" -gravity Center -font "ChopinScript.otf" -size 460x70 caption:"A test with other font" out-with-caption.png
Image

LABEL:

Code: Select all

convert -background black -fill "#ffffff" -gravity Center -font "ChopinScript.otf" -size 460x70 label:"A test with other font" out-with-label.png
Image

- The second problem is that there are overflow with some fonts. You can see this bug with the "f" out of the box.

All result with ImageMagick-6.9.0-7.