photopea / Typr.js

Typr.js - process fonts in Javascript
MIT License
914 stars 73 forks source link

Missing glyphs (.notdef) #15

Closed guillem-catala closed 6 years ago

guillem-catala commented 6 years ago

Hi I love this library! I have a question, is there any way to know if a glyph is missing? Some fonts have chars that are not designed and are usually represented by an square or empty space.

photopea commented 6 years ago

There is an agreement, that when some glyph is not defined, the font should map it to the glyph zero (which is usually a square).

So you can call Typr.U.codeToGlyph(font, charCode), and if it returns zero, the glyph is missing.