fix: correct PDF y-axis transform - #2
Merged
Conversation
This was referenced Aug 10, 2026
kolkov
approved these changes
Aug 11, 2026
kolkov
left a comment
Contributor
There was a problem hiding this comment.
Correct fix. Transform.Then applies the receiver first, so Translate(0, h).Then(Scale(1, -1)) was producing y' = -(y + h) instead of the intended y' = h - y. Scale(1, -1).Then(Translate(0, h)) gives the right top-left → bottom-left mapping.
Both Backend.Begin and Document.NewPage fixed consistently. Tests assert the exact composed transform — good regression coverage.
LGTM, merging.
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
4 tasks
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.
Summary
Backend.BeginandDocument.NewPage(0, 0) → (0, height)and(0, height) → (0, 0)Why
Transform.Thenapplies the receiver before the next transform. Translating before the negative Y scale producedy' = -height - y, placing gg coordinates below the page. Scaling first and translating second produces the intendedy' = height - y.Verification
go test ./... -count=1go test -race ./... -count=1go build ./...go vet ./...gofmtandgit diff --checkUpstream GitHub Actions and
codecov/patchare configured but await maintainer approval of the fork workflow run.