Remove SK_VERY_LEGACY_CREATE_TYPEFACE.

The flag and code it guards are no longer used.

TBR=reed
This just removes dead code.

Review URL: https://codereview.chromium.org/1882803002
diff --git a/gm/fontmgr.cpp b/gm/fontmgr.cpp
index ee3805c..efd01c5 100644
--- a/gm/fontmgr.cpp
+++ b/gm/fontmgr.cpp
@@ -45,11 +45,7 @@
     // it expects to get the same glyph when following this pattern.
     SkString familyName;
     typeface->getFamilyName(&familyName);
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    SkTypeface* typefaceCopy = fm->legacyCreateTypeface(familyName.c_str(), typeface->style());
-#else
     SkTypeface* typefaceCopy = fm->legacyCreateTypeface(familyName.c_str(), typeface->fontStyle());
-#endif
     SkSafeUnref(paint.setTypeface(typefaceCopy));
     return drawString(canvas, ch, x, y, paint) + 20;
 }
diff --git a/include/ports/SkFontConfigInterface.h b/include/ports/SkFontConfigInterface.h
index 464251b..3c68a24 100644
--- a/include/ports/SkFontConfigInterface.h
+++ b/include/ports/SkFontConfigInterface.h
@@ -80,19 +80,11 @@
      *
      *  If a match is not found, return false, and ignore all out parameters.
      */
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    virtual bool matchFamilyName(const char familyName[],
-                                 SkTypeface::Style requested,
-                                 FontIdentity* outFontIdentifier,
-                                 SkString* outFamilyName,
-                                 SkTypeface::Style* outStyle) = 0;
-#else
     virtual bool matchFamilyName(const char familyName[],
                                  SkFontStyle requested,
                                  FontIdentity* outFontIdentifier,
                                  SkString* outFamilyName,
                                  SkFontStyle* outStyle) = 0;
-#endif
 
     /**
      *  Given a FontRef, open a stream to access its data, or return null
diff --git a/include/ports/SkFontMgr.h b/include/ports/SkFontMgr.h
index a961cd4..ad6ed54 100644
--- a/include/ports/SkFontMgr.h
+++ b/include/ports/SkFontMgr.h
@@ -164,11 +164,7 @@
      */
     SkTypeface* createFromFile(const char path[], int ttcIndex = 0) const;
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    SkTypeface* legacyCreateTypeface(const char familyName[], unsigned typefaceStyleBits) const;
-#else
     SkTypeface* legacyCreateTypeface(const char familyName[], SkFontStyle style) const;
-#endif
 
     /**
      *  Return a ref to the default fontmgr. The caller must call unref() on
@@ -199,12 +195,7 @@
     virtual SkTypeface* onCreateFromFontData(SkFontData*) const;
     virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const = 0;
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
-                                               unsigned styleBits) const = 0;
-#else
     virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle) const = 0;
-#endif
 
 private:
     static SkFontMgr* Factory();    // implemented by porting layer
diff --git a/include/ports/SkFontMgr_indirect.h b/include/ports/SkFontMgr_indirect.h
index b3f31c3..5e8f1ed 100644
--- a/include/ports/SkFontMgr_indirect.h
+++ b/include/ports/SkFontMgr_indirect.h
@@ -54,11 +54,7 @@
     SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override;
     SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override;
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override;
-#else
     SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle) const override;
-#endif
 
 private:
     SkTypeface* createTypefaceFromFontId(const SkFontIdentity& fontId) const;
diff --git a/src/core/SkFontMgr.cpp b/src/core/SkFontMgr.cpp
index 68a6c24..eba2b28 100644
--- a/src/core/SkFontMgr.cpp
+++ b/src/core/SkFontMgr.cpp
@@ -74,11 +74,7 @@
     SkTypeface* onCreateFromFile(const char[], int) const override {
         return nullptr;
     }
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    SkTypeface* onLegacyCreateTypeface(const char [], unsigned) const override {
-#else
     SkTypeface* onLegacyCreateTypeface(const char [], SkFontStyle) const override {
-#endif
         return nullptr;
     }
 };
@@ -169,11 +165,7 @@
     return this->onCreateFromFile(path, ttcIndex);
 }
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], unsigned style) const {
-#else
 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], SkFontStyle style) const {
-#endif
     return this->onLegacyCreateTypeface(familyName, style);
 }
 
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index f9e5b5f..07b1467 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -87,11 +87,7 @@
         SkAutoMutexAcquire lock(&gCreateDefaultMutex);
 
         SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-        SkTypeface* t = fm->legacyCreateTypeface(nullptr, style);
-#else
         SkTypeface* t = fm->legacyCreateTypeface(nullptr, SkFontStyle::FromOldStyle(style));
-#endif
         return t ? t : SkEmptyTypeface::Create();
     });
 }
@@ -124,11 +120,7 @@
         return RefDefault(style);
     }
     SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    return fm->legacyCreateTypeface(name, style);
-#else
     return fm->legacyCreateTypeface(name, SkFontStyle::FromOldStyle(style));
-#endif
 }
 
 SkTypeface* SkTypeface::CreateFromTypeface(const SkTypeface* family, Style s) {
diff --git a/src/fonts/SkFontMgr_fontconfig.cpp b/src/fonts/SkFontMgr_fontconfig.cpp
index 60ad862..fedd3dc 100644
--- a/src/fonts/SkFontMgr_fontconfig.cpp
+++ b/src/fonts/SkFontMgr_fontconfig.cpp
@@ -318,12 +318,7 @@
         return stream.get() ? this->createFromStream(stream.release(), ttcIndex) : nullptr;
     }
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
-        SkTypeface::Style style = static_cast<SkTypeface::Style>(styleBits);
-#else
     SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle style) const override {
-#endif
         FCLocker lock;
         return FontConfigTypeface::LegacyCreateTypeface(familyName, style);
     }
diff --git a/src/fonts/SkFontMgr_indirect.cpp b/src/fonts/SkFontMgr_indirect.cpp
index 4d226da..d3fae91 100644
--- a/src/fonts/SkFontMgr_indirect.cpp
+++ b/src/fonts/SkFontMgr_indirect.cpp
@@ -184,14 +184,8 @@
     return fImpl->createFromData(data, ttcIndex);
 }
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-SkTypeface* SkFontMgr_Indirect::onLegacyCreateTypeface(const char familyName[],
-                                                       unsigned styleBits) const {
-    SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
-#else
 SkTypeface* SkFontMgr_Indirect::onLegacyCreateTypeface(const char familyName[],
                                                        SkFontStyle style) const {
-#endif
     SkAutoTUnref<SkTypeface> face(this->matchFamilyStyle(familyName, style));
 
     if (nullptr == face.get()) {
diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp
index 1c42e2d..cc80fbe 100644
--- a/src/ports/SkFontConfigInterface_direct.cpp
+++ b/src/ports/SkFontConfigInterface_direct.cpp
@@ -305,40 +305,6 @@
 }
 
 // Retrieves |is_bold|, |is_italic| and |font_family| properties from |font|.
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-SkTypeface::Style GetFontStyle(FcPattern* font) {
-    int resulting_bold;
-    if (FcPatternGetInteger(font, FC_WEIGHT, 0, &resulting_bold))
-        resulting_bold = FC_WEIGHT_NORMAL;
-
-    int resulting_italic;
-    if (FcPatternGetInteger(font, FC_SLANT, 0, &resulting_italic))
-        resulting_italic = FC_SLANT_ROMAN;
-
-    // If we ask for an italic font, fontconfig might take a roman font and set
-    // the undocumented property FC_MATRIX to a skew matrix. It'll then say
-    // that the font is italic or oblique. So, if we see a matrix, we don't
-    // believe that it's italic.
-    FcValue matrix;
-    const bool have_matrix = FcPatternGet(font, FC_MATRIX, 0, &matrix) == 0;
-
-    // If we ask for an italic font, fontconfig might take a roman font and set
-    // FC_EMBOLDEN.
-    FcValue embolden;
-    const bool have_embolden = FcPatternGet(font, FC_EMBOLDEN, 0, &embolden) == 0;
-
-    int styleBits = 0;
-    if (resulting_bold > FC_WEIGHT_MEDIUM && !have_embolden) {
-        styleBits |= SkTypeface::kBold;
-    }
-    if (resulting_italic > FC_SLANT_ROMAN && !have_matrix) {
-        styleBits |= SkTypeface::kItalic;
-    }
-
-    return (SkTypeface::Style)styleBits;
-}
-#else
-
 static int get_int(FcPattern* pattern, const char object[], int missing) {
     int value;
     if (FcPatternGetInteger(pattern, object, 0, &value) != FcResultMatch) {
@@ -463,11 +429,6 @@
     FcPatternAddInteger(pattern, FC_SLANT, style.isItalic() ? FC_SLANT_ITALIC : FC_SLANT_ROMAN);
 }
 
-SkFontStyle GetFontStyle(FcPattern* font) {
-    return skfontstyle_from_fcpattern(font);
-}
-#endif
-
 }  // anonymous namespace
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -549,19 +510,11 @@
   return match;
 }
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-bool SkFontConfigInterfaceDirect::matchFamilyName(const char familyName[],
-                                                  SkTypeface::Style style,
-                                                  FontIdentity* outIdentity,
-                                                  SkString* outFamilyName,
-                                                  SkTypeface::Style* outStyle) {
-#else
 bool SkFontConfigInterfaceDirect::matchFamilyName(const char familyName[],
                                                   SkFontStyle style,
                                                   FontIdentity* outIdentity,
                                                   SkString* outFamilyName,
                                                   SkFontStyle* outStyle) {
-#endif
     SkString familyStr(familyName ? familyName : "");
     if (familyStr.size() > kMaxFontFamilyLength) {
         return false;
@@ -574,16 +527,7 @@
     if (familyName) {
         FcPatternAddString(pattern, FC_FAMILY, (FcChar8*)familyName);
     }
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    FcPatternAddInteger(pattern, FC_WEIGHT,
-                        (style & SkTypeface::kBold) ? FC_WEIGHT_BOLD
-                                                    : FC_WEIGHT_NORMAL);
-    FcPatternAddInteger(pattern, FC_SLANT,
-                        (style & SkTypeface::kItalic) ? FC_SLANT_ITALIC
-                                                      : FC_SLANT_ROMAN);
-#else
     fcpattern_from_skfontstyle(style, pattern);
-#endif
 
     FcPatternAddBool(pattern, FC_SCALABLE, FcTrue);
 
@@ -671,7 +615,7 @@
         outFamilyName->set(post_config_family);
     }
     if (outStyle) {
-        *outStyle = GetFontStyle(match);
+        *outStyle = skfontstyle_from_fcpattern(match);
     }
     return true;
 }
diff --git a/src/ports/SkFontConfigInterface_direct.h b/src/ports/SkFontConfigInterface_direct.h
index 22dd9f1..3f0af82 100644
--- a/src/ports/SkFontConfigInterface_direct.h
+++ b/src/ports/SkFontConfigInterface_direct.h
@@ -17,20 +17,12 @@
     SkFontConfigInterfaceDirect();
     ~SkFontConfigInterfaceDirect() override;
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    bool matchFamilyName(const char familyName[],
-                         SkTypeface::Style requested,
-                         FontIdentity* outFontIdentifier,
-                         SkString* outFamilyName,
-                         SkTypeface::Style* outStyle) override;
-#else
     bool matchFamilyName(const char familyName[],
                          SkFontStyle requested,
                          FontIdentity* outFontIdentifier,
                          SkString* outFamilyName,
                          SkFontStyle* outStyle) override;
 
-#endif
     SkStreamAsset* openStream(const FontIdentity&) override;
 
     // new APIs
diff --git a/src/ports/SkFontConfigTypeface.h b/src/ports/SkFontConfigTypeface.h
index 68a36e3..00e00cf 100644
--- a/src/ports/SkFontConfigTypeface.h
+++ b/src/ports/SkFontConfigTypeface.h
@@ -39,11 +39,7 @@
         return fFamilyName.equals(name);
     }
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    static SkTypeface* LegacyCreateTypeface(const char familyName[], SkTypeface::Style);
-#else
     static SkTypeface* LegacyCreateTypeface(const char familyName[], SkFontStyle);
-#endif
 
 protected:
     FontConfigTypeface(const SkFontStyle& style,
diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp
index 207aa72..0ed8d8f 100644
--- a/src/ports/SkFontHost_fontconfig.cpp
+++ b/src/ports/SkFontHost_fontconfig.cpp
@@ -166,16 +166,9 @@
     }
 };
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char requestedFamilyName[],
-                                                     SkTypeface::Style requestedOldStyle)
-{
-    SkFontStyle requestedStyle = SkFontStyle::FromOldStyle(requestedOldStyle);
-#else
 SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char requestedFamilyName[],
                                                      SkFontStyle requestedStyle)
 {
-#endif
     SkAutoTUnref<SkFontConfigInterface> fci(RefFCI());
     if (nullptr == fci.get()) {
         return nullptr;
@@ -191,13 +184,8 @@
 
     SkFontConfigInterface::FontIdentity identity;
     SkString outFamilyName;
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    SkTypeface::Style outStyle;
-    if (!fci->matchFamilyName(requestedFamilyName, requestedOldStyle,
-#else
     SkFontStyle outStyle;
     if (!fci->matchFamilyName(requestedFamilyName, requestedStyle,
-#endif
                               &identity, &outFamilyName, &outStyle))
     {
         return nullptr;
@@ -206,15 +194,9 @@
     // Check if a typeface with this FontIdentity is already in the FontIdentity cache.
     face = SkTypefaceCache::FindByProcAndRef(find_by_FontIdentity, &identity);
     if (!face) {
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-        face = FontConfigTypeface::Create(SkFontStyle::FromOldStyle(outStyle), identity, outFamilyName);
-        // Add this FontIdentity to the FontIdentity cache.
-        SkTypefaceCache::Add(face, SkFontStyle::FromOldStyle(outStyle));
-#else
         face = FontConfigTypeface::Create(outStyle, identity, outFamilyName);
         // Add this FontIdentity to the FontIdentity cache.
         SkTypefaceCache::Add(face, outStyle);
-#endif
     }
     // Add this request to the request cache.
     SkFontHostRequestCache::Add(face, request.release());
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 70693ee..049d08b 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -2559,12 +2559,7 @@
         return create_from_dataProvider(pr);
     }
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
-        SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
-#else
     SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle style) const override {
-#endif
         if (familyName) {
             familyName = map_css_names(familyName);
         }
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 9ded4f5..c9781ba 100644
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -2501,12 +2501,7 @@
         return this->createFromStream(SkStream::NewFromFile(path));
     }
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
-        SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
-#else
     SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle style) const override {
-#endif
         LOGFONT lf;
         if (nullptr == familyName) {
             lf = get_default_font();
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index 741d6cc..ed5a4d5 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -487,12 +487,7 @@
         return new SkTypeface_AndroidStream(data, style, isFixedPitch, name);
     }
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
-        SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
-#else
     SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle style) const override {
-#endif
         if (familyName) {
             // On Android, we must return nullptr when we can't find the requested
             // named typeface so that the system/app can provide their own recovery
diff --git a/src/ports/SkFontMgr_custom.cpp b/src/ports/SkFontMgr_custom.cpp
index 6749ced..20d6f78 100644
--- a/src/ports/SkFontMgr_custom.cpp
+++ b/src/ports/SkFontMgr_custom.cpp
@@ -308,12 +308,7 @@
         return stream.get() ? this->createFromStream(stream.release(), ttcIndex) : nullptr;
     }
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
-        SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
-#else
     SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle style) const override {
-#endif
         SkTypeface* tf = nullptr;
 
         if (familyName) {
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp
index c8b055f..393265c 100644
--- a/src/ports/SkFontMgr_fontconfig.cpp
+++ b/src/ports/SkFontMgr_fontconfig.cpp
@@ -874,12 +874,7 @@
         return new SkTypeface_stream(fontData, style, isFixedWidth);
     }
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
-        SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
-#else
     SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle style) const override {
-#endif
         SkAutoTUnref<SkTypeface> typeface(this->matchFamilyStyle(familyName, style));
         if (typeface.get()) {
             return typeface.release();
diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
index 788bb5e..a03fcf8 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -294,11 +294,7 @@
     SkTypeface* onCreateFromStream(SkStreamAsset* stream, int ttcIndex) const override;
     SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override;
     SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override;
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-    SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override;
-#else
     SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle) const override;
-#endif
 
 private:
     HRESULT getByFamilyName(const WCHAR familyName[], IDWriteFontFamily** fontFamily) const;
@@ -953,14 +949,8 @@
     return S_OK;
 }
 
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-SkTypeface* SkFontMgr_DirectWrite::onLegacyCreateTypeface(const char familyName[],
-                                                          unsigned styleBits) const {
-    SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
-#else
 SkTypeface* SkFontMgr_DirectWrite::onLegacyCreateTypeface(const char familyName[],
                                                           SkFontStyle style) const {
-#endif
     SkTScopedComPtr<IDWriteFontFamily> fontFamily;
     if (familyName) {
         SkSMallocWCHAR wideFamilyName;
diff --git a/tools/sk_tool_utils_font.cpp b/tools/sk_tool_utils_font.cpp
index df47926..adbfa16 100644
--- a/tools/sk_tool_utils_font.cpp
+++ b/tools/sk_tool_utils_font.cpp
@@ -47,11 +47,7 @@
             // If we called SkTypeface::CreateFromName() here we'd recurse infinitely,
             // so we reimplement its core logic here inline without the recursive aspect.
             SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-            return fm->legacyCreateTypeface(name, style);
-#else
             return fm->legacyCreateTypeface(name, SkFontStyle::FromOldStyle(style));
-#endif
         }
     } else {
         sub = &gSubFonts[gDefaultFontIndex];