googlefonts / googlefonts/fontations

[codegen] support optional fields with different conditions

Open
#577 2 comments 0 reactions 0 assignees View on GitHub
codegen
Dominant language
Rust
Stars
826
Forks
75
Avg merge
22h 33m
Merged PRs (30d)
75

Description

Currently the mechanism we use to support optional fields only supports versions, and assumes that a higher version of a table always contains all the fields of previous versions.

This breaks with post, where 3.0 has fewer fields than 2.0. In addition, there have been a few other instances where we have something like this; for instance in lookup subtables, the `markFilteringSet` exists conditionally on the appropriate bit being set in the lookup flags.

Overall this would give us more flexibility in codegen, and save us hand-writing code.

> That's actually an interesting complication for codegen, this is the first time where we will have a lower version of a table (2.0) that has more fields than a higher version (3.0). We make a bunch of assumptions about fields only being added with versions, so I'll have to think about this some.

_Originally posted by @cmyr in https://github.com/googlefonts/fontations/issues/576#issuecomment-1680955670_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.