Skip to content

Conversation

@tikitu
Copy link

@tikitu tikitu commented Jan 24, 2025

This PR does two things:

  • adjusts the SPM package to allow the tests to run under SPM (the change introduces no new failures), and
  • fixes a bug in how rotated text renders in SwiftUI.

Text rotations weren't being applied to the SwiftUI view in quite the same way as in the SVG renderer (the transformation wasn't using the same origin coordinates).

Take the small example SVG:

<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" class="marks"
width="100" height="100" viewBox="0 0 100 100">
<g transform="translate(10,10)">
<rect width="65" height="65" fill="pink"/>
<text text-anchor="start" transform="translate(2,6) rotate(45)" font-family="sans-serif"
font-size="10px" fill="#000" opacity="1">AAAAAAAAAAAA</text>
</g>
</svg>
SVGView before this fix Rendered in your browser Screenshot from SVG viewer Gapplin SVGView after this fix
spec rotated-text rotated-text Screenshot 2025-01-24 at 13 35 03 spec rotated-text

This sets the origin of the rotation to match the SVG's origin
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.

1 participant