Skip to content

Implement support for optional layout feature segmentation and encoding. #129

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

Merged
merged 18 commits into from
Jun 9, 2025

Conversation

garretrieger
Copy link
Contributor

Adds support throughout:

  • Closure glyph segmenter
  • Encoder
  • Updated encoder config proto to allow specifying conditions involving features.

@garretrieger garretrieger force-pushed the feature_segmentation branch from 34ec9c3 to dca8a9e Compare June 9, 2025 19:02
@skef
Copy link
Contributor

skef commented Jun 9, 2025

I looked through this informally before the rebase a few minutes ago and it all looks like good progress to me.

A segment includes a codepoint and feature tag set.
These two classes were representing identical concepts, standardize on SubsetDefinition.
These two classes encode the same information.
Closure analysis subtracts other segments from the init font segment which do not include gids.
See: https://github.com/w3c/ift-encoder/blob/main/docs/experimental/closure_glyph_segmentation.md

The 'except' segment is defined as the union of all other segments except for the one being analyzed. As a short cut we were computing it by subtracting the segment of interest from the union of all segments. However, this is not correct when there are overlaps between segments as subtraction may remove the overlapping parts from the except segment. Change to computing the except segment as defined in the design doc.

Adds tests for cases that run into this issue.
It's not seeing high hit rates, and the underlying glyph closure cache will already cache the expensive part of the operation.
Since we are getting the list of segment ids we can assemble the complete segment ourselves.
In the absence of a cost function to prevent these cases this heuristic is used to keep optional feature segments as separate patches.
@garretrieger garretrieger force-pushed the feature_segmentation branch from dca8a9e to 42e4498 Compare June 9, 2025 19:18
@garretrieger garretrieger merged commit 799251e into w3c:main Jun 9, 2025
3 checks passed
@garretrieger garretrieger deleted the feature_segmentation branch June 10, 2025 21:11
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.

2 participants