Fix missing use of fontmetrics when checking skia bounding boxes.

Allows more of the tests to pass when comparing against skia-only case.

Change-Id: Iba4d362d1d533920083b9e6cdb52ac476f38047c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/148311
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/cfx_face.cpp b/core/fxge/cfx_face.cpp
index 9253e36..5e0df69 100644
--- a/core/fxge/cfx_face.cpp
+++ b/core/fxge/cfx_face.cpp
@@ -468,14 +468,13 @@
               pdfium::checked_cast<int32_t>(GetRec()->bbox.yMax));
 #if defined(PDF_ENABLE_SKIA_TYPEFACE_CHECKS)
   if (skia_typeface_) {
-    SkRect bounds = skia_typeface_->getBounds();
-    // Skia bounds have different origins, and are 1-pt based, so scale by
-    // units per em.
-    float upem = GetUnitsPerEm();
-    CHECK_EQ(ft_result.left, static_cast<int32_t>(bounds.fLeft * upem));
-    CHECK_EQ(ft_result.bottom, -static_cast<int32_t>(bounds.fTop * upem));
-    CHECK_EQ(ft_result.right, static_cast<int32_t>(bounds.fRight * upem));
-    CHECK_EQ(ft_result.top, -static_cast<int32_t>(bounds.fBottom * upem));
+    SkFont font(skia_typeface_, GetUnitsPerEm());
+    SkFontMetrics metrics;
+    font.getMetrics(&metrics);
+    CHECK_EQ(ft_result.left, static_cast<int32_t>(metrics.fXMin));
+    CHECK_EQ(ft_result.bottom, -static_cast<int32_t>(metrics.fTop));
+    CHECK_EQ(ft_result.right, static_cast<int32_t>(metrics.fXMax));
+    CHECK_EQ(ft_result.top, -static_cast<int32_t>(metrics.fBottom));
   }
 #endif
   return ft_result;