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

Merge names from FEA into final table #1133

Merged
merged 2 commits into from
Nov 20, 2024
Merged

Merge names from FEA into final table #1133

merged 2 commits into from
Nov 20, 2024

Conversation

cmyr
Copy link
Member

@cmyr cmyr commented Nov 19, 2024

Previously we were just dropping them on the floor.

This is one of a number of cases where it is possible for FEA to generate a table that is also generated (or could be generated) through the main compilation process.

This introduces an overall strategy for handling this: when FEA generates these extra tables we now stash them in the main context, where we can reference them when building the final font.

This patch also uses this mechanism to merge name records generated from FEA into the main name table; this looks to get us at least a +7 on crater.

As a bonus this includes a commit that fixes a little bug in ttx_diff where we were accidentally sorting name ids as if they were lookup ids, and which very briefly had me doubting my sanity.

@@ -56,6 +58,8 @@ pub use marks::create_mark_work;

const DFLT_SCRIPT: Tag = Tag::new(b"DFLT");
const DFLT_LANG: Tag = Tag::new(b"dflt");
// https://learn.microsoft.com/en-us/typography/opentype/spec/name#name-ids
const FIRST_NON_RESERVED_NAME_ID: u16 = 256;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I've seen this twice, I suggest putting it in fontdrasil which both fea-rs and fontbe are entitled to reference

fontbe/src/name.rs Outdated Show resolved Hide resolved
fontbe/src/name.rs Outdated Show resolved Hide resolved
fontbe/src/name.rs Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: this would have been nicer as it's own PR

Copy link
Member Author

Choose a reason for hiding this comment

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

As a compromise it's in its own commit 😬

fea-rs/src/compile/output.rs Outdated Show resolved Hide resolved
resources/testdata/WghtVar-Bold.ufo/features.fea Outdated Show resolved Hide resolved
cmyr added 2 commits November 20, 2024 16:04
Previously we were dropping these on the floor.

The strategy here is simple enough: if FEA compilation generates any
extra tables we now stash these in the context, and then we can merge
them (so far, name only) into the final binary at the end.
@cmyr cmyr added this pull request to the merge queue Nov 20, 2024
Merged via the queue into main with commit b073339 Nov 20, 2024
10 checks passed
@cmyr cmyr deleted the gsub-names branch November 20, 2024 21:43
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.

GSUB stylistic set names not being added to name table
3 participants