Rotating text

Everybody and their brother have their own model for dealing with
rotated text.

Postscript (as I understand it) simply rotates the coordinate
system. Fine.

Pango rotates the image and then translates the origin to be
the upper-left of the rotated image’s bounding box. (It used to be at the top-left of the first letter.)

Excel (for a positive angle) rotates the individual lines of
the image and positions them side-by-side (so the lower corners are all on a horizontal line)
in such a way that the first line is translated just enough to the
right to make the text be below a hypothetical line starting at the
origin and having the desired angle from the X-axis.

Pango’s is weird, but the pixel image is at least continuous as a
function of angle. (Well, actually not, but that is because of a different
issue: hinting is turned off for non-zero angles.) But Excel’s?
As the angle goes towards zero, the image translates continously
to the right. If the angles were real numbers, the image would
translate all the way to infinity. Then, suddenly, at angle zero
everything snaps back to the origin.

The job then is to implement the latter in the world of the two
others.

Comments are closed.