From f4bf0b22d7fd04be99f05b89008598956cc4ded0 Mon Sep 17 00:00:00 2001 From: npm Date: Thu, 1 Sep 2016 13:09:11 -0700 Subject: Fix CPDF_CIDFont::GlyphFromCharCode for fonts flagged with PDFFONT_SYMBOLIC UnicodeFromCharCode should be tried even if the font is flagged as PDFFONT_SYMBOLIC. The result should be checked in case it's empty. This fixes some corpus tests that were being incorrectly rendered, as well as the bug below. A deps change will be required before landing this CL. BUG=chromium:591303 Review-Url: https://codereview.chromium.org/2300893003 --- core/fpdfapi/fpdf_font/cpdf_cidfont.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core/fpdfapi') diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp index 2bd886754e..df087810f8 100644 --- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp @@ -631,8 +631,11 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) { unicode = m_pCID2UnicodeMap->UnicodeFromCID(cid); if (unicode == 0) unicode = GetUnicodeFromCharCode(charcode); - if (unicode == 0 && !(m_Flags & PDFFONT_SYMBOLIC)) - unicode = UnicodeFromCharCode(charcode).GetAt(0); + if (unicode == 0) { + CFX_WideString unicode_str = UnicodeFromCharCode(charcode); + if (!unicode_str.IsEmpty()) + unicode = unicode_str.GetAt(0); + } } FXFT_Face face = m_Font.GetFace(); if (unicode == 0) { -- cgit v1.2.3