Fix signed fractional CFF coordinates - #557
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request fixes parsing of CFF Type 2 signed 16.16 fixed-point coordinates by treating the integer word as signed and the fractional word as unsigned, correcting outline coordinates for affected fonts (eg. Igrunok) without changing the public API.
Changes:
- Update
SimpleBinaryReader.ReadFloatFixed1616()to interpret the fractional 16-bit word as unsigned. - Add regression tests covering fixed-point decoding and a raw charstring prefix reproducer for glyph 54 coordinate stability.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/SixLabors.Fonts.Tests/Tables/Cff/CffEvaluationEngineTests.cs | Adds a fixed-point reader test and a raw Type 2 prefix regression test for CFF coordinate evaluation. |
| src/SixLabors.Fonts/Tables/Cff/SimpleBinaryReader.cs | Corrects 16.16 fixed-point parsing to use an unsigned fractional word. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #557 +/- ##
=====================================
Coverage 81% 81%
=====================================
Files 406 406
Lines 35672 35672
Branches 5561 5561
=====================================
+ Hits 29143 29147 +4
+ Misses 5359 5356 -3
+ Partials 1170 1169 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Are there any updates on this pull request? |
JimBobSquarePants
left a comment
There was a problem hiding this comment.
@Artromskiy Thank you for the fix. this is very much appreciated.
I'll merge it now ready for the next release. A nightly package will be published following merge.
Prerequisites
Description
Fix CFF Type 2 signed 16.16 parsing: the integer word is signed, while the fractional word is unsigned. This corrects the CFF outline coordinates produced for fonts such as Igrunok.
The change includes a raw glyph 54 regression test and a fixed-point reader test. The Igrunok font itself is not redistributed.
Validation performed:
The first renderable CFF implementation already showed the mismatch; the fix corrects the fractional-word interpretation without changing the public API.