summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornpm <npm@chromium.org>2016-09-01 13:09:11 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-01 13:09:11 -0700
commitf4bf0b22d7fd04be99f05b89008598956cc4ded0 (patch)
treed23620d2f232c1ec8f3bccae9fbf42fc2a5f5752
parentfa295d929c4806b8d3e56cf44a06d30c94e55b06 (diff)
downloadpdfium-f4bf0b22d7fd04be99f05b89008598956cc4ded0.tar.xz
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
-rw-r--r--DEPS2
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_cidfont.cpp7
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) {