SkPDF/SkAdvancedTypefaceMetrics: simplify ATM, PDF takes over

No public API changes.
TBR=reed@google.com

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2222523003

Review-Url: https://codereview.chromium.org/2222523003
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index e093bf0..5c30341 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -577,38 +577,17 @@
         perGlyphInfo = kNo_PerGlyphInfo;
     }
 
-    if (perGlyphInfo & kHAdvance_PerGlyphInfo) {
-        info->setGlyphWidths(
-            face->num_glyphs,
-            glyphIDs,
-            glyphIDsCount,
-            SkAdvancedTypefaceMetrics::GetAdvance([face](int gId, int16_t* data) {
-                FT_Fixed advance = 0;
-                if (FT_Get_Advances(face, gId, 1, FT_LOAD_NO_SCALE, &advance)) {
-                    return false;
-                }
-                SkASSERT(data);
-                *data = advance;
-                return true;
-            })
-        );
-    }
-
-    if (perGlyphInfo & kVAdvance_PerGlyphInfo && FT_HAS_VERTICAL(face)) {
-        SkASSERT(false);  // Not implemented yet.
-    }
-
     if (perGlyphInfo & kGlyphNames_PerGlyphInfo &&
         info->fType == SkAdvancedTypefaceMetrics::kType1_Font)
     {
         // Postscript fonts may contain more than 255 glyphs, so we end up
         // using multiple font descriptions with a glyph ordering.  Record
         // the name of each glyph.
-        info->fGlyphNames.reset(new SkAutoTArray<SkString>(face->num_glyphs));
+        info->fGlyphNames.reset(face->num_glyphs);
         for (int gID = 0; gID < face->num_glyphs; gID++) {
             char glyphName[128];  // PS limit for names is 127 bytes.
             FT_Get_Glyph_Name(face, gID, glyphName, 128);
-            info->fGlyphNames->get()[gID].set(glyphName);
+            info->fGlyphNames[gID].set(glyphName);
         }
     }
 
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index d95ebbb..842c5e6 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -1667,24 +1667,6 @@
             }
         }
     }
-
-    if (perGlyphInfo & kHAdvance_PerGlyphInfo) {
-        CTFontRef borrowedCTFont = ctFont.get();
-        info->setGlyphWidths(
-            SkToInt(glyphCount),
-            glyphIDs,
-            glyphIDsCount,
-            SkAdvancedTypefaceMetrics::GetAdvance([borrowedCTFont](int gId, int16_t* data) {
-                CGSize advance;
-                advance.width = 0;
-                CGGlyph glyph = gId;
-                CTFontGetAdvancesForGlyphs(borrowedCTFont, kCTFontHorizontalOrientation,
-                                           &glyph, &advance, 1);
-                *data = sk_float_round2int(advance.width);
-                return true;
-            })
-        );
-    }
     return info;
 }
 
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index fa5c972..a2d9da7 100644
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -1818,29 +1818,6 @@
         }
     }
 
-    if (perGlyphInfo & kHAdvance_PerGlyphInfo) {
-        info->setGlyphWidths(
-            glyphCount,
-            glyphIDs,
-            glyphIDsCount,
-            SkAdvancedTypefaceMetrics::GetAdvance([hdc](int gId, int16_t* advance) {
-                // Initialize the MAT2 structure to
-                // the identify transformation matrix.
-                static const MAT2 mat2 = {
-                    SkScalarToFIXED(1), SkScalarToFIXED(0),
-                    SkScalarToFIXED(0), SkScalarToFIXED(1)};
-                int flags = GGO_METRICS | GGO_GLYPH_INDEX;
-                GLYPHMETRICS gm;
-                if (GDI_ERROR == GetGlyphOutline(hdc, gId, flags, &gm, 0, nullptr, &mat2)) {
-                    return false;
-                }
-                SkASSERT(advance);
-                *advance = gm.gmCellIncX;
-                return true;
-            })
-        );
-    }
-
 Error:
 ReturnInfo:
     SelectObject(hdc, savefont);
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp
index 11e5727..7e5c409 100644
--- a/src/ports/SkTypeface_win_dw.cpp
+++ b/src/ports/SkTypeface_win_dw.cpp
@@ -419,50 +419,6 @@
                                     (int32_t)SkEndian_SwapBE16((uint16_t)headTable->yMax),
                                     (int32_t)SkEndian_SwapBE16((uint16_t)headTable->xMax),
                                     (int32_t)SkEndian_SwapBE16((uint16_t)headTable->yMin));
-
-    //TODO: is this even desired? It seems PDF only wants this value for Type1
-    //fonts, and we only get here for TrueType fonts.
-    info->fStemV = 0;
-    /*
-    // Figure out a good guess for StemV - Min width of i, I, !, 1.
-    // This probably isn't very good with an italic font.
-    int16_t min_width = SHRT_MAX;
-    info->fStemV = 0;
-    char stem_chars[] = {'i', 'I', '!', '1'};
-    for (size_t i = 0; i < SK_ARRAY_COUNT(stem_chars); i++) {
-        ABC abcWidths;
-        if (GetCharABCWidths(hdc, stem_chars[i], stem_chars[i], &abcWidths)) {
-            int16_t width = abcWidths.abcB;
-            if (width > 0 && width < min_width) {
-                min_width = width;
-                info->fStemV = min_width;
-            }
-        }
-    }
-    */
-
-    if (perGlyphInfo & kHAdvance_PerGlyphInfo) {
-        if (fixedWidth) {
-            SkAdvancedTypefaceMetrics::WidthRange range(0);
-            int16_t advance;
-            getWidthAdvance(fDWriteFontFace.get(), 1, &advance);
-            range.fAdvance.append(1, &advance);
-            SkAdvancedTypefaceMetrics::FinishRange(
-                    &range, 0, SkAdvancedTypefaceMetrics::WidthRange::kDefault);
-            info->fGlyphWidths.emplace_back(std::move(range));
-        } else {
-            IDWriteFontFace* borrowedFontFace = fDWriteFontFace.get();
-            info->setGlyphWidths(
-                glyphCount,
-                glyphIDs,
-                glyphIDsCount,
-                SkAdvancedTypefaceMetrics::GetAdvance([borrowedFontFace](int gId, int16_t* data) {
-                    return getWidthAdvance(borrowedFontFace, gId, data);
-                })
-            );
-        }
-    }
-
     return info;
 }
 #endif//defined(SK_BUILD_FOR_WIN32)