summaryrefslogtreecommitdiff
path: root/core/fpdfapi
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 /core/fpdfapi
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
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_cidfont.cpp7
1 files changed, 5 insertions, 2 deletions
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) {