dfrg / swash

Font introspection, complex text shaping and glyph rendering.
Apache License 2.0
657 stars 38 forks source link

CharMap does not include substitutions #39

Open tim-harding opened 1 year ago

tim-harding commented 1 year ago

I would like to be able to cache glyphs in a font atlas at startup. The issue that I am running into is that ligature glyph IDs and other substitutions are not included in the charmap, so those characters would need to cached lazily during shaping because I cannot enumerate them upfront. Is there an easy way to enumerate the contents of the GLYF and CFF tables instead? It seems that the parsers for them are well-established but only set up to access entries by glyph ID on demand.

As a side note, navigating this codebase over the last few hours to see if I could do it myself has given me a new appreciation for how complex font handling is 🙃. Hats off to you.