Open tbrowder opened 9 months ago
I'm considering the use of the HarfBuzz module, which does general purpose shaping including kerning, ligatures and combining characters. It works well on OpenType, although it doesn't seem to handle Type1 fonts.
Sounds like a plan. I did see reference to a ligature substitution method with opentype fonts using FreeType at https://learn.microsoft.com.
Latest PDF::Content (0.8.1) introduces a :shape
option. Latest PDF::Font::Loader (0.8.2) is also needed for non-core fonts.
For core fonts and Type1 fonts, the :shape
option just means discretionary ligature substitution + kerning.
For TrueType and OpenType fonts, HarfBuzz is used to to 'shaping' I.e. font glyph substitution and placement. Ligatures do become a bit more complicated with these font types. They may contain arbitrary discretionary ligatures for pairs of glyphs ( a bit like kerning tables).
I've gone with HarfBuzz as part of a push to better internationalization. For example the shaping rules for Arabic alphabets become more complex. Hopefully this can now been handled.
So, for OpenType fonts, if I use ":shape, :!kern", does the shaping include kerning effects via HarfBuzz?
No, that will disable kerning, but keep other shaping, including ligatures.
So then I can use both :shape and :kern now, true?
I'm experimenting with GNU Freefonts which are OpenType and have kerning and ligatures. When I produce font samples in PDF I use the
:kern
option which works fine, but I don't see any way to automatically use ligatures if they are available.