Bug 1321901 - Use IDWriteFontFace::GetRecommendedRenderingMode for font rendering mode in Skia. r=lsalzman

This commit is contained in:
Mason Chang 2016-12-15 08:33:43 -08:00
Родитель 8d71717fb4
Коммит 49715dce65
3 изменённых файлов: 25 добавлений и 5 удалений

Просмотреть файл

@ -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()) {

Просмотреть файл

@ -75,6 +75,7 @@ private:
DWRITE_RENDERING_MODE fRenderingMode;
DWRITE_TEXTURE_TYPE fTextureType;
DWRITE_MEASURING_MODE fMeasuringMode;
SkTScopedComPtr<IDWriteRenderingParams> fDefaultRenderingParams;
#if SK_HAS_DWRITE_2_H
SkTScopedComPtr<IDWriteFactory2> fFactory2;
bool fIsColorFont;

Просмотреть файл

@ -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