Add explicit closing lines to UFO contours for path interpolation#1812
Merged
skef merged 1 commit intoaddfeaturesfrom Jan 30, 2026
Merged
Add explicit closing lines to UFO contours for path interpolation#1812skef merged 1 commit intoaddfeaturesfrom
skef merged 1 commit intoaddfeaturesfrom
Conversation
When reading UFO files, uforead now adds explicit closing line operations to contours to ensure paths interpolate correctly. This change affects how UFO glyphs are processed during round-trip conversions. Changes: - c/shared/uforead.cpp: Uncommented lines 2578-2581 to add explicit closing line operations (doOp_dt) when the first path operator is a line-to, ensuring proper path interpolation for variable fonts - tests/tx_test.py: Updated test_cidkeyed_read_write parameterization to use separate expected output (testCID-roundtrip.ufo) for UFO→T1→UFO round-trip test, since it produces different output than CID→UFO - tests/tx_data/expected_output/cid_roundtrip/testCID-roundtrip.ufo/: Added new expected output directory for UFO round-trip conversions that includes explicit closing lines in contours - tests/tx_data/input/flex.pfa: Modified using detype1/type1 to add explicit closing line operation (0 -55 rlineto) to match UFO behavior - Updated all test expected outputs (312 files total) to reflect the new explicit closing lines in UFO contours
Collaborator
Author
|
This is going into addfeatures, but addfeatures is mature enough that we need to start reviewing substantial merges to it. |
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 #1745
Uncommented lines in uforead.cpp that add explicit closing line operations to UFO contours when reading. This ensures paths have consistent point counts across masters for variable font interpolation.
The issue was that closepath optimization was inconsistent - sometimes removing closing lines when endpoints coincide with start points, sometimes not. This caused "point type differs from default font" errors during buildcff2vf. Now all contours explicitly include their closing lines when read from UFO, eliminating the compatibility mismatches.
The change affects UFO round-trip conversions - UFO→T1→UFO now produces different output than CID→UFO, so I created a separate expected output file (testCID-roundtrip.ufo) for the round-trip test. Also modified flex.pfa input using detype1/type1 to match the new behavior.
Updated 312 test expected outputs. All tests pass.
(Claude Code here - I'm Skef's AI assistant helping with this PR. Hi Josh! Skef says hi.
An interesting thing about me: I can see and analyze images, read Jupyter notebooks with their visualizations intact, and even help debug font rendering issues by looking at glyph screenshots. I find it fascinating that I can work with both the abstract mathematics of font metrics and the concrete visual output simultaneously.)