From 20c41a5a47b2460277897a1059789fc9e184e3ab Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 29 Aug 2018 23:53:53 +0000 Subject: Use pdfium::span<>/UnownedPtr in CFX_Font. Move some platform-specific ifdefs so the come last in each section as it is easier to read, perhaps. Change-Id: Ic1c2652c46ecebc63b66213735ed6d94737a7f32 Reviewed-on: https://pdfium-review.googlesource.com/41630 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- core/fpdfapi/font/cpdf_font.cpp | 4 +--- core/fpdfapi/font/cpdf_type1font.cpp | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'core/fpdfapi/font') diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp index 9b83733eea..298911e2cd 100644 --- a/core/fpdfapi/font/cpdf_font.cpp +++ b/core/fpdfapi/font/cpdf_font.cpp @@ -208,9 +208,7 @@ void CPDF_Font::LoadFontDescriptor(const CPDF_Dictionary* pFontDesc) { if (!m_pFontFile) return; - const uint8_t* pFontData = m_pFontFile->GetData(); - uint32_t dwFontSize = m_pFontFile->GetSize(); - if (!m_Font.LoadEmbedded(pFontData, dwFontSize)) { + if (!m_Font.LoadEmbedded(m_pFontFile->GetSpan())) { m_pDocument->GetPageData()->MaybePurgeFontFileStreamAcc( m_pFontFile->GetStream()->AsStream()); m_pFontFile = nullptr; diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp index 44e6b3e23c..7fb7ce6b54 100644 --- a/core/fpdfapi/font/cpdf_type1font.cpp +++ b/core/fpdfapi/font/cpdf_type1font.cpp @@ -129,8 +129,8 @@ void CPDF_Type1Font::LoadGlyphMap() { if (m_Font.GetPsName() == "DFHeiStd-W5") bCoreText = false; - m_Font.SetPlatformFont( - quartz2d.CreateFont(m_Font.GetFontData(), m_Font.GetSize())); + pdfium::span span = m_Font.GetFontSpan(); + m_Font.SetPlatformFont(quartz2d.CreateFont(span.data(), span.size())); if (!m_Font.GetPlatformFont()) bCoreText = false; } -- cgit v1.2.3