diff --git a/gfx/skia/skia/src/ports/SkScalerContext_win_dw.cpp b/gfx/skia/skia/src/ports/SkScalerContext_win_dw.cpp index 99edf945209d..2500b0ffffd6 100644 --- a/gfx/skia/skia/src/ports/SkScalerContext_win_dw.cpp +++ b/gfx/skia/skia/src/ports/SkScalerContext_win_dw.cpp @@ -219,7 +219,13 @@ SkScalerContext_DW::SkScalerContext_DW(DWriteFontTypeface* typeface, fIsColorFont = fFactory2.get() && fontFace2.get() && fontFace2->IsColorFont(); #endif - // In general, all glyphs should use CLEARTYPE_NATURAL_SYMMETRIC + IDWriteFactory* factory = sk_get_dwrite_factory(); + if (factory != nullptr) { + HRVM(factory->CreateRenderingParams(&fDefaultRenderingParams), + "Could not create default rendering params"); + } + + // In general, all glyphs should DWriteFontFace::GetRecommendedRenderingMode // except when bi-level rendering is requested or there are embedded // bi-level bitmaps (and the embedded bitmap flag is set and no rotation). // @@ -315,13 +321,26 @@ SkScalerContext_DW::SkScalerContext_DW(DWriteFontTypeface* typeface, fTextSizeMeasure = realTextSize; fMeasuringMode = DWRITE_MEASURING_MODE_NATURAL; - // The normal case is to use natural symmetric rendering and linear metrics. + // The normal case is to use the recommended rendering mode } else { fTextSizeRender = realTextSize; - fRenderingMode = DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC; fTextureType = DWRITE_TEXTURE_CLEARTYPE_3x1; fTextSizeMeasure = realTextSize; fMeasuringMode = DWRITE_MEASURING_MODE_NATURAL; + + if (!SUCCEEDED(fTypeface->fDWriteFontFace->GetRecommendedRenderingMode( + fTextSizeRender, + 1.0f, + fMeasuringMode, + fDefaultRenderingParams.get(), + &fRenderingMode))) { + fRenderingMode = DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC; + } + + // We don't support outline mode right now. + if (fRenderingMode == DWRITE_RENDERING_MODE_OUTLINE) { + fRenderingMode = DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC; + } } if (this->isSubpixel()) { diff --git a/gfx/skia/skia/src/ports/SkScalerContext_win_dw.h b/gfx/skia/skia/src/ports/SkScalerContext_win_dw.h index 98c4910b27f0..f2a7e255bab0 100644 --- a/gfx/skia/skia/src/ports/SkScalerContext_win_dw.h +++ b/gfx/skia/skia/src/ports/SkScalerContext_win_dw.h @@ -75,6 +75,7 @@ private: DWRITE_RENDERING_MODE fRenderingMode; DWRITE_TEXTURE_TYPE fTextureType; DWRITE_MEASURING_MODE fMeasuringMode; + SkTScopedComPtr fDefaultRenderingParams; #if SK_HAS_DWRITE_2_H SkTScopedComPtr fFactory2; bool fIsColorFont; diff --git a/layout/reftests/w3c-css/submitted/text-decor-3/reftest.list b/layout/reftests/w3c-css/submitted/text-decor-3/reftest.list index 0649186f5d84..0c8d707a8275 100644 --- a/layout/reftests/w3c-css/submitted/text-decor-3/reftest.list +++ b/layout/reftests/w3c-css/submitted/text-decor-3/reftest.list @@ -3,7 +3,7 @@ # text-emphasis-style == text-emphasis-style-property-001.html text-emphasis-style-property-001-ref.html -fuzzy-if(gtkWidget,3,4) fuzzy-if(skiaContent,87,80) == text-emphasis-style-property-002.html text-emphasis-style-property-002-ref.html +fuzzy-if(gtkWidget,3,4) fuzzy-if(skiaContent,103,80) == text-emphasis-style-property-002.html text-emphasis-style-property-002-ref.html skip-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == text-emphasis-style-property-003.html text-emphasis-style-property-003-ref.html skip-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == text-emphasis-style-property-004.html text-emphasis-style-property-004-ref.html == text-emphasis-style-property-005.html text-emphasis-style-property-005-ref.html @@ -53,7 +53,7 @@ fuzzy-if(gtkWidget,3,4) == text-emphasis-color-property-002.html text-emphasis-c # text-emphasis == text-emphasis-property-001.html text-emphasis-style-property-001-ref.html -fuzzy-if(gtkWidget,3,4) fuzzy-if(skiaContent,87,80) == text-emphasis-property-002.html text-emphasis-style-property-002-ref.html +fuzzy-if(gtkWidget,3,4) fuzzy-if(skiaContent,103,80) == text-emphasis-property-002.html text-emphasis-style-property-002-ref.html fuzzy-if(gtkWidget,3,4) == text-emphasis-property-003.html text-emphasis-style-property-012-ref.html fuzzy-if(gtkWidget,3,4) == text-emphasis-property-003a.html text-emphasis-style-property-012-ref.html fuzzy-if(gtkWidget,3,4) == text-emphasis-property-003b.html text-emphasis-style-property-012-ref.html