Commit 7f4da1df authored by eae@chromium.org's avatar eae@chromium.org

[DirectWrite] Force fully aliased text for certain fonts at small sizes

Force the use of fully aliased text for certain common east asian fonts
at smaller font sizes to ensure that text is legible. This is only
required for fonts without an embedded bitmap at a the specific size and
the minimum size for enabling anti aliasing is set on a per font basis.

BUG=383090,383040
R=dglazkov@chromium.org, cpu@chromium.org

Review URL: https://codereview.chromium.org/339693002

git-svn-id: svn://svn.chromium.org/blink/trunk@176244 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 1e6b0f02
...@@ -1017,6 +1017,10 @@ crbug.com/374569 [ Win ] http/tests/navigation/beacon-cross-origin.html [ Pass F ...@@ -1017,6 +1017,10 @@ crbug.com/374569 [ Win ] http/tests/navigation/beacon-cross-origin.html [ Pass F
crbug.com/374572 svg/filters/feImage-target-reappend-to-document.svg [ Pass Failure ] crbug.com/374572 svg/filters/feImage-target-reappend-to-document.svg [ Pass Failure ]
crbug.com/374572 svg/dynamic-updates/SVGImageElement-svgdom-preserveAspectRatio-prop.html [ Pass ImageOnlyFailure ] crbug.com/374572 svg/dynamic-updates/SVGImageElement-svgdom-preserveAspectRatio-prop.html [ Pass ImageOnlyFailure ]
Bug(eae) [ Win7 ] fast/text/justify-ideograph-vertical.html [ NeedsRebaseline ]
Bug(eae) [ Win7 ] virtual/antialiasedtext/fast/text/international/wrap-CJK-001.html [ NeedsRebaseline ]
Bug(eae) [ Win7 ] virtual/antialiasedtext/fast/text/justify-ideograph-vertical.html [ NeedsRebaseline ]
crbug.com/371651 svg/custom/deep-dynamic-updates.svg [ Pass Failure ] crbug.com/371651 svg/custom/deep-dynamic-updates.svg [ Pass Failure ]
crbug.com/371651 svg/custom/js-update-gradient.svg [ Pass Failure ] crbug.com/371651 svg/custom/js-update-gradient.svg [ Pass Failure ]
crbug.com/371651 svg/custom/js-update-pattern.svg [ Pass Failure ] crbug.com/371651 svg/custom/js-update-pattern.svg [ Pass Failure ]
...@@ -1116,4 +1120,4 @@ crbug.com/384564 crypto/rsassa-pkcs1-v1_5-generate-key.html [ Pass Timeout ] ...@@ -1116,4 +1120,4 @@ crbug.com/384564 crypto/rsassa-pkcs1-v1_5-generate-key.html [ Pass Timeout ]
crbug.com/384950 fast/forms/submit-change-fragment.html [ Pass Timeout ] crbug.com/384950 fast/forms/submit-change-fragment.html [ Pass Timeout ]
crbug.com/384566 svg/custom/textPath-change-reference2.svg [ ImageOnlyFailure Pass ] crbug.com/384566 svg/custom/textPath-change-reference2.svg [ ImageOnlyFailure Pass ]
crbug.com/384396 [ Win ] battery-status/page-visibility.html [ Pass Failure Timeout ] crbug.com/384396 [ Win ] battery-status/page-visibility.html [ Pass Failure Timeout ]
\ No newline at end of file
...@@ -225,6 +225,23 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD ...@@ -225,6 +225,23 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
fontDescription.orientation(), fontDescription.orientation(),
s_useSubpixelPositioning); s_useSubpixelPositioning);
struct FamilyMinSize {
const wchar_t* family;
unsigned minSize;
};
const static FamilyMinSize minAntiAliasSizeForFont[] = {
{ L"simsun", 16 },
{ L"dotum", 12 }
};
size_t numFonts = WTF_ARRAY_LENGTH(minAntiAliasSizeForFont);
for (size_t i = 0; i < numFonts; i++) {
FamilyMinSize entry = minAntiAliasSizeForFont[i];
if (typefacesMatchesFamily(tf.get(), entry.family)) {
result->setMinSizeForAntiAlias(entry.minSize);
break;
}
}
return result; return result;
} }
......
...@@ -62,21 +62,23 @@ void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext* context) cons ...@@ -62,21 +62,23 @@ void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext* context) cons
if (ts <= kMaxSizeForEmbeddedBitmap) if (ts <= kMaxSizeForEmbeddedBitmap)
flags |= SkPaint::kEmbeddedBitmapText_Flag; flags |= SkPaint::kEmbeddedBitmapText_Flag;
if (m_useSubpixelPositioning) if (ts >= m_minSizeForAntiAlias) {
flags |= SkPaint::kSubpixelText_Flag; if (m_useSubpixelPositioning)
flags |= SkPaint::kSubpixelText_Flag;
// Only set painting flags when we're actually painting.
if (context && !context->couldUseLCDRenderedText()) { // Only set painting flags when we're actually painting.
textFlags &= ~SkPaint::kLCDRenderText_Flag; if (context && !context->couldUseLCDRenderedText()) {
// If we *just* clear our request for LCD, then GDI seems to textFlags &= ~SkPaint::kLCDRenderText_Flag;
// sometimes give us AA text, and sometimes give us BW text. Since the // If we *just* clear our request for LCD, then GDI seems to
// original intent was LCD, we want to force AA (rather than BW), so we // sometimes give us AA text, and sometimes give us BW text. Since the
// add a special bit to tell Skia to do its best to avoid the BW: by // original intent was LCD, we want to force AA (rather than BW), so we
// drawing LCD offscreen and downsampling that to AA. // add a special bit to tell Skia to do its best to avoid the BW: by
textFlags |= SkPaint::kGenA8FromLCD_Flag; // drawing LCD offscreen and downsampling that to AA.
textFlags |= SkPaint::kGenA8FromLCD_Flag;
}
SkASSERT(!(textFlags & ~textFlagsMask));
flags |= textFlags;
} }
SkASSERT(!(textFlags & ~textFlagsMask));
flags |= textFlags;
paint->setFlags(flags); paint->setFlags(flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment