Skip to content

End CFF hflex and hflex1 curves at the starting y - #438

Merged
blikblum merged 1 commit into
foliojs:masterfrom
RClaudiuM:fix-cff-hflex-437
Nov 8, 2026
Merged

blikblum merged 1 commit into
foliojs:masterfrom
RClaudiuM:fix-cff-hflex-437

Conversation

@RClaudiuM

Copy link
Copy Markdown
Contributor

Fixes #437

hflex and hflex1 charstring operators left the second curve at the raised y instead of returning to the starting y (Adobe TN #5177). Every point after such a flex was shifted by the flex's dy, giving steps or misplaced contours.

  • hflex: c5y is now the starting y (dx5, -dy2), so the curve ends where it started.
  • hflex1: dy6 is implied, so c6y is the starting y.

Regression test in test/issues.js: PlayfairDisplay glyph 33 has a contour ending in an hflex-style curve, which must end at its starting point.

Validation:

  • npx mocha test/issues.js on the build without the fix: 1 failing (0 !== 1); with the fix: 48 passing.
  • npm test: 770 passing, 7 pending.
  • npm run format:check: clean.

@blikblum
blikblum merged commit b956fbb into foliojs:master Nov 8, 2026
3 checks passed
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.

CFF hflex and hflex1: second curve doesn't return to the starting y

2 participants