nprapps/lunchbox

Issue with "fi" ligature in HTML2Canvas

Closed this issue · 8 comments

One of our producers noted that fi combo would result in the i being dropped. After some experimentation I discovered that the one-liner font-feature-settings: "liga" 0; in the CSS for the Quotable blockquote element fixed the issue. For consideration, I'll put together a pull request too.

quote-finally-weve-fixed-it

eads commented

Whoa!

ghing commented

Same.
quote-police-who-are-not-fit__square

eads commented

@TylerFisher @jjelosua can one of you take a look into this?

I'll take a look at @davisshaver's PR.

Hm. I wonder if Gotham just doesn't have that ligature? What fonts are y'all using @davisshaver @ghing?

ghing commented

@TylerFisher I think I was just using whatever font is the default. I think the only thing I overwrote in the CSS was the background color and logo image.

Cool, replicated and merged @davisshaver's PR. Works great.

I solve this problem using a condition to check if the word has "fi" in the html2canvas.js
textList = ((!options.letterRendering && /^(left|right|justify|auto)$/.test(textAlign) && noLetterSpacing(getCSS(el, "letterSpacing"))) || (textNode.nodeValue.indexOf("fi") !== -1) ) ?