diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-07-21 14:12:36 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-07-21 14:12:36 +0000 |
commit | 8ed436c9b04548787442ddf3d7895a217b258fd5 (patch) | |
tree | 03d602255e8d79eb7f392ce1573842b4b9a5dfc0 | |
parent | b14ef7315afafc5082791b7c49213ef99f3275cb (diff) |
disable hinting when rotated, since it looks bad
we do the same thing on windows (mac seems to handle rotation fine)
git-svn-id: http://skia.googlecode.com/svn/trunk@1924 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | src/ports/SkFontHost_FreeType.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index a5d097e0d9..be5446e0f0 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -598,6 +598,17 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics( } /////////////////////////////////////////////////////////////////////////// +static bool bothZero(SkScalar a, SkScalar b) { + return 0 == a && 0 == b; +} + +// returns false if there is any non-90-rotation or skew +static bool isAxisAligned(const SkScalerContext::Rec& rec) { + return 0 == rec.fPreSkewX && + (bothZero(rec.fPost2x2[0][1], rec.fPost2x2[1][0]) || + bothZero(rec.fPost2x2[0][0], rec.fPost2x2[1][1])); +} + void SkFontHost::FilterRec(SkScalerContext::Rec* rec) { if (!gLCDSupportValid) { InitFreetype(); @@ -619,6 +630,10 @@ void SkFontHost::FilterRec(SkScalerContext::Rec* rec) { // to do subpixel, we must have at most slight hinting h = SkPaint::kSlight_Hinting; } + // rotated text looks bad with hinting, so we disable it as needed + if (!isAxisAligned(*rec)) { + h = SkPaint::kNo_Hinting; + } rec->setHinting(h); } |