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
This commit is contained in:
reed@google.com 2011-07-21 14:12:36 +00:00
parent b14ef7315a
commit 8ed436c9b0

View File

@ -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);
}