Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotatable text #1588

Closed
hollandjake opened this issue Jan 14, 2025 · 1 comment · Fixed by #1589
Closed

Rotatable text #1588

hollandjake opened this issue Jan 14, 2025 · 1 comment · Fixed by #1589

Comments

@hollandjake
Copy link
Contributor

hollandjake commented Jan 14, 2025

Feature Request

Enable text to be rotated

Feature description

Normally PDF text origin is the bottom-left of the text, however due to the coordinate system flip, it is now the top-left.

Questions:

Q: When rotating text where should the origin of rotation be?

  • At point of usual render (top-left)

Q: Which direction should rotation be in (in PDF spec it states that rotation occurs anti-clockwise)

  • anti-clockwise

Q: Do we reposition text so that it does not go above the origin (i.e. move the text down so the minY = text.options.y)

  • No (we expose the transformation in the boundsOfString method which outputs the resultant x,y coords for the rendered text bounding box)

Q: Units of rotation
-Degrees

Once the questions are answered ill sort a PR out


Example implementation i've done

  • Blue dot is the text position
  • Note it does work at any angle just using increments of 45 here for clarity
    image
@hollandjake
Copy link
Contributor Author

This could also bring in the code from boundsOfString with modification to support rotated text.

image

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 a pull request may close this issue.

1 participant