opentype.js icon indicating copy to clipboard operation
opentype.js copied to clipboard

OpenType.js can't read Google fonts' kerning, eg. EB Garamond

Open Typogram opened this issue 3 years ago • 8 comments
trafficstars

Download the ttf from https://fonts.google.com/specimen/EB+Garamond. use it as a test. The fonts have kerning info, and can be used as regular desktop fonts with proper kerning. However, OpenType.js can't read its kerning data. letter AV kerning should be -140, but OpenType.js returns 0

Steps to Reproduce (for bugs)

  1. go to https://codepen.io/wendyz/pen/PoQJyoX?editors=0011
  2. open the console
  3. OpenType.js return AV Kerning to be 0, where it should be -140 image

When I open the EB Garamond font with Robofont, I can see there is kerning info in the kern center. AV kern should be -140 image

Extra info: I download EB Garamond 8pt (another version) from the type designer's Bitbucket repo, and OpenType.js output proper kerning for that font. Included in the codepen example. cc. @davelab6

It may affect other Google Fonts as well, eg.

  • DM Serif Text

Your Environment

  • Version used: 1.3.4
  • Font used: EB Garamond
  • Browser Name and version: Chrome
  • Operating System and version (desktop or mobile): Mac and Windows
  • Link to your project: https://codepen.io/wendyz/pen/PoQJyoX?editors=0011

Typogram avatar May 24 '22 16:05 Typogram

@davelab6 could you provide some insight on this as well? The happens with Google Fonts' version of EB Garamond, but not with the type designer's version of EB Garamond on their bitbucket repo.

Typogram avatar May 24 '22 16:05 Typogram

@fdb @fpirsch could you help take a look into this issue?

Typogram avatar May 26 '22 21:05 Typogram

Could this be related to #546 @ILOVEPIE, or is it something different?

Connum avatar Feb 05 '23 12:02 Connum

@Connum to help narrow down the problem area, maybe this information helps: I tested fontkit to read the same problem font (EB Garamond from Google Fonts), the kerning data can be read correctly. Here is fontkit's code for getting kerning data in below link. I think opentype.js must have missed one of the scenarios that were covered by fontkit: https://github.com/foliojs/fontkit/blob/master/src/layout/KernProcessor.js#L16

Typogram avatar Feb 13 '23 19:02 Typogram

This has already been fixed in the upcoming version.

ILOVEPIE avatar Feb 15 '23 02:02 ILOVEPIE

Nevermind, apparently google has changed their fonts they're hosting.

ILOVEPIE avatar Feb 15 '23 02:02 ILOVEPIE

I suspect #557 will fix this issue.

ILOVEPIE avatar Feb 15 '23 03:02 ILOVEPIE

The issue is the font is missing the old KERN table and has GPOS 9 and 4 entries. This will be fixed by #557.

ILOVEPIE avatar Feb 15 '23 03:02 ILOVEPIE