Hi Tilman,

to give you some insight,
my issue is that I get wrong values for the angle of text when using the 
calculation as you propose in TextPosition.java:
int angle = (int) Math.round(Math.toDegrees(Math.atan2(m.getShearY(), 
m.getScaleY())));


After some more digging I think the issue I see comes from SetMatrix.java where 
a Matrix is instantiated from a set of COSNumber values.

--> The incoming parameters from a PDF file are
    "scaleX shearX shearY scaleY transX transY Tm"

[Code from SetMatrix.java]

COSNumber a = (COSNumber)arguments.get( 0 ); // scaleX
COSNumber b = (COSNumber)arguments.get( 1 ); // shearX
COSNumber c = (COSNumber)arguments.get( 2 ); // shearY
COSNumber d = (COSNumber)arguments.get( 3 ); // scaleY
COSNumber e = (COSNumber)arguments.get( 4 ); // transX
COSNumber f = (COSNumber)arguments.get( 5 ); // transY

So the assignments are effectively:
a = scaleX
b = shearX
c = shearY
d = scaleY
e = transX
f = transY

--> the Matrix is instantiated as follows:

[Code from SetMatrix.java]

Matrix matrix = new Matrix(a.floatValue(), b.floatValue(), c.floatValue(),
                           d.floatValue(), e.floatValue(), f.floatValue());


Analysis:

Effectively the constructor for the Matrix gets (in SetMatrix ) in pseudo code 
the following parameters from a PDF file:

new Matrix( scaleX , shearX , shearY , scaleY , transX , transY )

but expects

new Matrix( scaleX , shearY, shearX , scaleY , transX , trans Y )

--> ISSUE: So I think that here shearX and shearY are exchanged when calling 
the constructor.


Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to