Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: core/fpdfapi/fpdf_font/cpdf_cidfont.cpp

Issue 2300893003: Try UnicodeFromCharCode even with PDFFONT_SYMBOLIC (Closed)
Patch Set: Change DEPS Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h" 7 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 if (uni_str.IsEmpty()) 624 if (uni_str.IsEmpty())
625 return cid; 625 return cid;
626 626
627 unicode = uni_str.GetAt(0); 627 unicode = uni_str.GetAt(0);
628 #endif 628 #endif
629 } else { 629 } else {
630 if (cid && m_pCID2UnicodeMap && m_pCID2UnicodeMap->IsLoaded()) 630 if (cid && m_pCID2UnicodeMap && m_pCID2UnicodeMap->IsLoaded())
631 unicode = m_pCID2UnicodeMap->UnicodeFromCID(cid); 631 unicode = m_pCID2UnicodeMap->UnicodeFromCID(cid);
632 if (unicode == 0) 632 if (unicode == 0)
633 unicode = GetUnicodeFromCharCode(charcode); 633 unicode = GetUnicodeFromCharCode(charcode);
634 if (unicode == 0 && !(m_Flags & PDFFONT_SYMBOLIC)) 634 if (unicode == 0) {
635 unicode = UnicodeFromCharCode(charcode).GetAt(0); 635 CFX_WideString unicode_str = UnicodeFromCharCode(charcode);
636 if (!unicode_str.IsEmpty())
637 unicode = unicode_str.GetAt(0);
638 }
636 } 639 }
637 FXFT_Face face = m_Font.GetFace(); 640 FXFT_Face face = m_Font.GetFace();
638 if (unicode == 0) { 641 if (unicode == 0) {
639 if (!m_bAdobeCourierStd) 642 if (!m_bAdobeCourierStd)
640 return charcode ? static_cast<int>(charcode) : -1; 643 return charcode ? static_cast<int>(charcode) : -1;
641 644
642 charcode += 31; 645 charcode += 31;
643 bool bMSUnicode = FT_UseTTCharmap(face, 3, 1); 646 bool bMSUnicode = FT_UseTTCharmap(face, 3, 1);
644 bool bMacRoman = !bMSUnicode && FT_UseTTCharmap(face, 1, 0); 647 bool bMacRoman = !bMSUnicode && FT_UseTTCharmap(face, 1, 0);
645 int iBaseEncoding = PDFFONT_ENCODING_STANDARD; 648 int iBaseEncoding = PDFFONT_ENCODING_STANDARD;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { 853 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const {
851 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) 854 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile)
852 return nullptr; 855 return nullptr;
853 856
854 const auto* pEnd = g_Japan1_VertCIDs + FX_ArraySize(g_Japan1_VertCIDs); 857 const auto* pEnd = g_Japan1_VertCIDs + FX_ArraySize(g_Japan1_VertCIDs);
855 const auto* pTransform = std::lower_bound( 858 const auto* pTransform = std::lower_bound(
856 g_Japan1_VertCIDs, pEnd, CID, 859 g_Japan1_VertCIDs, pEnd, CID,
857 [](const CIDTransform& entry, uint16_t cid) { return entry.cid < cid; }); 860 [](const CIDTransform& entry, uint16_t cid) { return entry.cid < cid; });
858 return pTransform < pEnd && CID == pTransform->cid ? &pTransform->a : nullptr; 861 return pTransform < pEnd && CID == pTransform->cid ? &pTransform->a : nullptr;
859 } 862 }
OLDNEW
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698