Page 1 of 1
Font rendering problem
Posted: 2012-11-21T10:04:24-07:00
by Douwe
Hi all,
Using Imagemagick's convert (6.7.3-4) on the command line I noticed a difference between the way flash/photoshop renders a font as compared to imagemagick:
Flash/Photoshop:
ImageMagick:
Notice the difference in the way the tekst is spread out like a wave in flash and photoshop, this effect seems ommited by ImageMagick.
I'm using a command generated by a script that boils down to something like this:
Code: Select all
convert -size 222x144 -font myfont text 'bla bla bla'
My question is ofcourse:
Is it possible to achieve the same effect in ImageMagick?
And maybe some insight into what property(s) of a font cause this effect, my knowledge of fonts is basic to say the least, but I'm willing to learn.
Regards,
Douwe
Re: Font rendering problem
Posted: 2012-11-21T11:18:51-07:00
by fmw42
convert -size 222x144 -font myfont text 'bla bla bla'
This is an incomplete command. You need to add something like either caption:"bla bla bla" or PANGO:"bla bla bla". Then you have to tile the result to what final size you want or provide the right number of "bla" in your text line.
If you command is different than above, please post the full command. If possible provide the font or fontname as well. It is hard to tell you what is going on without more details
see
http://www.imagemagick.org/Usage/text/#caption
http://www.imagemagick.org/Usage/text/#pango (note pango delegate must be installed and IM recompiled to use it)
Re: Font rendering problem
Posted: 2012-11-22T02:46:49-07:00
by Douwe
Hi, thanks for your reply.
The complete command would be:
Code: Select all
convert -size 568x376 xc:none -font fontcache/36.ttf -density 72 -pointsize 400.71428571658 -interline-spacing 0 -gravity center -stroke none -fill "black" -draw @tmp/gentext50adea61.mvg tmp/gentext50adea61.png
Where the .mvg that holds the text would contain
Code: Select all
scale 0.1816732673268,0.1816732673268 text +0,+0 'bla bla bla bla
bla bla bla bla
bla bla bla bla
bla bla bla bla'
Using caption or annotate was abandoned because of (if i'm not mistaken, its been a while) very subtle scaling/positioning issues, pango we haven't tried yet. The reason we use the .mvg file for the actual text was because of some obscure weirdness happening with some german and french characters when passed directly to the (ubuntu server) shell.
I'm pretty sure it's something more or less specific to this (type of) font though, as the application this is part of has been running for quite a while now with a limited set of other fonts.
I think this is the font that was used (I had to check with a coworker first):
http://www.dafont.com/earwig-factory.font
On this page it says 'In OpenType savvy applications, letters and numerals are pseudorandomized for a more natural effect.'
This sounds like a clue to me, could it be that ImageMagick the way we use it is not 'OpenType savvy'?
Regards,
Douwe
Re: Font rendering problem
Posted: 2012-11-22T11:58:35-07:00
by fmw42
I get your same results (though the image is the right size). Perhaps -draw is not sophisticated enough to deal with the randomization of the font orientation.
Re: Font rendering problem
Posted: 2012-11-26T05:45:48-07:00
by Douwe
Nor is caption, at least not using this command:
Code: Select all
convert -background lightblue -fill blue -font fontcache/36.ttf -pointsize 36 -size 320x caption:'bla bla bla bla bla bla' tmp/caption.png
Anyone any ideas?
Re: Font rendering problem
Posted: 2012-12-17T22:21:49-07:00
by anthony
Looks more like the density is different. IM uses a default density of 72 dpi, as it has not 'output device'.
Photoshop as a GUI program has a monitor as the output device, and from this it probably picked up a density of something like 90 or 100 dpi.
Thus the different sized font (in pixels, rather than points).
See Text Handling, Pointsize and Density
http://www.imagemagick.org/Usage/text/#pointsize
Re: Font rendering problem
Posted: 2012-12-18T11:33:12-07:00
by fmw42
Anthony,
I think the issue is that the font orientation is not getting randomized, which I suspect IM cannot handle, though am not sure.
Fred