summaryrefslogtreecommitdiff
path: root/core/fxge/cfx_fontmapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge/cfx_fontmapper.cpp')
-rw-r--r--core/fxge/cfx_fontmapper.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index 461094d81e..0a38952d61 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -357,10 +357,10 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont,
if (iBaseFont < kNumStandardFonts) {
if (m_FoxitFaces[iBaseFont])
return m_FoxitFaces[iBaseFont];
- const uint8_t* pFontData = nullptr;
- uint32_t size = 0;
- if (m_pFontMgr->GetBuiltinFont(iBaseFont, &pFontData, &size)) {
- m_FoxitFaces[iBaseFont] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
+ Optional<pdfium::span<const uint8_t>> font_data =
+ m_pFontMgr->GetBuiltinFont(iBaseFont);
+ if (font_data.has_value()) {
+ m_FoxitFaces[iBaseFont] = m_pFontMgr->GetFixedFace(font_data.value(), 0);
return m_FoxitFaces[iBaseFont];
}
}
@@ -371,21 +371,17 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont,
if (FontFamilyIsRoman(pitch_family)) {
pSubstFont->m_Weight = pSubstFont->m_Weight * 4 / 5;
pSubstFont->m_Family = "Chrome Serif";
- if (m_MMFaces[1])
- return m_MMFaces[1];
- const uint8_t* pFontData = nullptr;
- uint32_t size = 0;
- m_pFontMgr->GetBuiltinFont(14, &pFontData, &size);
- m_MMFaces[1] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
+ if (!m_MMFaces[1]) {
+ m_MMFaces[1] =
+ m_pFontMgr->GetFixedFace(m_pFontMgr->GetBuiltinFont(14).value(), 0);
+ }
return m_MMFaces[1];
}
pSubstFont->m_Family = "Chrome Sans";
- if (m_MMFaces[0])
- return m_MMFaces[0];
- const uint8_t* pFontData = nullptr;
- uint32_t size = 0;
- m_pFontMgr->GetBuiltinFont(15, &pFontData, &size);
- m_MMFaces[0] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
+ if (!m_MMFaces[0]) {
+ m_MMFaces[0] =
+ m_pFontMgr->GetFixedFace(m_pFontMgr->GetBuiltinFont(15).value(), 0);
+ }
return m_MMFaces[0];
}