Font rendering differs

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
mattias

Font rendering differs

Post by mattias »

I have two machines running the same version of ImageMagick (6.4.1). Development on OS X and production on a FreeBSD.

If I render the same TTF font I get this results:

OS X
Image

FreeBSD
Image

What can cause the FreeBSD one to get so thin and strange? I installed the font with fontconfig and it looks ok if I list the fonts with convert -list font

Any ideas?

/mattias
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Font rendering differs

Post by fmw42 »

I suspect your fonts are not identical or your Ghostscript and Freetype are not the same on your two systms. But this is not my area of expertise
mattias

Re: Font rendering differs

Post by mattias »

It's the same ttf font. And I use FreeType for rendering on FreeBSD. Would ghostscript be a better choise?
mattias

Re: Font rendering differs

Post by mattias »

Is assume that FreeType is used to render the font when the font is a true type font.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Font rendering differs

Post by anthony »

Freetype has caused changes during system updates.
Basically I see IM examples involving drawing text all suddenly
render slightly differently after such an upgrade.

As such freetype differences could cause your problem.


Anothe rposibility is that one of the above examples is using the 'default' font rather than the font requested. This is casue by IM not finding the TTF font file. In some versions of IM the convert command did not output a warning about the requested font not being found so this problem often went unnoticed.

Check that the font really looks different to the same command without a -font setting.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
mattias

Re: Font rendering differs

Post by mattias »

I think I have tried everything - also different fonts and as soon as its a ttf font in sizes under around 16 pt it starts to differ. What I do now instead is render the font in double resolution then scale it down to 50%. This gives a ok result.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Font rendering differs

Post by anthony »

That is probbaly where the major change in freetype was ment to fix. Remember most text being typed to displays are at very low densitys, and thus dot size becomes very important to how good a font rendering engine works. At larger scale this isn't so critical.

however rather than a larger pointsize, try using a larger density, and the use -resample to resize the font, you will probably get much closer to the correct result for that specific point size. The final density of course should match the output device you are using for your image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
mattias

Re: Font rendering differs

Post by mattias »

I did double the density (144x144), same pointsize and then scale to 0.5. I'll try resamle to 72 and see if it does the trick better.

Thanks
mattias

Re: Font rendering differs

Post by mattias »

Resample did it much better. Starts to look really good.

Thanks again
Post Reply