photopea / Typr.js

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

Font fallback handling. #53

Closed xmejsieoke closed 1 month ago

xmejsieoke commented 1 month ago

I have subsetted a font, and when a corresponding character is not in the buffer, it does not render. ctx.fillText can display a default character for missing glyphs. For example, my subsetted font does not include the '!' character.
Typr render: image ctx.fillText: image Does Typr.js have a similar fallback mechanism?

photopea commented 1 month ago

When a glyph is not present in a font, shaping returns a glyph index zero. You can draw anything you want instead of these glyphs :)