A
Austin Ziegler
Well, things have just gotten ... interesting. In response to a
user's request, I'm looking at possibly doing SVG-to-PDF vector
transformations with PDF::Writer. In looking over the existing code,
I realised that there's some bugs in the axis transformation code
related to how rotation and skewing is done. The skewing is
completely wrong. The rotation is also completely wrong, but it's a
much more subtle issue.
See, I have the transformation *backwards* in the text rotation.
Without going into much detail as to *why*, rotation code is
supposed to be on a vector of:
[ cos(a) sin(a) -sin(a) cos(a) 0 0 ]
The *text* rotation code, on the other hand, is:
[ cos(a) -sin(a) sin(a) cos(a) 0 0 ]
This inversion *reverses* the direction of the angle.
Consider an analog clock. In both systems, zero degrees is at the
three o'clock position. Under the current text rotation, 90 degrees
is at the six o'clock position (headed DOWN the page); under the
common transformation, it is at the 12 o'clock position (headed UP
the page).
PDF::Writer 1.0 has been released with this behaviour. Changing it
will be very simple ... but it will break anyone's code that uses
angles. At the same time, if I use the broken transformation, then I
have to work harder at things like SVG or RVG transformations. I'm
definitely between a rock and a hard place here. The longer I wait
to fix this, the more people that will be affected by it.
I want the text angle and the graphics axis angle to mean the same
thing (either clockwise or counter-clockwise).
I'm looking for advice, people. I'm tempted to release 1.1 with this
fix; it's incompatible behaviour but compatible API, and the only
change necessary to your code would be to *negate* the angle.
-austin
--=20
Austin Ziegler * (e-mail address removed)
* Alternate: (e-mail address removed)
user's request, I'm looking at possibly doing SVG-to-PDF vector
transformations with PDF::Writer. In looking over the existing code,
I realised that there's some bugs in the axis transformation code
related to how rotation and skewing is done. The skewing is
completely wrong. The rotation is also completely wrong, but it's a
much more subtle issue.
See, I have the transformation *backwards* in the text rotation.
Without going into much detail as to *why*, rotation code is
supposed to be on a vector of:
[ cos(a) sin(a) -sin(a) cos(a) 0 0 ]
The *text* rotation code, on the other hand, is:
[ cos(a) -sin(a) sin(a) cos(a) 0 0 ]
This inversion *reverses* the direction of the angle.
Consider an analog clock. In both systems, zero degrees is at the
three o'clock position. Under the current text rotation, 90 degrees
is at the six o'clock position (headed DOWN the page); under the
common transformation, it is at the 12 o'clock position (headed UP
the page).
PDF::Writer 1.0 has been released with this behaviour. Changing it
will be very simple ... but it will break anyone's code that uses
angles. At the same time, if I use the broken transformation, then I
have to work harder at things like SVG or RVG transformations. I'm
definitely between a rock and a hard place here. The longer I wait
to fix this, the more people that will be affected by it.
I want the text angle and the graphics axis angle to mean the same
thing (either clockwise or counter-clockwise).
I'm looking for advice, people. I'm tempted to release 1.1 with this
fix; it's incompatible behaviour but compatible API, and the only
change necessary to your code would be to *negate* the angle.
-austin
--=20
Austin Ziegler * (e-mail address removed)
* Alternate: (e-mail address removed)