mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Bug 1321901 - Use IDWriteFontFace::GetRecommendedRenderingMode for font rendering mode in Skia. r=lsalzman
This commit is contained in:
parent
75af7759bf
commit
0a092e1441
@ -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,21 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user