Problem caption outside of area

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
badabou
Posts: 54
Joined: 2008-06-23T06:12:24-07:00

Problem caption outside of area

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problem caption outside of area

Post 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.
badabou
Posts: 54
Joined: 2008-06-23T06:12:24-07:00

Re: Problem caption outside of area

Post 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
badabou
Posts: 54
Joined: 2008-06-23T06:12:24-07:00

Re: Problem caption outside of area

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem caption outside of area

Post 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:
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem caption outside of area

Post 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
badabou
Posts: 54
Joined: 2008-06-23T06:12:24-07:00

Re: Problem caption outside of area

Post 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.
badabou
Posts: 54
Joined: 2008-06-23T06:12:24-07:00

Re: Problem caption outside of area

Post 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).
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem caption outside of area

Post by fmw42 »

The thin lines are fixed. I do not know about the other issue.
badabou
Posts: 54
Joined: 2008-06-23T06:12:24-07:00

Re: Problem caption outside of area

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem caption outside of area

Post by fmw42 »

I believe you. I just am not involved in that bug or fix. The IM developer will need to check it.
badabou
Posts: 54
Joined: 2008-06-23T06:12:24-07:00

Re: Problem caption outside of area

Post 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.
Post Reply