Unwanted ligatures
See original GitHub issueI want to use a font from fonts.google.com and am running into an issue.
I’ve included the font (Nunito) like so:
const nunitoBoldUrl =
"https://fonts.gstatic.com/s/nunito/v12/XRXW3I6Li01BKofA6sKUYevIWzgPDA.woff2";
const nunitoBoldFontBytes = await fetch(nunitoBoldUrl).then((res) => res.arrayBuffer());
const nunitoBold = await pdfDoc.embedFont(nunitoBoldFontBytes);
This works, with one exception (there might be more, but this is what I could find):
Printing fi adds unwanted spacing after it which shouldn’t be there, the Google preview also doesn’t show it.
fi ir fir:

I think the font has a special ligature for fi, if I install the font on my system I get the same connected f and i letters, but without the spacing. Is this an issue with pdf-kit or fontkit?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:6 (2 by maintainers)
Top Results From Across the Web
The selfless butterfly. Or: Using and avoiding ligatures.
And it does seem responsible for designers to insure that pairings still work well if ligatures are unwanted. 1. Ray Larabie Posts: ...
Read more >Xelatex beamer Calibri: how to suppress unwanted ligatures ...
I would like to use Calibri with the beamer class but I get very strange merges of the terminal letters with a vertical...
Read more >Ligatures and CSS - Cloud 66 Blog
Modern browsers have good support for the font-variant-ligatures CSS3 property. Read our tips on how to disable unwanted ligatures for a ...
Read more >Unnecessary Ligatures
🦇 18+ only! 🦇 Queer-focused 🦇 Opt-in NSFW and Dead Dove channels 🦇 Plenty of space for Battworth, Riddlebat, Batgordon, Batcat, Batjokes, and...
Read more >FOP 1.1: Unwanted Ligatures in Latin Scripts
FOP 1.1: Unwanted Ligatures in Latin Scripts. Ulrich Mayring. 10 years ago. Permalink. Hi all, I just upgraded from 0.95 to 1.1 and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Version
1.14.0includes an API that can disable font ligatures (thanks to @hefler!): https://github.com/Hopding/pdf-lib/blob/c9577682b6176ead2bf5167418702db987e15b45/apps/node/tests/test6.ts#L37-L40Hello @zimt28 @fobdy! As far as I’m aware this is an issue with
fontkit, though I haven’t been able to confirm this. If anybody is interested, it is possible to disable ligatures when performing text layout withfontkit(as @fobdy mentioned). You would just need to update the API to pass options here: https://github.com/Hopding/pdf-lib/blob/193e48ff2ce07d72f8191087adcdd01aa3c48a62/src/core/embedders/CustomFontEmbedder.ts#L52-L57I’d be happy to accept a PR if anybody is interested in working on this.