Pass spans to CQuartz2D::CreateFont() on Mac.

Avoids casting back and forth from uint32_t.

Change-Id: I5e5b1b9506f284e7e4164c876d0c28d6611edff2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/88530
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/apple/fx_apple_impl.cpp b/core/fxge/apple/fx_apple_impl.cpp
index fbd039e..8f2504a 100644
--- a/core/fxge/apple/fx_apple_impl.cpp
+++ b/core/fxge/apple/fx_apple_impl.cpp
@@ -54,8 +54,7 @@
     if (pFont->GetPsName() == "DFHeiStd-W5")
       return false;
 
-    pdfium::span<const uint8_t> span = pFont->GetFontSpan();
-    pFont->SetPlatformFont(quartz2d.CreateFont(span.data(), span.size()));
+    pFont->SetPlatformFont(quartz2d.CreateFont(pFont->GetFontSpan()));
     if (!pFont->GetPlatformFont())
       return false;
   }
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp
index 6f3e89c..bddc3ac 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -154,7 +154,7 @@
 
 void* CApplePlatform::CreatePlatformFont(
     pdfium::span<const uint8_t> font_span) {
-  return m_quartz2d.CreateFont(font_span.data(), font_span.size());
+  return m_quartz2d.CreateFont(font_span);
 }
 
 // static
diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp
index 1759b97..9eef74b 100644
--- a/core/fxge/apple/fx_quartz_device.cpp
+++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -46,9 +46,9 @@
     CGContextRelease((CGContextRef)graphics);
 }
 
-void* CQuartz2D::CreateFont(const uint8_t* pFontData, uint32_t dwFontSize) {
+void* CQuartz2D::CreateFont(pdfium::span<const uint8_t> pFontData) {
   CGDataProviderRef pDataProvider = CGDataProviderCreateWithData(
-      nullptr, pFontData, static_cast<size_t>(dwFontSize), nullptr);
+      nullptr, pFontData.data(), pFontData.size(), nullptr);
   if (!pDataProvider)
     return nullptr;
 
diff --git a/core/fxge/apple/fx_quartz_device.h b/core/fxge/apple/fx_quartz_device.h
index f39fee2..fa78f06 100644
--- a/core/fxge/apple/fx_quartz_device.h
+++ b/core/fxge/apple/fx_quartz_device.h
@@ -12,6 +12,7 @@
 
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxge/dib/fx_dib.h"
+#include "third_party/base/span.h"
 
 class CFX_DIBitmap;
 class CFX_Matrix;
@@ -21,7 +22,7 @@
   void* CreateGraphics(const RetainPtr<CFX_DIBitmap>& bitmap);
   void DestroyGraphics(void* graphics);
 
-  void* CreateFont(const uint8_t* pFontData, uint32_t dwFontSize);
+  void* CreateFont(pdfium::span<const uint8_t> pFontData);
   void DestroyFont(void* pFont);
   void SetGraphicsTextMatrix(void* graphics, const CFX_Matrix& matrix);
   bool DrawGraphicsString(void* graphics,