-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kerning is applied two times #196
Comments
Interesting. Is it always exactly doubled from what it should be? Here's what Typr does: https://github.com/fredli74/Typr.ts/blob/master/src/Typr.U.js#L153 If we can identify it as a bug there then I'd much prefer to have it fixed upstream. |
It seems like this change broke it. @fredli74 sums the 'GPOS' offset and the 'kern' offset. I don't have that much know how about font files, https://docs.microsoft.com/en-us/typography/opentype/spec/gpos |
Hmm, I'm not sure that explains it -- the copy of Calibri.ttf I found doesn't appear to contain a |
OK, nevermind, I see now that it does have a GPOS table with kern features in it, I'm not sure why that wasn't showing up in the tool I was using before. I wonder why this font includes both, that seems very inefficient? Anyway, it seems like an easy fix to only use one and ignore the other. Would you be up for submitting a PR to fredli74's repo? |
@TimmyTommy I've released 0.46.3 with the updated Typr, can you please verify and close? Thanks! |
Hello,
Thank you for this amazing library!
Unfortunately I found a bug with the kerning of texts.
It's probably a bug in the Typr.js/Typr.ts version you are using.
In FontParser.js the line with Typr.U.getPairAdjustment returns the double amount of kerning offset.
I changed
glyphX += Typr.U.getPairAdjustment(typrFont, prevGlyphIndex, glyphIndex) * fontScale
to
glyphX += Typr.U.getPairAdjustment(typrFont, prevGlyphIndex, glyphIndex) / 2 * fontScale
which fixed the Problem.
troika/packages/troika-three-text/src/FontParser.js
Line 223 in bf68d74
Here is a screenshot of before and after. The top one is wrong. The 'T' and the 'e' should not be that close to each other.
The font I used is Calibri.
The text was updated successfully, but these errors were encountered: