Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There is a problem on my system that occurs when text is rotated 90 degrees as it is in frame labels. This only happens when ClearType is turned on, and only around 90 degrees of rotation.

I am running Mathematica 7 on Windows 7.


Style["αβημπρτ", 20, FontFamily -> "Arial"]

Rotate[%, # °] & /@ {90, 90.1, -90, 85, 95, 45, 0}

Exhibit A: ClearType OFF

Mathematica graphics

Ehibit B: ClearType ON

Mathematica graphics

Notice the strongly inferior rendering of the text rotated 90° and 90.1°, but acceptable rendering of text at the other rotations including -90°.

A close inspection of the images above will reveal that sub-pixel-rendering is disabled on rotated text except for the cases of 90°, 90.1°, and 0°. In the last case it works as as intended but it should apparently have been disabled (the default AA is used instead) for 90° and 90.1° as well. I do not want to turn off ClearType as it makes text more readable throughout my system except for this bug.

I tried to be clever by nesting rotations but that does not work. Interestingly there is a difference in rendering between 360° and -360° but not in the anti-aliasing.

text = Style["αβημπρτ", 20, FontFamily -> "Arial"];
Fold[Rotate, text, # °] & /@ {{90, 360}, {90, -360}, {45, 45}} // Row

Mathematica graphics

  1. What systems are affected by this bug? Is it fixed in newer versions?

  2. Is there a work-around that can be applied to the output of Graphics?

I would rather not Rasterize the text.

share|improve this question
I get the same problem with Mathematica 8 on Windows 7. – 0xFE Feb 4 '13 at 2:45
Problem still exists in 9.0.1. I'm on Windows 2003 here (not sure if the ClearType implementation has changed since). – Oleksandr R. Feb 4 '13 at 3:11
I used iRotate to reorient my display with respect to the physical monitor in all four possible directions and in every case the first two rotated text samples looked much worse than the rest (although the others don't look fantastic on a rotated monitor either TBH). This seems to rule out an issue with Windows itself for ClearType and vertical text. – Oleksandr R. Feb 4 '13 at 3:27
I've noticed similar before with V8 on mac 10.6.8 with 45 degrees rotation without being annoyed enough to look for solutions. – Mike Honeychurch Feb 4 '13 at 4:17
I find that adding FontOpacity -> 0.999 to the Style prevents the sub-pixel rendering and makes the quality equally poor at all angles. – Simon Woods Feb 4 '13 at 11:18
up vote 10 down vote accepted

Setting a FontOpacity less than 1 appears to prevent sub-pixel rendering and therefore provides output similar (perhaps identical) to that obtained with ClearType switched off.

text = Style["αβημπρτ", 20, FontFamily -> "Arial", FontOpacity -> 0.999];
Rotate[text, # °] & /@ {90, 90.1, -90, 85, 95, 45, 0}

enter image description here

One possibility to automate this, and to preserve sub-pixel rendering for unrotated text is to hijack RotationBox:


RotationBox[boxes_, opts___?OptionQ] := Block[{$rotboxblock = True},
         If[(BoxRotation /. {opts}) != 0, FontOpacity -> 0.999, {}, {}]], 
       ] /; ! TrueQ[$rotboxblock];

By targetting RotationBox rather than Rotate, the effect is seen even with expressions that don't explicitly involve Rotate:

text = Style["αβημπρτ", 20, FontFamily -> "Arial"];
Panel[text, text, Left, RotateLabel -> True]

enter image description here

share|improve this answer
Big +1. This alone will save me a lot of headache. I shall refrain from Accepting this immediately per personal policy, in case someone has something better, but I don't anticipate that. (Great if someone can produce correct sub-pixel rendering for all rotations but apparently even the developers couldn't be bothered to figure that out.) The only things lacking in your answer are a way to preserve sub-pixel AA for the 0° case and a way to do this automatically. Perhaps this tweak could be applied by overloading Rotate? I only mention it because you seem to enjoy a challenge. :-) – Mr.Wizard Feb 4 '13 at 13:01
@Mr.Wizard, I've added a possible approach to automate, though you may have better ideas. The elephant in the room is the FrameLabel in plots, which don't get caught by this method... – Simon Woods Feb 4 '13 at 16:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.