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 initial implementation of meta compilation #1136

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Hoolean
Copy link
Contributor

@Hoolean Hoolean commented Nov 20, 2024

Hello!

This PR begins implementation of meta table compilation for the Glyphs and UFO formats. This is a larger end-to-end implementation than my previous PRs, and so I am making an early draft to work on it publicly to make sure that it can be shaped from the beginning, and that it stays on track; all feedback and contributions welcome :)

Implemented

  • Full happy path
  • Produces an identical meta table for the top few fontc_crater reports

TODO

  • Confirm semantics of Glyphs custom parameter (Glyphs.app vs glyphsLib)
  • Confirm approach for StateSet construction in glyphs2fontir
  • Make error handling idiomatic to this project (no expect(...), no type conversion clutter, etc)
  • Rebase on main
  • Wait for fontations release that includes Custom types for the meta table fontations#1244
  • Fix lints
  • Fix failing tests
  • Add tests (!)

(most of these are also flagged as inline TODOs, to be resolved before merge)


Will implement #1113

Note: this is a personal contribution independent of my employer, and so I've submitted from a fork under my personal profile and email to make this distinction

This is sufficient to resolve a few ttx table diffs on fontc_crater, but
needs refinement.
This is heavily WIP; it needs a tidy and is untested, and should be
considered an initial draft only.
@Hoolean
Copy link
Contributor Author

Hoolean commented Nov 21, 2024

(rebased on main to adapt for #1131 and to use full fontations release instead of bleeding edge git reference)

.collect(),
))
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like it should be possible to unindent, e.g.

let static_metadata = context.ir.static_metadata.get();
let records = &static_metadata.misc.meta;

// Guard clause: nop if there are no meta records
if records.is_empty() {
  return Ok(());
}

context.meta.set(Meta::new(...));

@@ -130,6 +134,8 @@ impl GlyphsIrSource {
unicode_range_bits: font.unicode_range_bits.clone(),
codepage_range_bits: font.codepage_range_bits.clone(),
panose: font.panose.clone(),
// TODO: Is this correct?
Copy link
Contributor

Choose a reason for hiding this comment

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

looks right at a glance

@@ -182,6 +188,8 @@ impl GlyphsIrSource {
unicode_range_bits: None,
codepage_range_bits: None,
panose: None,
// TODO: Is this correct?
Copy link
Contributor

Choose a reason for hiding this comment

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

looks right, I don't think meta can change global metrics

// TODO: This diverges from glyphsLib, which must convert a list of
// records into UFO's intermediate dict representation; is this
// actually an improvement, or a breaking change? What does Glyphs
// do?
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems like an @anthrotype question

Copy link
Contributor

@rsheeter rsheeter left a comment

Choose a reason for hiding this comment

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

Looks promising!

@cmyr
Copy link
Member

cmyr commented Dec 3, 2024

I'm sorry, I somehow missed this PR and went and impl'd this for glyphs sources in #1160

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