Skip to content

Unify compilation flags to single source of truth#1702

Merged
anthrotype merged 3 commits into
mainfrom
unify-flags
Oct 21, 2025
Merged

Unify compilation flags to single source of truth#1702
anthrotype merged 3 commits into
mainfrom
unify-flags

Conversation

@anthrotype

@anthrotype anthrotype commented Oct 20, 2025

Copy link
Copy Markdown
Member

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 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 false by 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.

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.
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)

@cmyr cmyr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, thanks for cleaning this up!

@anthrotype anthrotype added this pull request to the merge queue Oct 21, 2025
Merged via the queue into main with commit 18ad1c9 Oct 21, 2025
12 checks passed
@anthrotype anthrotype deleted the unify-flags branch October 21, 2025 14:42
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.

unify flags (from CLI or specified in source)

2 participants