dfrg / swash

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

AAT ligatures #17

Open mikeday opened 3 years ago

mikeday commented 3 years ago

Hi I'm looking at how ligatures work in the AAT morx table and I note that in fontkit it pushes the ligature glyphs back onto the stack after generating them:

https://github.com/foliojs/fontkit/blob/417af0c79c5664271a07a783574ec7fac7ebad0c/src/aat/AATMorxProcessor.js#L209

This is necessary for the Zapfino font, where the "ffi" ligature is implemented by first generating an "ff" ligature and then using that followed by the "i" to generate the "ffi" ligature, however the second ligature action won't work unless the "ff" is on the stack.

It doesn't seem that swash does this at the moment, although I haven't been able to test it with the Zapfino font yet, is there a simple shaping test program I could try?

dfrg commented 3 years ago

That sounds like entirely reasonable behavior and it is very likely that the AAT code in swash is incorrect here. There's unfortunately nothing simple like hb-shape available yet. The code in the swash_demo repo can be modified to test various combinations of fonts and text runs.

I'll definitely be taking a look at this though. Thanks for bringing it up.