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 --- DEPS | 2 +- core/fpdfapi/fpdf_font/cpdf_cidfont.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 37c9ac552c..d17f7e0230 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,7 @@ vars = { 'gmock_revision': '29763965ab52f24565299976b936d1265cb6a271', 'gtest_revision': '8245545b6dc9c4703e6496d1efd19e975ad2b038', 'icu_revision': '2341038bf72869a5683a893a2b319a48ffec7f62', - 'pdfium_tests_revision': '5867fa68fa3e00016d3e31374e84eb01a3db6ac7', + 'pdfium_tests_revision': 'a7f9103f929c6ab5e2188c629d61797548e9c200', 'skia_revision': '3ee255f259541eff1251c8007f9135e8d664346a', 'tools_memory_revision': '427f10475e1a8d72424c29d00bf689122b738e5d', 'trace_event_revision': '54b8455be9505c2cb0cf5c26bb86739c236471aa', 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