Avoid GDI measuring modes with CBDT fonts.

This fixes the scaledemoji_rendering GM CBDT font test for native fonts
with DirectWrite.

Change-Id: I60aaf4fe015e08192b4ac16ddd4436499d4a74ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290820
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
Ben Wagner 2020-05-19 14:03:27 -04:00 committed by Skia Commit-Bot
parent 3298baf6a5
commit ac007669ee

View File

@ -368,6 +368,15 @@ SkScalerContext_DW::SkScalerContext_DW(sk_sp<DWriteFontTypeface> typefaceRef,
fTextSizeMeasure = realTextSize;
fMeasuringMode = DWRITE_MEASURING_MODE_NATURAL;
}
// The GDI measuring modes don't seem to work well with CBDT fonts (DWrite.dll 10.0.18362.836).
if (fMeasuringMode != DWRITE_MEASURING_MODE_NATURAL) {
constexpr UINT32 CBDTTag = DWRITE_MAKE_OPENTYPE_TAG('C','B','D','T');
AutoDWriteTable CBDT(typeface->fDWriteFontFace.get(), CBDTTag);
if (CBDT.fExists) {
fMeasuringMode = DWRITE_MEASURING_MODE_NATURAL;
}
}
}
SkScalerContext_DW::~SkScalerContext_DW() {