Skip to content

Fix signed fractional CFF coordinates - #556

Closed
Artromskiy wants to merge 1 commit into
SixLabors:mainfrom
Artromskiy:fix-cff-igrunok-outline
Closed

Fix signed fractional CFF coordinates#556
Artromskiy wants to merge 1 commit into
SixLabors:mainfrom
Artromskiy:fix-cff-igrunok-outline

Conversation

@Artromskiy

Copy link
Copy Markdown
Contributor

Problem

CFF Type 2 32-bit numbers are signed 16.16 fixed-point values. In v3.1.0, the fractional word was read as a signed short. Whenever bit 15 of the fractional word was set, the decoded value was one design unit too small. On a CFF glyph this error accumulated across relative curve coordinates and produced visibly incorrect outlines.

The issue was reproduced with glyph 54 (R) from an external Igrunok OTF. The font is not included because its local license does not establish that redistribution in this test repository is permitted. The regression uses the raw Type 2 prefix from that glyph, without distributing the font.

Fix

Read the integer word as signed and the fractional word as unsigned, which is the correct signed 16.16 decomposition.

Tests

  • dotnet build src/SixLabors.Fonts/SixLabors.Fonts.csproj -c Release — passed, 0 warnings/errors.
  • Targeted CffEvaluationEngineTests — 2 passed.
  • External glyph 54 direct renderer probe: 25 commands and 65 points match CoreText/Skia after the expected Y reflection; maximum coordinate difference was 0.00005 px at 280 px/em.

The full test suite was not used as acceptance for this local clone because test fonts were unavailable as LFS objects after a smudge/download timeout.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Artromskiy

Copy link
Copy Markdown
Contributor Author

Closing this PR to recreate it with the corrected Artromskiy commit identity.

@Artromskiy Artromskiy closed this Aug 28, 2026
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.

3 participants