Skip to content

Add ExtractAllGlyphConditions()#204

Merged
garretrieger merged 4 commits intow3c:mainfrom
garretrieger:true_conditions
Apr 8, 2026
Merged

Add ExtractAllGlyphConditions()#204
garretrieger merged 4 commits intow3c:mainfrom
garretrieger:true_conditions

Conversation

@garretrieger
Copy link
Copy Markdown
Contributor

This extracts (according to the dependency graph) the full boolean conditions for each glyph in a font. Boolean conditions are represented in conjunctive normal form. Because this is dep graph based, may be a superset of the true subset closure conditions.

High level algorithm:

  • Generate a topological sorting of the dep graph.
  • Generate a list of incoming edge conditions (in terms of nodes) for each node.
  • Working in topological order for each node form it's conditions by combining the incoming edge conditions with final node conditions for all parent nodes (topological order guarantees these are all fully formed).

The final boolean expressions are represented in conjunctive normal form in terms of segment presence (ActivationCondition). Unlike prior approaches which are limited to finding purely conjunctive/disjunctive expressions this can pull out arbitrary composite conditions.

This is not yet hooked up or used by anything, but should be able to replace the other dep graph based approaches to condition finding (DependencyClosure::AnalyzeSegment).

Note: this implementation does not yet respect closure phases, that is planned to be added next.

Allows topological sort to also sort with respect to contextual lookup context sets.
This extracts (according to the dependency graph) the full boolean conditions for each glyph in a font. Boolean conditions are represented in conjunctive normal form. Because this is dep graph based, may be a superset of the true subset closure conditions.

Note: this implementation does not yet respect closure phases, that is planned to be added next.
@garretrieger garretrieger merged commit c82db2c into w3c:main Apr 8, 2026
3 checks passed
@garretrieger garretrieger deleted the true_conditions branch April 9, 2026 16: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.

1 participant