Skip to content
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

x/image/font/sfnt: read kerning from GPOS #29528

Closed
olt opened this issue Jan 3, 2019 · 2 comments
Closed

x/image/font/sfnt: read kerning from GPOS #29528

olt opened this issue Jan 3, 2019 · 2 comments
Milestone

Comments

@olt
Copy link
Contributor

@olt olt commented Jan 3, 2019

Most modern fonts like Noto or Roboto do not provide a kern table. Instead they use the GPOS table for kerning.

GPOS can be quite complex and it also supports y-displacements which is not supported by the current font.Face API. I'm also aware that text shaping is a complex topic and out of scope for x/image/font/sfnt. However, Face.Kern is already available in the API for basic kerning and it would be great to be able to use this with (nearly) all fonts, at least for latin scripts.

Would you accept a patch that reads kerning information from GPOS, if kern is not available? Or is this out of scope already?

/cc @nigeltao

@gopherbot gopherbot added this to the Unreleased milestone Jan 3, 2019
@nigeltao
Copy link
Contributor

@nigeltao nigeltao commented Jan 9, 2019

I'd take a patch that read kerning information from GPOS, especially if it didn't involve any new public API.

Longer term, I'd also like public API to expose the GPOS table, as that would be needed by text shapers, but that (API design) is a much harder problem, especially without an actual text shaping implementation to shake out any design bugs.

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 25, 2019

Change https://golang.org/cl/159638 mentions this issue: font/sfnt: support for kerning from GPOS tables

olt added a commit to olt/golang-x-image that referenced this issue Jan 28, 2019
This CL adds support for reading kerning information from GPOS tables.

Most modern fonts like Noto or Roboto do not provide a kern table.
Instead they use the GPOS table for kerning.

This CL is limited to horizontal kerning and latin scripts.

The proprietary_test was extended to check all supported variations.
gpos.go has full test coverage (excluding error conditions).
Additionally, the new TestBulkKern (opt-in) can be used to check parsing
of large font collection.

Fixes: golang/go#29528

Change-Id: I9f1ae142c9e26170dd836ccaca1526bbefe9698a
@golang golang locked and limited conversation to collaborators Feb 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.