Geometry Question
This question arises because of rotated text frames.
If a text frame is rotated, the baseline property of an insertion point is simply the y-coordinate of the insertion point, and the horizontalOffset property of the insertionPoint is the x-coordinate.
Thus, for a rotated frame, just moving along a single line of text changes the baseline value. Quite weird, but there you are.
I am needing to find the distance (leading) between two insertionPoints on different lines of a rotated text frame. If the frame is not rotated, I can subtract the baseline of one character from the baseline of the other to get the correct answer.
But this does not work for rotated frames for the reason stated.
(I can't just check the leading value of the lower character, because the top character might be inside a table, or the bottom one inside a footnote, or one or both could have baseline shift applied, or the "apply leading to entire paragraph" might be switched on, etc. etc.)
Clearly a bit of geometry would help here. Maybe even some trigonometry? Transformation matrices?
In the diagram, points a and b represent two insertion points inside a text frame.
The text frame is rotated by angle α relative to the x-axis.
Line segment cb is parallel to the long side of the rectangle (the text frame) in the diagram.
Line segment ac is perpendicular to cb.
What is the length of line segment cb?
More specifically, how can it be expressed in terms of ax, ay, bx, by, and α?
Many thanks,
Ariel
