Font size question

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
blackgun

Font size question

Post by blackgun »

hi,
I did this:
convert -size 400x70 xc:blue -fill red -font './impact.TTF' -pointsize 70 -gravity center -rotate 0 -annotate +0+0 'Text Cry/^$!' label2.png

Image

It is ok, the text is all in the background.

Then I did this:
convert -size 400x70 xc:blue -fill red -font './MSYH.TTF' -pointsize 70 -gravity center -rotate 0 -annotate +0+0 @utf8cn.txt label1.png
Image

You see, the 'y' is beyond the background. why it happened? does -pointsize control the max height of the font?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Font size question

Post by anthony »

What happened is that the font is badly behaved, and is drawing outside the bounds of the region is says it draws into.
http://imagemagick.org/Usage/text/#overflow
Remember this problem is NOT a bug in IM, but caused by the interaction of the the font library IM uses, and the settings within the font itself, usually on purpose by the font designer. IM just uses the results as they are programmed in the font, which does not always produce what the user intended. Caution is thus advised with unusual fonts.
IM does endeavor to figure out and resize labels to handle such ill-behaved fonts, but it isn't always successful.

Two solutions. Use a better font. Or annotate the text on to a larger canvas, so the font has space to draw.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
blackgun

Re: Font size question

Post by blackgun »

I readed that article, but I can't image it will happened with this Microsoft's font. :(
Thanks anthony.
Post Reply