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

Add write support for GPOS type 2 lookups (kerning) #743

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Balearica
Copy link
Contributor

Description

This PR adds write support for GPOS type 2 lookups (kerning).

  • For fonts that have a GPOS table, that GPOS table is now written to the output font.
    • Currently only kerning tables are supported--the others are dropped.
  • For fonts that do not have a GPOS table, but do have a kern table (so the kerningPairs property is populated), the kerningPairs property is converted into a GPOS table and written to the output.
    • This method can also be used for easily implementing pair kerning in custom fonts.

Motivation and Context

This feature has been requested by many users over the years. See #95 and #547, among others.

How Has This Been Tested?

  • Tests implement the examples on the Microsoft typography website, and confirm the results match what is documented there.
  • A test confirms that a font that contains both format 1 and format 2 type 2 lookups can be saved and parsed without changing the contents of the gpos table.
  • A test confirms that data from the kern table is properly converted into a gpos table.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I did npm run test and all tests passed green (including code styling checks).
  • I have added tests to cover my changes.
  • My change requires a change to the documentation.
  • I have updated the README accordingly.
  • I have read the Contribute README section.

@Connum Connum force-pushed the kern-write-support branch from f8403d7 to be6a82b Compare July 30, 2024 08:07
@Connum Connum added font features Spec Related to the implementation of the Opentype specification labels Jul 30, 2024
@Connum Connum added this to the Release 2.0.0 milestone Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
font features Spec Related to the implementation of the Opentype specification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants