I've been using PDFBox instead of iText 7 for a few days now, and it's given me a bunch of new freedoms, but the main reason I changed was so I could enable ligatures in my PDF documents (for free).
I've already managed to enable oldstyle numerals and the likes (though the constant warning messages are starting to get on my nerves), but the liga
feature doesn't seem to work (which was probably just getting my hopes up a little too high). I've tested the code below with a variety of fonts, including Minion Pro, EB Garamond and Alegreya.
TrueTypeFont font = new TTFParser().parse(file);
font.enableGsubFeature("onum"); // complains, but works: "WARNING: Trying to un-substitute a never-before-seen gid: ..."
font.enableGsubFeature("liga"); // has no effect
return PDType0Font.load(doc, font, false);
So instead, I've decided it'd be enough for me to just get access to e.g. a list of the font's supported ligatures and their mappings (probably to the Private Use Area), so I can just substitute ligatures manually (not caring about toUnicode
for the moment). Problem is, I can't seem to find a way of doing that. Any ideas? (also for other approaches, this just currently seems to me the most likely one to work)
I'd say this isn't a duplicate of pdfbox - How to join glyphs into ligatures in rendered pdf, as the person there asked for built-in support, whereas I'm attempting to manually apply ligatures using FontBox.