use SkFont for measuring and paths

Bug: skia:
Change-Id: I1810edfef6e04be0380bac0eeab5450fe302e078
Reviewed-on: https://skia-review.googlesource.com/c/179728
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 11d070d..b5ef264 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -7,6 +7,7 @@
 
 #include "SkAutoMalloc.h"
 #include "SkCanvas.h"
+#include "SkFont.h"
 #include "SkGeometry.h"
 #include "SkNullCanvas.h"
 #include "SkPaint.h"
@@ -5400,13 +5401,22 @@
     // Previously, we would leave its fLastMoveToIndex alone after the copy, but now we should
     // set it to path's value inside SkPath::transform()
 
-    SkPath path;
-    SkPath copyPath;
+    const char text[] = "hello";
+    constexpr size_t len = sizeof(text) - 1;
+    SkGlyphID glyphs[len];
 
-    SkPaint paint;
-    paint.getTextPath("hello", 5, 20, 80, &(copyPath)); // <== init copyPath, set fake copyPath.fLastMoveToIndex
+    SkFont font;
+    font.textToGlyphs(text, len, kUTF8_SkTextEncoding, glyphs, len);
+
+    SkPath copyPath;
+    SkFont().getPaths(glyphs, len, [](const SkPath* src, const SkMatrix& mx, void* ctx) {
+        if (src) {
+            ((SkPath*)ctx)->addPath(*src, mx);
+        }
+    }, &copyPath);
 
     SkScalar radii[] = { 80, 100, 0, 0, 40, 60, 0, 0 };;
+    SkPath path;
     path.addRoundRect({10, 10, 110, 110}, radii);
     path.offset(0, 5, &(copyPath));                     // <== change buffer copyPath.fPathRef->fPoints but not reset copyPath.fLastMoveToIndex lead to out of bound