0

I use icomoon.io to create and manage my icon fonts. It's excellent and you can set "ligatures" for the text you want to display the icon.

However, I cannot find a sane way to handle missing ligatures to display a default or "missing" icon.

One insane way was I created an icon component and check the text against an array of ligatures. But this would mean that I must maintain the array to match the icons in my font.

everyDangLigature = ['star', 'arrow-up', ...]

iconText = everyDangLigature.includes(str) ? str : 'missing';

IcoMoon wrote me back with

...if you parse the CMAP table of the font, you could check if a glyph exists by its code point.

Also asked the opentypejs group.

How does one go about parsing the CMAP table of the font?

Is there another way to elegantly handle missing ligatures in our icon fonts?

Ben Racicot
  • 5,332
  • 12
  • 66
  • 130

0 Answers0