[varLib.cff] Suboptimal packing of deltas, or flaw in CFF2?
See original GitHub issueWith a CFF2 VF built from the attached designspace project (modified from MutatorSans), the S
rendered at wdth=1000
, wght=595
has a bump on the right hand side, even though its corresponding source does not:
The bump is at the start/end point of the contour.
The design space has five sources, one on each corner, and a support master between Light Wide and Bold Wide.
Light Medium Bold
Wide Wide Wide
o--------o--------o
| |
| |
| |
| |
| |
| |
O-----------------o
Light Bold
Condensed Condensed
(neutral)
The Medium Wide source is at the location shown (wdth=1000
, wght=595
)
What I think happens is:
- The delta for that location is relative to the interpolation between Light Wide and Bold Wide
- This interpolation has fractional coordinates
- The delta’s are calculated for relative coordinates (the differences between one point and the next), rounded to integers
- Leading to an accumulation of rounding errors
- To the extent that the final point is no longer coinciding with the starting point.
- (The difference between start and end point is ≈3 units horizontally, and ≈1.5 units vertically.)
On the one hand, in theory the varLib CFF2 packer could do a better job, but looking at the code this seems far from trivial. On the other hand this shows that CFF2 has pretty terrible properties for cases like this.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Releases · fonttools/fonttools - GitHub
[varLib.cff] Fixed sub-optimal packing of CFF2 deltas by no longer rounding them to integer (#2838). [scaleUpem] Calculate numShorts in VarData after scale; ...
Read more >Virtual - pkgsrc.se | The NetBSD package collection
... [varLib.cff] Fixed sub-optimal packing of CFF2 deltas by no longer rounding them to integer - [scaleUpem] Calculate numShorts in VarData after scale; ......
Read more >ChangeLog.openSUSE-Leap-15.3-DVD-x86_64 ... - Index of /
The precision of handling deltas in Variation Fonts has been - increased.The problem did only show up with multidimensional - designspaces.
Read more >FontTools fonttools Issues - Giters
[ttx] Non-ascii in CFF FullName string doesn't round-trip. Updated 21 days ago 10 ... [varLib.cff] Suboptimal packing of deltas, or flaw in CFF2?...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It does move, but because of the accumulated error over all relative coordinates + deltas, the end point doesn’t always move the exact same distance as the start point. Which is what we’re seeing here.
I just fixed a bug with fractional CFF coordinates in LibreOffice subsetter the other day, which suggests they work fine elsewhere.