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

[write-fonts] Add 'PendingVariationIndex' table #544

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

cmyr
Copy link
Member

@cmyr cmyr commented Jul 26, 2023

Per discussion at cmyr/fea-rs#185 (comment), this is adds a new type and a new enum variant that can be used to store the temporary ids assigned to VariationIndex tables during compilation. I quite like this; it simplifies the code in the VarStore builder, and it guarantees we never accidentally write one of these temporary values.


This is intended as a sentinal, which can be assigned a unique ID during compilation, and then remapped to the final VariationIndex values once the ItemVariationStore has been compiled.

This type will panic if we attempt to serialize it, which will ensure that we never accidentally write temporary values to our VariationIndex tables.

Although this is not part of the spec I am generating this in codegen since it's much easier than trying to do it manually; making this work required adding a new attribute, #[write_fonts_only], to communicate to codegen that we should not generate any parsing code for this type (since it is not a real type that should ever exist in an actual font file).

resources/codegen_inputs/layout.rs Outdated Show resolved Hide resolved
resources/codegen_inputs/layout.rs Outdated Show resolved Hide resolved
@cmyr cmyr force-pushed the add-pending-var-index-table branch from 2bcede8 to ab7b01b Compare August 2, 2023 17:25
This is intended as a sentinal, which can be assigned a unique
ID during compilation, and then remapped to the final VariationIndex
values once the ItemVariationStore has been compiled.

This type will panic if we attempt to serialize it, which will ensure
that we never accidentally write temporary values to our VariationIndex
tables.

Although this is not part of the spec I am generating this in codegen
since it's much easier than trying to do it manually; making this work
required adding a new attribute, `#[write_fonts_only]`, to communicate
to codegen that we should not generate any parsing code for this type
(since it is not a real type that should ever exist in an actual font
file).
@cmyr cmyr force-pushed the add-pending-var-index-table branch from ab7b01b to 619583d Compare August 2, 2023 18:59
@cmyr cmyr merged commit 1a0d258 into main Aug 4, 2023
7 checks passed
@cmyr cmyr deleted the add-pending-var-index-table branch August 4, 2023 18:16
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.

3 participants