From 1a99f200c59a89fe297ac79658d2fe11b13b1553 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 13 Aug 2018 19:28:39 +0000 Subject: Mark CPDF_Font::GlyphFromCharCodeExt() and friends Mac only. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4906351a6e21fb8480670a6daf15bd7cb9e441c5 Reviewed-on: https://pdfium-review.googlesource.com/39911 Commit-Queue: Lei Zhang Reviewed-by: Nicolás Peña Moreno --- core/fpdfapi/font/cpdf_type1font.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'core/fpdfapi/font/cpdf_type1font.cpp') diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp index 8d0eafcc97..9e2f4eff58 100644 --- a/core/fpdfapi/font/cpdf_type1font.cpp +++ b/core/fpdfapi/font/cpdf_type1font.cpp @@ -62,7 +62,11 @@ bool FT_UseType1Charmap(FXFT_Face face) { CPDF_Type1Font::CPDF_Type1Font(CPDF_Document* pDocument, CPDF_Dictionary* pFontDict) - : CPDF_SimpleFont(pDocument, pFontDict) {} + : CPDF_SimpleFont(pDocument, pFontDict) { +#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ + memset(m_ExtGID, 0xff, sizeof(m_ExtGID)); +#endif +} CPDF_Type1Font::~CPDF_Type1Font() = default; @@ -102,16 +106,15 @@ bool CPDF_Type1Font::Load() { return LoadCommon(); } +#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ int CPDF_Type1Font::GlyphFromCharCodeExt(uint32_t charcode) { - if (charcode > 0xff) { + if (charcode > 0xff) return -1; - } - int index = m_ExtGID[(uint8_t)charcode]; - if (index == 0xffff) { - return -1; - } - return index; + + int index = m_ExtGID[static_cast(charcode)]; + return index != 0xffff ? index : -1; } +#endif void CPDF_Type1Font::LoadGlyphMap() { if (!m_Font.GetFace()) -- cgit v1.2.3