question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unwanted ligatures

See original GitHub issue

I 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: Screenshot 2020-06-15 at 21 05 12

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:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Hopdingcommented, Dec 21, 2020
0reactions
Hopdingcommented, Sep 26, 2020

Hello @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 with fontkit (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-L57

I’d be happy to accept a PR if anybody is interested in working on this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The self‌less 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found