php-svg icon indicating copy to clipboard operation
php-svg copied to clipboard

text rotate

Open MichalPP opened this issue 5 years ago • 4 comments

would it be possible to add rotation of text?

SVG output was fairly easy with something like setAttribute('transform', 'rotate(-45)'), but PNG output is fairly more complicated.

it would need:

  • add rotate parameter to SVGText
  • "magic" calculation of SVG centre of rotation, so that the centre is identical in SVG output and PHP GD output
  • change the 0 parameter of imagettftext angle in TextRenderer.php

any other glitches I've missed?

MichalPP avatar Jul 10 '20 18:07 MichalPP

some test output of both SVG and PNG here

MichalPP avatar Jul 11 '20 19:07 MichalPP

You're right, this is a much needed feature. But we need to make sure to not limit ourselves to text elements. E.g. #45 tracks rotation of rectangles and #30 tracks (among others) transforms in general.

meyfa avatar Jul 13 '20 13:07 meyfa

the solution does not need to be perfect (no perfect solution was found in three years), we could start with simple text (as was in my PR ). other things (rectangles, ...) can follow later.

MichalPP avatar Apr 06 '23 15:04 MichalPP