Unify compilation flags to single source of truth#1702
Merged
Conversation
Fixes #1701 After #1700, compilation flags were stored in two places: 1. Context.flags (from CLI) 2. StaticMetadata.args (from source file) This dual-check pattern was error-prone and violated the single source of truth principle. It also polluted the StaticMetadata IR with compilation settings that don't belong in serialized font data. The merge semantics is a simple bitwise OR, i.e. flags are enabled if either CLI or source enables them. Which also means CLI flags must stay false by default for the source to be able to enable them, and CLI flags can't force-disable something that source has enabled. That's ok I think. This commit implements the core infrastructure and Glyphs source support for the flattenComponents filter. UFO/DesignSpace support and other filters will follow.
b2241d4 to
f8efbe4
Compare
Unify handling of the "eraseOpenCorners" ufo2ft filter to follow the same pattern as FLATTEN_COMPONENTS (#1701). in glyphs2fontir, it still defaults to true when no ufo2ft filters are present (the current default); where there are explicit filters in userData, these are now respected. E.g. RubikGlitchPop.glyphs omits eraseOpenCorners filters while defining others, and fontmake/ufo2ft do NOT apply that filter, so we shall not. #1665 (comment)
5c8e63e to
4499baf
Compare
cmyr
approved these changes
Oct 21, 2025
cmyr
left a comment
Member
There was a problem hiding this comment.
Looks good, thanks for cleaning this up!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1701
After #1700, compilation flags were stored in two places:
This dual-check pattern is error-prone and violated the single source of truth principle. It also "polluted" the StaticMetadata IR with compilation settings that don't belong in serialized font data (at least in my opinion).
For the merge semantics I opted for a simple bitwise OR, i.e. flags are enabled if either CLI or source enables them. Which also means CLI flags must stay
falseby default for the source to be able to enable them; and CLI flags can't force-disable something which the source has enabled. That's ok I think.The first commit implements the core infrastructure and Glyphs source support for the flattenComponents filter.
UFO/DesignSpace support and other filters will follow.