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 writing support for lookup type 6, formats 1 and 3 #453

Merged
merged 18 commits into from
Nov 8, 2020

Conversation

Connum
Copy link
Contributor

@Connum Connum commented Nov 8, 2020

Description

This allows to write fonts containing tables of lookup type 6, in formats 1 and 3.

Motivation and Context

Fonts containing such tables would simply fail when writing. Lookup type 6 is needed for the Chaining Contextual Substitution feature.

I originally planned to implement all three formats for this type, but this PR now only implements format 1 and 3 and will still throw a descriptive error when encountering format 2, for the following reasons:

  1. The class based lookups seem to be more complex than the others, and I'm not quite sure yet whether we have everything ready in terms of data types for writing these (but I also didn't have the time to look into this further)
  2. I didn't find a font file containing a table with format 6, type 2 to test this with and given the complexity, I didn't want to take this on based on the specs alone
  3. I ran out of time due to work projects

If anyone can provide a font using format 6, type 2, I would be happy to look into this and implement it, if and when my free time allows. I would also be interested in implementing all other missing types (5, 7 and 8) in order to complete the writing functionality of the library.

How Has This Been Tested?

I added test cases for writing both formats according to the specs. I also loaded and saved several font files containing such tables, checking that they contained the corresponding tables afterwards.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue) - fixes Unable to write GSUB lookup type 6 tables. #309
  • 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 CONTRIBUTING document.

Copy link
Member

@Jolg42 Jolg42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! 💯

@Jolg42 Jolg42 merged commit 88f7c17 into opentypejs:master Nov 8, 2020
@Connum Connum deleted the add-lookup-type-6 branch November 8, 2020 20:55
@calebmer
Copy link

calebmer commented Jul 8, 2024

If anyone can provide a font using format 6, type 2, I would be happy to look into this and implement it

Inter contains format 6, type 2. I ran into the error "lookup type 6 format 2 is not yet supported" when trying to modify Inter.

https://rsms.me/inter/

@spaceemotion
Copy link

@calebmer if it's of any help, I found that the 3.0 release of Inter works with this library. Seems like the format 2 thing has been introduced within that release cycle.

@calebmer
Copy link

Oh thanks! I ended up using Python's fonttools ttx for the modification I needed to make.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to write GSUB lookup type 6 tables.
4 participants