From 84be3a3cfec5107aac9a58ea00b58b733d393c7d Mon Sep 17 00:00:00 2001 From: npm Date: Thu, 15 Sep 2016 13:27:21 -0700 Subject: Use ToUnicode mapping even when unicode is 0. CPDF_Font::UnicodeFromCharcode returns 0 only if ToUnicode map maps the charcode to 0. CPDF_SimpleFont::UnicodeFromCharcode and CPDF_CID_Font:: UnicodeFromCharCode return 0 only if the call to CPDF_Font returns 0. In other cases, these methods return an empty string. So when processing text, a 0 return from the method should not be replaced with the charcode. BUG=pdfium:583 Review-Url: https://codereview.chromium.org/2342073002 --- core/fpdftext/cpdf_textpage.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'core') diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index c691d4b3a0..1056943292 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -1131,12 +1131,8 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { spacing = 0; CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode); bool bNoUnicode = false; - FX_WCHAR wChar = wstrItem.GetAt(0); - if ((wstrItem.IsEmpty() || wChar == 0) && item.m_CharCode) { - if (wstrItem.IsEmpty()) - wstrItem += (FX_WCHAR)item.m_CharCode; - else - wstrItem.SetAt(0, (FX_WCHAR)item.m_CharCode); + if (wstrItem.IsEmpty() && item.m_CharCode) { + wstrItem += static_cast(item.m_CharCode); bNoUnicode = true; } charinfo.m_Index = -1; -- cgit v1.2.3