Revert "Support pixel antialising in DirectWrite."

This reverts commit 34db1eee20ffea6e423284bb06824653efff645d.

Reason for revert: breaks the chrome roll

E:\b\c\b\win_clang\src\third_party\skia\src\ports\SkScalerContext_win_dw.cpp(287,49):  error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
        GaspRange range{bitmapPPEM, bitmapPPEM, 0};
                                                ^
                                                {}
E:\b\c\b\win_clang\src\third_party\skia\src\ports\SkScalerContext_win_dw.cpp(287,49):  error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
        GaspRange range{bitmapPPEM, bitmapPPEM, 0};
                                                ^
                                                {}
E:\b\c\b\win_clang\src\third_party\skia\src\ports\SkScalerContext_win_dw.cpp(290,59):  error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
                range = GaspRange{bitmapPPEM, bitmapPPEM, 0};
                                                          ^
                                                          {}
E:\b\c\b\win_clang\src\third_party\skia\src\ports\SkScalerContext_win_dw.cpp(290,59):  error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
                range = GaspRange{bitmapPPEM, bitmapPPEM, 0};
                                                          ^
                                                          {}
E:\b\c\b\win_clang\src\third_party\skia\src\ports\SkScalerContext_win_dw.cpp(338,39):  error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
        GaspRange range = {0, 0xFFFF, 0};
                                      ^
                                      {}
E:\b\c\b\win_clang\src\third_party\skia\src\ports\SkScalerContext_win_dw.cpp(338,39):  error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
        GaspRange range = {0, 0xFFFF, 0};
                                      ^
                                      {}


Original change's description:
> Support pixel antialising in DirectWrite.
> 
> DirectWrite2 supports pixel antialiasing and rendering without hinting.
> 
> BUG=skia:5416
> 
> Change-Id: I215245b20dd403669dbccd37e34cb2fcd5e06431
> Reviewed-on: https://skia-review.googlesource.com/9145
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>
> 

TBR=mtklein@google.com,bungeman@google.com,reed@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:5416

Change-Id: Ic5f09abc3be8dd85d213a007780b3fe15fc11d92
Reviewed-on: https://skia-review.googlesource.com/9747
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp
index b2a61cc..d3cea9d 100644
--- a/src/ports/SkScalerContext_win_dw.cpp
+++ b/src/ports/SkScalerContext_win_dw.cpp
@@ -68,14 +68,59 @@
     return !gasp.fExists;
 }
 
-/** A GaspRange is inclusive, [min, max]. */
-struct GaspRange {
+/** A PPEMRange is inclusive, [min, max]. */
+struct PPEMRange {
     int min;
     int max;
-    SkOTTableGridAndScanProcedure::GaspRange::behavior flags;
 };
 
-bool get_gasp_range(DWriteFontTypeface* typeface, int size, GaspRange* range) {
+/** If the rendering mode for the specified 'size' is gridfit, then place
+ *  the gridfit range into 'range'. Otherwise, leave 'range' alone.
+ */
+static void expand_range_if_gridfit_only(DWriteFontTypeface* typeface, int size, PPEMRange* range) {
+    AutoTDWriteTable<SkOTTableGridAndScanProcedure> gasp(typeface->fDWriteFontFace.get());
+    if (!gasp.fExists) {
+        return;
+    }
+    if (gasp.fSize < sizeof(SkOTTableGridAndScanProcedure)) {
+        return;
+    }
+    if (gasp->version != SkOTTableGridAndScanProcedure::version0 &&
+        gasp->version != SkOTTableGridAndScanProcedure::version1)
+    {
+        return;
+    }
+
+    uint16_t numRanges = SkEndianSwap16(gasp->numRanges);
+    if (numRanges > 1024 ||
+        gasp.fSize < sizeof(SkOTTableGridAndScanProcedure) +
+                     sizeof(SkOTTableGridAndScanProcedure::GaspRange) * numRanges)
+    {
+        return;
+    }
+
+    const SkOTTableGridAndScanProcedure::GaspRange* rangeTable =
+            SkTAfter<const SkOTTableGridAndScanProcedure::GaspRange>(gasp.get());
+    int minPPEM = -1;
+    for (uint16_t i = 0; i < numRanges; ++i, ++rangeTable) {
+        int maxPPEM = SkEndianSwap16(rangeTable->maxPPEM);
+        // Test that the size is in range and the range is gridfit only.
+        if (minPPEM < size && size <= maxPPEM &&
+            rangeTable->flags.raw.value == SkOTTableGridAndScanProcedure::GaspRange::behavior::Raw::GridfitMask)
+        {
+            range->min = minPPEM + 1;
+            range->max = maxPPEM;
+            return;
+        }
+        minPPEM = maxPPEM;
+    }
+}
+
+/** If the rendering mode for the specified 'size' sets SymmetricSmoothing, return true. */
+static bool gasp_allows_cleartype_symmetric(DWriteFontTypeface* typeface, int size) {
+#ifdef SK_IGNORE_DIRECTWRITE_GASP_FIX
+    return true;
+#endif
     AutoTDWriteTable<SkOTTableGridAndScanProcedure> gasp(typeface->fDWriteFontFace.get());
     if (!gasp.fExists) {
         return false;
@@ -92,50 +137,25 @@
     uint16_t numRanges = SkEndianSwap16(gasp->numRanges);
     if (numRanges > 1024 ||
         gasp.fSize < sizeof(SkOTTableGridAndScanProcedure) +
-        sizeof(SkOTTableGridAndScanProcedure::GaspRange) * numRanges)
+                     sizeof(SkOTTableGridAndScanProcedure::GaspRange) * numRanges)
     {
         return false;
     }
 
     const SkOTTableGridAndScanProcedure::GaspRange* rangeTable =
-            SkTAfter<const SkOTTableGridAndScanProcedure::GaspRange>(gasp.get());
+        SkTAfter<const SkOTTableGridAndScanProcedure::GaspRange>(gasp.get());
     int minPPEM = -1;
     for (uint16_t i = 0; i < numRanges; ++i, ++rangeTable) {
         int maxPPEM = SkEndianSwap16(rangeTable->maxPPEM);
         if (minPPEM < size && size <= maxPPEM) {
-            range->min = minPPEM + 1;
-            range->max = maxPPEM;
-            range->flags = rangeTable->flags;
-            return true;
+            return rangeTable->flags.field.SymmetricSmoothing;
         }
         minPPEM = maxPPEM;
     }
     return false;
 }
-/** If the rendering mode for the specified 'size' is gridfit, then place
- *  the gridfit range into 'range'. Otherwise, leave 'range' alone.
- */
-static bool is_gridfit_only(SkOTTableGridAndScanProcedure::GaspRange::behavior flags) {
-    return flags.raw.value == SkOTTableGridAndScanProcedure::GaspRange::behavior::Raw::GridfitMask;
-}
 
-/** If the rendering mode for the specified 'size' sets SymmetricSmoothing, return true. */
-static bool gasp_allows_cleartype_symmetric(SkOTTableGridAndScanProcedure::GaspRange::behavior flags) {
-#ifdef SK_IGNORE_DIRECTWRITE_GASP_FIX
-    return true;
-#endif
-    return flags.field.SymmetricSmoothing;
-}
-
-/** If gidfitting is enabled at this size, return true. */
-static bool gasp_allows_gridfit(SkOTTableGridAndScanProcedure::GaspRange::behavior flags, DWRITE_RENDERING_MODE renderingMode) {
-    if (renderingMode == DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC) {
-        return flags.field.SymmetricGridfit;
-    }
-    return flags.field.Gridfit;
-}
-
-static bool has_bitmap_strike(DWriteFontTypeface* typeface, GaspRange range) {
+static bool has_bitmap_strike(DWriteFontTypeface* typeface, PPEMRange range) {
     SkAutoExclusive l(DWriteFactoryMutex);
     {
         AutoTDWriteTable<SkOTTableEmbeddedBitmapLocation> eblc(typeface->fDWriteFontFace.get());
@@ -228,11 +248,13 @@
         , fGlyphCount(-1) {
 
     DWriteFontTypeface* typeface = this->getDWriteTypeface();
-    fIsColorFont = typeface->fFactory2 &&
-                   typeface->fDWriteFontFace2 &&
-                   typeface->fDWriteFontFace2->IsColorFont();
+    typeface->fFactory->QueryInterface<IDWriteFactory2>(&fFactory2);
 
-    // In general, all glyphs should use NATURAL_SYMMETRIC
+    SkTScopedComPtr<IDWriteFontFace2> fontFace2;
+    typeface->fDWriteFontFace->QueryInterface<IDWriteFontFace2>(&fontFace2);
+    fIsColorFont = fFactory2.get() && fontFace2.get() && fontFace2->IsColorFont();
+
+    // In general, all glyphs should use CLEARTYPE_NATURAL_SYMMETRIC
     // except when bi-level rendering is requested or there are embedded
     // bi-level bitmaps (and the embedded bitmap flag is set and no rotation).
     //
@@ -284,12 +306,8 @@
         // When embedded bitmaps are requested, treat the entire range like
         // a bitmap strike if the range is gridfit only and contains a bitmap.
         int bitmapPPEM = SkScalarTruncToInt(gdiTextSize);
-        GaspRange range{bitmapPPEM, bitmapPPEM, 0};
-        if (get_gasp_range(typeface, bitmapPPEM, &range)) {
-            if (!is_gridfit_only(range.flags)) {
-                range = GaspRange{bitmapPPEM, bitmapPPEM, 0};
-            }
-        }
+        PPEMRange range = { bitmapPPEM, bitmapPPEM };
+        expand_range_if_gridfit_only(typeface, bitmapPPEM, &range);
         treatLikeBitmap = has_bitmap_strike(typeface, range);
 
         axisAlignedBitmap = is_axis_aligned(fRec);
@@ -307,7 +325,7 @@
     // This will not always provide a bitmap, but matches expected behavior.
     } else if (treatLikeBitmap && axisAlignedBitmap) {
         fTextSizeRender = gdiTextSize;
-        fRenderingMode = DWRITE_RENDERING_MODE_GDI_CLASSIC;
+        fRenderingMode = DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC;
         fTextureType = DWRITE_TEXTURE_CLEARTYPE_3x1;
         fTextSizeMeasure = gdiTextSize;
         fMeasuringMode = DWRITE_MEASURING_MODE_GDI_CLASSIC;
@@ -316,7 +334,7 @@
     // render high quality rotated glyphs but measure using bitmap metrics.
     } else if (treatLikeBitmap) {
         fTextSizeRender = gdiTextSize;
-        fRenderingMode = DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC;
+        fRenderingMode = DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC;
         fTextureType = DWRITE_TEXTURE_CLEARTYPE_3x1;
         fTextSizeMeasure = gdiTextSize;
         fMeasuringMode = DWRITE_MEASURING_MODE_GDI_CLASSIC;
@@ -327,7 +345,7 @@
     // drop out control in the y direction in order to be legible.
     } else if (is_hinted_without_gasp(typeface)) {
         fTextSizeRender = gdiTextSize;
-        fRenderingMode = DWRITE_RENDERING_MODE_NATURAL;
+        fRenderingMode = DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL;
         fTextureType = DWRITE_TEXTURE_CLEARTYPE_3x1;
         fTextSizeMeasure = realTextSize;
         fMeasuringMode = DWRITE_MEASURING_MODE_NATURAL;
@@ -335,37 +353,14 @@
     // The normal case is to use natural symmetric rendering (if permitted) and linear metrics.
     } else {
         fTextSizeRender = realTextSize;
-        GaspRange range = {0, 0xFFFF, 0};
-        get_gasp_range(typeface, SkScalarTruncToInt(fTextSizeRender), &range);
-        fRenderingMode = gasp_allows_cleartype_symmetric(range.flags)
-                       ? DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC
-                       : DWRITE_RENDERING_MODE_NATURAL;
+        fRenderingMode = gasp_allows_cleartype_symmetric(typeface, realTextSize)
+                       ? DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC
+                       : DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL;
         fTextureType = DWRITE_TEXTURE_CLEARTYPE_3x1;
         fTextSizeMeasure = realTextSize;
         fMeasuringMode = DWRITE_MEASURING_MODE_NATURAL;
     }
 
-    // DirectWrite2 allows for grayscale hinting.
-    fAntiAliasMode = DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE;
-#ifndef SK_IGNORE_DW_GRAY_FIX
-    if (typeface->fFactory2 && typeface->fDWriteFontFace2 &&
-        !isLCD(fRec) && !(fRec.fFlags & SkScalerContext::kGenA8FromLCD_Flag))
-    {
-        // DWRITE_TEXTURE_ALIASED_1x1 is now misnamed, it must also be used with grayscale.
-        fTextureType = DWRITE_TEXTURE_ALIASED_1x1;
-        fAntiAliasMode = DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE;
-    }
-#endif
-
-    // DirectWrite2 allows hinting to be disabled.
-    fGridFitMode = DWRITE_GRID_FIT_MODE_ENABLED;
-    if (fRec.getHinting() == SkPaint::kNo_Hinting) {
-        fGridFitMode = DWRITE_GRID_FIT_MODE_DISABLED;
-        if (fRenderingMode != DWRITE_RENDERING_MODE_ALIASED) {
-            fRenderingMode = DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC;
-        }
-    }
-
     if (this->isSubpixel()) {
         fTextSizeMeasure = realTextSize;
         fMeasuringMode = DWRITE_MEASURING_MODE_NATURAL;
@@ -473,33 +468,16 @@
     SkTScopedComPtr<IDWriteGlyphRunAnalysis> glyphRunAnalysis;
     {
         SkAutoExclusive l(DWriteFactoryMutex);
-        // IDWriteFactory2::CreateGlyphRunAnalysis is very bad at aliased glyphs.
-        if (this->getDWriteTypeface()->fFactory2 &&
-                (fGridFitMode == DWRITE_GRID_FIT_MODE_DISABLED ||
-                 fAntiAliasMode == DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE))
-        {
-            HRM(this->getDWriteTypeface()->fFactory2->CreateGlyphRunAnalysis(
-                    &run,
-                    &fXform,
-                    renderingMode,
-                    fMeasuringMode,
-                    fGridFitMode,
-                    fAntiAliasMode,
-                    0.0f, // baselineOriginX,
-                    0.0f, // baselineOriginY,
-                    &glyphRunAnalysis),
-                "Could not create DW2 glyph run analysis.");
-        } else {
-            HRM(this->getDWriteTypeface()->fFactory->CreateGlyphRunAnalysis(&run,
-                    1.0f, // pixelsPerDip,
-                    &fXform,
-                    renderingMode,
-                    fMeasuringMode,
-                    0.0f, // baselineOriginX,
-                    0.0f, // baselineOriginY,
-                    &glyphRunAnalysis),
-                "Could not create glyph run analysis.");
-        }
+        HRM(this->getDWriteTypeface()->fFactory->CreateGlyphRunAnalysis(
+            &run,
+            1.0f, // pixelsPerDip,
+            &fXform,
+            renderingMode,
+            fMeasuringMode,
+            0.0f, // baselineOriginX,
+            0.0f, // baselineOriginY,
+            &glyphRunAnalysis),
+            "Could not create glyph run analysis.");
     }
     {
         Shared l(DWriteFactoryMutex);
@@ -550,7 +528,7 @@
     run.isSideways = FALSE;
     run.glyphOffsets = &offset;
 
-    HRESULT hr = this->getDWriteTypeface()->fFactory2->TranslateColorGlyphRun(
+    HRESULT hr = fFactory2->TranslateColorGlyphRun(
         0, 0, &run, nullptr, fMeasuringMode, &fXform, 0, colorGlyph);
     if (hr == DWRITE_E_NOCOLOR) {
         return false;
@@ -702,22 +680,6 @@
 }
 
 template<bool APPLY_PREBLEND>
-static void grayscale_to_a8(const uint8_t* SK_RESTRICT src, const SkGlyph& glyph,
-                            const uint8_t* table8) {
-    const size_t dstRB = glyph.rowBytes();
-    const U16CPU width = glyph.fWidth;
-    uint8_t* SK_RESTRICT dst = static_cast<uint8_t*>(glyph.fImage);
-
-    for (U16CPU y = 0; y < glyph.fHeight; y++) {
-        for (U16CPU i = 0; i < width; i++) {
-            U8CPU a = *(src++);
-            dst[i] = sk_apply_lut_if<APPLY_PREBLEND>(a, table8);
-        }
-        dst = SkTAddOffset<uint8_t>(dst, dstRB);
-    }
-}
-
-template<bool APPLY_PREBLEND>
 static void rgb_to_a8(const uint8_t* SK_RESTRICT src, const SkGlyph& glyph, const uint8_t* table8) {
     const size_t dstRB = glyph.rowBytes();
     const U16CPU width = glyph.fWidth;
@@ -730,7 +692,7 @@
             U8CPU b = *(src++);
             dst[i] = sk_apply_lut_if<APPLY_PREBLEND>((r + g + b) / 3, table8);
         }
-        dst = SkTAddOffset<uint8_t>(dst, dstRB);
+        dst = (uint8_t*)((char*)dst + dstRB);
     }
 }
 
@@ -755,7 +717,7 @@
             }
             dst[i] = SkPack888ToRGB16(r, g, b);
         }
-        dst = SkTAddOffset<uint16_t>(dst, dstRB);
+        dst = (uint16_t*)((char*)dst + dstRB);
     }
 }
 
@@ -764,7 +726,7 @@
                                            DWRITE_TEXTURE_TYPE textureType)
 {
     int sizeNeeded = glyph.fWidth * glyph.fHeight;
-    if (DWRITE_TEXTURE_CLEARTYPE_3x1 == textureType) {
+    if (DWRITE_RENDERING_MODE_ALIASED != renderingMode) {
         sizeNeeded *= 3;
     }
     if (sizeNeeded > fBits.count()) {
@@ -795,35 +757,19 @@
     run.isSideways = FALSE;
     run.glyphOffsets = &offset;
     {
+
         SkTScopedComPtr<IDWriteGlyphRunAnalysis> glyphRunAnalysis;
         {
             SkAutoExclusive l(DWriteFactoryMutex);
-            // IDWriteFactory2::CreateGlyphRunAnalysis is very bad at aliased glyphs.
-            if (this->getDWriteTypeface()->fFactory2 &&
-                    (fGridFitMode == DWRITE_GRID_FIT_MODE_DISABLED ||
-                     fAntiAliasMode == DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE))
-            {
-                HRNM(this->getDWriteTypeface()->fFactory2->CreateGlyphRunAnalysis(&run,
-                         &fXform,
-                         renderingMode,
-                         fMeasuringMode,
-                         fGridFitMode,
-                         fAntiAliasMode,
-                         0.0f, // baselineOriginX,
-                         0.0f, // baselineOriginY,
-                         &glyphRunAnalysis),
-                     "Could not create DW2 glyph run analysis.");
-            } else {
-                HRNM(this->getDWriteTypeface()->fFactory->CreateGlyphRunAnalysis(&run,
-                         1.0f, // pixelsPerDip,
-                         &fXform,
-                         renderingMode,
-                         fMeasuringMode,
-                         0.0f, // baselineOriginX,
-                         0.0f, // baselineOriginY,
-                         &glyphRunAnalysis),
-                     "Could not create glyph run analysis.");
-            }
+            HRNM(this->getDWriteTypeface()->fFactory->CreateGlyphRunAnalysis(&run,
+                1.0f, // pixelsPerDip,
+                &fXform,
+                renderingMode,
+                fMeasuringMode,
+                0.0f, // baselineOriginX,
+                0.0f, // baselineOriginY,
+                &glyphRunAnalysis),
+                "Could not create glyph run analysis.");
         }
         //NOTE: this assumes that the glyph has already been measured
         //with an exact same glyph run analysis.
@@ -835,9 +781,9 @@
         {
             Shared l(DWriteFactoryMutex);
             HRNM(glyphRunAnalysis->CreateAlphaTexture(textureType,
-                    &bbox,
-                    fBits.begin(),
-                    sizeNeeded),
+                &bbox,
+                fBits.begin(),
+                sizeNeeded),
                 "Could not draw mask.");
         }
     }
@@ -937,18 +883,10 @@
         bilevel_to_bw(src, glyph);
         const_cast<SkGlyph&>(glyph).fMaskFormat = SkMask::kBW_Format;
     } else if (!isLCD(fRec)) {
-        if (textureType == DWRITE_TEXTURE_ALIASED_1x1) {
-            if (fPreBlend.isApplicable()) {
-                grayscale_to_a8<true>(src, glyph, fPreBlend.fG);
-            } else {
-                grayscale_to_a8<false>(src, glyph, fPreBlend.fG);
-            }
+        if (fPreBlend.isApplicable()) {
+            rgb_to_a8<true>(src, glyph, fPreBlend.fG);
         } else {
-            if (fPreBlend.isApplicable()) {
-                rgb_to_a8<true>(src, glyph, fPreBlend.fG);
-            } else {
-                rgb_to_a8<false>(src, glyph, fPreBlend.fG);
-            }
+            rgb_to_a8<false>(src, glyph, fPreBlend.fG);
         }
     } else {
         SkASSERT(SkMask::kLCD16_Format == glyph.fMaskFormat);
diff --git a/src/ports/SkScalerContext_win_dw.h b/src/ports/SkScalerContext_win_dw.h
index f186ea5..e13e01a 100644
--- a/src/ports/SkScalerContext_win_dw.h
+++ b/src/ports/SkScalerContext_win_dw.h
@@ -76,8 +76,7 @@
     DWRITE_RENDERING_MODE fRenderingMode;
     DWRITE_TEXTURE_TYPE fTextureType;
     DWRITE_MEASURING_MODE fMeasuringMode;
-    DWRITE_TEXT_ANTIALIAS_MODE fAntiAliasMode;
-    DWRITE_GRID_FIT_MODE fGridFitMode;
+    SkTScopedComPtr<IDWriteFactory2> fFactory2;
     bool fIsColorFont;
 };
 
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp
index 7d18da9..3acdd21 100644
--- a/src/ports/SkTypeface_win_dw.cpp
+++ b/src/ports/SkTypeface_win_dw.cpp
@@ -253,7 +253,6 @@
 void DWriteFontTypeface::onFilterRec(SkScalerContext::Rec* rec) const {
     if (rec->fFlags & SkScalerContext::kLCD_Vertical_Flag) {
         rec->fMaskFormat = SkMask::kA8_Format;
-        rec->fFlags |= SkScalerContext::kGenA8FromLCD_Flag;
     }
 
     unsigned flagsWeDontSupport = SkScalerContext::kVertical_Flag |
@@ -264,10 +263,8 @@
     rec->fFlags &= ~flagsWeDontSupport;
 
     SkPaint::Hinting h = rec->getHinting();
-    // DirectWrite2 allows for hinting to be turned off. Force everything else to normal.
-    if (h != SkPaint::kNo_Hinting || !fFactory2 || !fDWriteFontFace2) {
-        h = SkPaint::kNormal_Hinting;
-    }
+    // DirectWrite does not provide for hinting hints.
+    h = SkPaint::kSlight_Hinting;
     rec->setHinting(h);
 
 #if defined(SK_FONT_HOST_USE_SYSTEM_SETTINGS)
diff --git a/src/ports/SkTypeface_win_dw.h b/src/ports/SkTypeface_win_dw.h
index d7c73e2..d4d4fac 100644
--- a/src/ports/SkTypeface_win_dw.h
+++ b/src/ports/SkTypeface_win_dw.h
@@ -18,7 +18,6 @@
 
 #include <dwrite.h>
 #include <dwrite_1.h>
-#include <dwrite_2.h>
 
 class SkFontDescriptor;
 struct SkScalerContextRec;
@@ -58,24 +57,16 @@
             // http://blogs.msdn.com/b/oldnewthing/archive/2004/03/26/96777.aspx
             SkASSERT_RELEASE(nullptr == fDWriteFontFace1.get());
         }
-        if (!SUCCEEDED(fDWriteFontFace->QueryInterface(&fDWriteFontFace2))) {
-            SkASSERT_RELEASE(nullptr == fDWriteFontFace2.get());
-        }
-        if (!SUCCEEDED(fFactory->QueryInterface(&fFactory2))) {
-            SkASSERT_RELEASE(nullptr == fFactory2.get());
-        }
     }
 
 public:
     SkTScopedComPtr<IDWriteFactory> fFactory;
-    SkTScopedComPtr<IDWriteFactory2> fFactory2;
     SkTScopedComPtr<IDWriteFontCollectionLoader> fDWriteFontCollectionLoader;
     SkTScopedComPtr<IDWriteFontFileLoader> fDWriteFontFileLoader;
     SkTScopedComPtr<IDWriteFontFamily> fDWriteFontFamily;
     SkTScopedComPtr<IDWriteFont> fDWriteFont;
     SkTScopedComPtr<IDWriteFontFace> fDWriteFontFace;
     SkTScopedComPtr<IDWriteFontFace1> fDWriteFontFace1;
-    SkTScopedComPtr<IDWriteFontFace2> fDWriteFontFace2;
 
     static DWriteFontTypeface* Create(IDWriteFactory* factory,
                                       IDWriteFontFace* fontFace,