Font fallback for missing glyphs

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
mad182
Posts: 3
Joined: 2016-12-02T13:12:37-07:00
Authentication code: 1151

Font fallback for missing glyphs

Post by mad182 »

Hello!

I wanted to know, if it's possible to have some kind of fallback mechanism to automatically use a glyph from another font when it's not found in the one currently used (writing text using label:)?

For example, if I'm using Impact font and there is some unicode symbol, like "♥" (u+1f496/💖) in the text, it's displayed as "?"
It's kind of expected, as the Impact.ttf does not contain such symbol, but I know it exists in seguiemj.ttf

So, is there a way to tell imagemagick to look for the glyph in seguiemj.ttf, when it's not found in Impact.ttf?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Font fallback for missing glyphs

Post by Bonzo »

You could make your own font by combining two fonts: http://superuser.com/questions/490922/merging-two-fonts
mad182
Posts: 3
Joined: 2016-12-02T13:12:37-07:00
Authentication code: 1151

Re: Font fallback for missing glyphs

Post by mad182 »

I have quite a lot of them, but I guess if it's possible to automatically merge them, that may work.

Thanks, I will try it out!
mad182
Posts: 3
Joined: 2016-12-02T13:12:37-07:00
Authentication code: 1151

Re: Font fallback for missing glyphs

Post by mad182 »

Seems to be working pretty well.

Image

If anyone else stumbles upon this topic, I used this to merge the fonts:
https://github.com/fonttools/fonttools
Post Reply