Skip to content

Glyphs with ufo filters#1700

Merged
cmyr merged 2 commits into
mainfrom
glyphs-with-ufo-filters
Oct 17, 2025
Merged

Glyphs with ufo filters#1700
cmyr merged 2 commits into
mainfrom
glyphs-with-ufo-filters

Conversation

@cmyr

@cmyr cmyr commented Oct 17, 2025

Copy link
Copy Markdown
Member

cmyr added 2 commits October 17, 2025 15:26
And more specifically the ufo2ft filters key, which fontmake reads and
uses to set some compilation options.
@cmyr cmyr force-pushed the glyphs-with-ufo-filters branch from 2b7f3a6 to b75f95a Compare October 17, 2025 19:26
Comment thread fontir/src/glyph.rs
}

if context.flags.contains(Flags::FLATTEN_COMPONENTS) {
if context.flags.contains(Flags::FLATTEN_COMPONENTS) || source_args.flatten_components {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Having multiple places to store the same flag is a pattern I've been burned by, and seen others be burned by, many times. How might we avoid this? Can we perhaps, maybe in a follow-on, get rid of context.flags and only have fields on static metadata?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yea I think unifying this somehow would make a lot of sense.

@cmyr cmyr added this pull request to the merge queue Oct 17, 2025
Merged via the queue into main with commit c2fb001 Oct 17, 2025
12 checks passed
@cmyr cmyr deleted the glyphs-with-ufo-filters branch October 17, 2025 20:07
/// Miscellaneous font-wide data that didn't seem worthy of top billing
pub misc: MiscMetadata,
/// Additional compilation arguments derived from the source
pub args: SourceArgs,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think we're benefitting very much from an extra struct over direct fields?

I also don't think "source args" is informative, better to describe whats here, which is basically instructions on how to process components?

anthrotype added a commit that referenced this pull request Oct 20, 2025
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.
anthrotype added a commit that referenced this pull request Oct 20, 2025
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.
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.

.glyphs sources converted from DS+UFO with glyphsLib may contain ufo2ft-specific filters in userData

2 participants