fix vertical text on Lion
authorcaryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 20 Dec 2011 20:06:37 +0000 (20:06 +0000)
committercaryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 20 Dec 2011 20:06:37 +0000 (20:06 +0000)
M    src/ports/SkFontHost_mac_coretext.cpp

git-svn-id: http://skia.googlecode.com/svn/trunk@2906 2bbb7eff-a529-9590-31e7-b0007b416f81

src/ports/SkFontHost_mac_coretext.cpp

index 423f0af..4c322bc 100644 (file)
@@ -667,6 +667,7 @@ SkScalerContext_Mac::SkScalerContext_Mac(const SkDescriptor* desc)
         } else {
             fVerticalMatrix.preRotate(SkIntToScalar(90));
         }
+        fVerticalMatrix.postScale(SK_Scalar1, -SK_Scalar1);
     }
     fGlyphCount = SkToU16(numGlyphs);
     fDoSubPosition = SkToBool(fRec.fFlags & kSubpixelPositioning_Flag);
@@ -791,8 +792,13 @@ void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkIPoint* offset) c
                            SkFloatToScalar(vertOffset.height)};
     SkPoint floatOffset;
     fVerticalMatrix.mapPoints(&floatOffset, &trans, 1);
+    if (isLion()) {
+    // Lion changed functionality from Snow Leopard, though it's not clear why
+    // this is required here; it was found through trial and error.
+        fUnitMatrix.mapPoints(&floatOffset, 1);
+    }
     offset->fX = SkScalarRound(floatOffset.fX);
-    offset->fY = -SkScalarRound(floatOffset.fY);
+    offset->fY = SkScalarRound(floatOffset.fY);
 }
 
 /* from http://developer.apple.com/fonts/TTRefMan/RM06/Chap6loca.html