Revert "remove dead code around SK_SUPPORT_LEGACY_FONT_FLAGS"

This reverts commit 3b155a77c3704c3f3c5b741d60990e5ee959b261.

Reason for revert: breaks fuchsia (needs to roll newer flutter)

Original change's description:
> remove dead code around SK_SUPPORT_LEGACY_FONT_FLAGS
> 
> Bug: skia:
> Change-Id: I5a36e6827610c2a429e2f8b36adf432b95993c54
> Reviewed-on: https://skia-review.googlesource.com/c/171529
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I37bfab86e4a4243ddd94255aa0b126414bd9e835
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/171536
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/include/core/SkFont.h b/include/core/SkFont.h
index 58fb6d9..a93c42c 100644
--- a/include/core/SkFont.h
+++ b/include/core/SkFont.h
@@ -18,6 +18,29 @@
 
 class SK_API SkFont {
 public:
+#ifdef SK_SUPPORT_LEGACY_FONT_FLAGS
+    enum Flags {
+        /**
+         *  Use the system's automatic hinting mechanism to hint the typeface.
+         */
+        kForceAutoHinting_Flag      = 1 << 0,
+
+        /**
+         *  If the typeface contains explicit bitmaps for hinting, use them.
+         *  If both bytecode and auto hints are also specified, attempt to use the bitmaps first;
+         *  if that fails (e.g. there are no bitmaps), then attempt to bytecode or autohint.
+         */
+        kEmbeddedBitmaps_Flag       = 1 << 1,
+
+        kSubpixel_Flag              = 1 << 2,
+        kLinearMetrics_Flag         = 1 << 3,
+        kEmbolden_Flag              = 1 << 4,
+
+        kDEPRECATED_Antialias_Flag  = 1 << 5,
+        kDEPRECATED_LCDRender_Flag  = 1 << 6,
+    };
+#endif
+
     enum class Edging {
         kAlias,
         kAntiAlias,
@@ -34,6 +57,10 @@
     SkFont();
     SkFont(sk_sp<SkTypeface>, SkScalar size);
     SkFont(sk_sp<SkTypeface>, SkScalar size, SkScalar scaleX, SkScalar skewX);
+#ifdef SK_SUPPORT_LEGACY_FONT_FLAGS
+    SkFont(sk_sp<SkTypeface>, SkScalar size, uint32_t flags);
+    SkFont(sk_sp<SkTypeface>, SkScalar size, SkScalar scaleX, SkScalar skewX, uint32_t flags);
+#endif
 
     bool isForceAutoHinting() const { return SkToBool(fFlags & kForceAutoHinting_PrivFlag); }
     bool isEmbeddedBitmaps() const { return SkToBool(fFlags & kEmbeddedBitmaps_PrivFlag); }
@@ -67,6 +94,21 @@
      */
     SkFont makeWithSize(SkScalar size) const;
 
+#ifdef SK_SUPPORT_LEGACY_FONT_FLAGS
+    bool DEPRECATED_isAntiAlias() const { return SkToBool(fFlags & kDEPRECATED_Antialias_Flag); }
+    bool DEPRECATED_isLCDRender() const { return SkToBool(fFlags & kDEPRECATED_LCDRender_Flag); }
+
+    void DEPRECATED_setAntiAlias(bool);
+    void DEPRECATED_setLCDRender(bool);
+
+    /**
+     *  Return a font with the same attributes of this font, but with the flags.
+     */
+    SkFont makeWithFlags(uint32_t newFlags) const;
+    uint32_t    getFlags() const { return fFlags; }
+    void setFlags(uint32_t);
+#endif
+
     SkTypeface* getTypeface() const { return fTypeface.get(); }
     SkScalar    getSize() const { return fSize; }
     SkScalar    getScaleX() const { return fScaleX; }
diff --git a/src/core/SkFont.cpp b/src/core/SkFont.cpp
index 78f4f9a..e35de5c 100644
--- a/src/core/SkFont.cpp
+++ b/src/core/SkFont.cpp
@@ -40,6 +40,18 @@
 
 SkFont::SkFont() : SkFont(nullptr, kDefault_Size) {}
 
+#ifdef SK_SUPPORT_LEGACY_FONT_FLAGS
+SkFont::SkFont(sk_sp<SkTypeface> face, SkScalar size, SkScalar scaleX, SkScalar skewX,
+               uint32_t legacy_flags) : SkFont(std::move(face), size, scaleX, skewX) {
+    this->setFlags(legacy_flags);
+}
+
+SkFont::SkFont(sk_sp<SkTypeface> face, SkScalar size, uint32_t legacy_flags)
+    : SkFont(std::move(face), size) {
+    this->setFlags(legacy_flags);
+}
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 static inline uint32_t set_clear_mask(uint32_t bits, bool cond, uint32_t mask) {
@@ -62,6 +74,42 @@
     fFlags = set_clear_mask(fFlags, predicate, kEmbolden_PrivFlag);
 }
 
+#ifdef SK_SUPPORT_LEGACY_FONT_FLAGS
+void SkFont::DEPRECATED_setAntiAlias(bool doAA) {
+    if (!doAA) {
+        this->setEdging(Edging::kAlias);
+    } else {
+        if (this->getEdging() == Edging::kAlias) {
+            this->setEdging(Edging::kAntiAlias);
+        }
+        // else leave the current fEdging as is
+    }
+}
+
+void SkFont::DEPRECATED_setLCDRender(bool doLCD) {
+    if (doLCD) {
+        this->setEdging(Edging::kSubpixelAntiAlias);
+    } else {
+        if (this->getEdging() == Edging::kSubpixelAntiAlias) {
+            this->setEdging(Edging::kAntiAlias);
+        }
+        // else leave the current fEdging as is
+    }
+}
+
+void SkFont::setFlags(uint32_t legacy_flags) {
+    fFlags = legacy_flags & 0x1F;   // the first 5 flags are fine
+    this->DEPRECATED_setAntiAlias(SkToBool(legacy_flags & kDEPRECATED_Antialias_Flag));
+    this->DEPRECATED_setLCDRender(SkToBool(legacy_flags & kDEPRECATED_LCDRender_Flag));
+}
+
+SkFont SkFont::makeWithFlags(uint32_t newFlags) const {
+    SkFont font = *this;
+    font.setFlags(newFlags);
+    return font;
+}
+#endif
+
 void SkFont::setEdging(Edging e) {
     fEdging = SkToU8(e);
 }