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

[codegen] support optional fields with different conditions #577

Open
cmyr opened this issue Aug 16, 2023 · 2 comments
Open

[codegen] support optional fields with different conditions #577

cmyr opened this issue Aug 16, 2023 · 2 comments
Labels

Comments

@cmyr
Copy link
Member

cmyr commented Aug 16, 2023

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 #576 (comment)

@dfrg
Copy link
Member

dfrg commented Aug 18, 2023

This also applies to CFF INDEX objects. If the size is zero, the remaining fields are elided. Like lookups, we’re currently betting that these don’t exist at the end of a table, otherwise we’ll fail to parse.

@cmyr cmyr added the codegen label Dec 1, 2023
@cmyr
Copy link
Member Author

cmyr commented Jun 11, 2024

support for fields conditional on a flag is added in #937

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

No branches or pull requests

2 participants