Skip to content

Rotatable text #1588

@hollandjake

Description

@hollandjake

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions