static int computePaintTextFlags(const LOGFONT& lf) { int textFlags = 0; switch (lf.lfQuality) { case NONANTIALIASED_QUALITY: textFlags = 0; break; case ANTIALIASED_QUALITY: textFlags = SkPaint::kAntiAlias_Flag; break; case CLEARTYPE_QUALITY: textFlags = (SkPaint::kAntiAlias_Flag | SkPaint::kLCDRenderText_Flag); break; default: textFlags = getDefaultGDITextFlags(); break; } // only allow features that SystemParametersInfo allows textFlags &= getDefaultGDITextFlags(); /* * FontPlatformData(...) will read our logfont, and try to honor the the lfQuality * setting (computing the corresponding SkPaint flags for AA and LCD). However, it * will limit the quality based on its query of SPI_GETFONTSMOOTHING. This could mean * we end up drawing the text in BW, even though our lfQuality requested antialiasing. * * Many web-fonts are so poorly hinted that they are terrible to read when drawn in BW. * In these cases, we have decided to FORCE these fonts to be drawn with at least grayscale AA, * even when the System (getDefaultGDITextFlags) tells us to draw only in BW. */ if (isWebFont(lf) && !isRunningLayoutTest()) textFlags |= SkPaint::kAntiAlias_Flag; return textFlags; }
static int computePaintTextFlags(String fontFamilyName) { if (isRunningLayoutTest()) return isFontSmoothingEnabledForTest() ? SkPaint::kAntiAlias_Flag : 0; int textFlags = getSystemTextFlags(); // Many web-fonts are so poorly hinted that they are terrible to read when drawn in BW. // In these cases, we have decided to FORCE these fonts to be drawn with at least grayscale AA, // even when the System (getSystemTextFlags) tells us to draw only in BW. if (isWebFont(fontFamilyName)) textFlags |= SkPaint::kAntiAlias_Flag; return textFlags; }