| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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 "../../../include/fpdfapi/fpdf_module.h" | 7 #include "../../../include/fpdfapi/fpdf_module.h" |
| 8 #include "../../../include/fpdfapi/fpdf_page.h" | 8 #include "../../../include/fpdfapi/fpdf_page.h" |
| 9 #include "../../../include/fpdfapi/fpdf_resource.h" | 9 #include "../../../include/fpdfapi/fpdf_resource.h" |
| 10 #include "../../../include/fxge/fx_freetype.h" | 10 #include "../../../include/fxge/fx_freetype.h" |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 } | 825 } |
| 826 FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const { | 826 FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const { |
| 827 if (m_pCMap == NULL) { | 827 if (m_pCMap == NULL) { |
| 828 return (FX_WORD)charcode; | 828 return (FX_WORD)charcode; |
| 829 } | 829 } |
| 830 return m_pCMap->CIDFromCharCode(charcode); | 830 return m_pCMap->CIDFromCharCode(charcode); |
| 831 } | 831 } |
| 832 FX_BOOL CPDF_CIDFont::IsVertWriting() const { | 832 FX_BOOL CPDF_CIDFont::IsVertWriting() const { |
| 833 return m_pCMap ? m_pCMap->IsVertWriting() : FALSE; | 833 return m_pCMap ? m_pCMap->IsVertWriting() : FALSE; |
| 834 } | 834 } |
| 835 |
| 836 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| 835 extern FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, FX_WORD cid); | 837 extern FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, FX_WORD cid); |
| 836 static FX_DWORD _EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, | 838 static FX_DWORD _EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, |
| 837 int charset, | 839 int charset, |
| 838 FX_WCHAR unicode) { | 840 FX_WCHAR unicode) { |
| 839 if (charset <= 0 || charset > 4) { | 841 if (charset <= 0 || charset > 4) { |
| 840 return 0; | 842 return 0; |
| 841 } | 843 } |
| 842 CPDF_FontGlobals* pFontGlobals = | 844 CPDF_FontGlobals* pFontGlobals = |
| 843 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); | 845 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); |
| 844 const FX_WORD* pCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_pMap; | 846 const FX_WORD* pCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_pMap; |
| 845 if (pCodes == NULL) { | 847 if (pCodes == NULL) { |
| 846 return 0; | 848 return 0; |
| 847 } | 849 } |
| 848 int nCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_Count; | 850 int nCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_Count; |
| 849 for (int i = 0; i < nCodes; i++) { | 851 for (int i = 0; i < nCodes; i++) { |
| 850 if (pCodes[i] == unicode) { | 852 if (pCodes[i] == unicode) { |
| 851 FX_DWORD CharCode = FPDFAPI_CharCodeFromCID(pEmbedMap, i); | 853 FX_DWORD CharCode = FPDFAPI_CharCodeFromCID(pEmbedMap, i); |
| 852 if (CharCode == 0) { | 854 if (CharCode == 0) { |
| 853 continue; | 855 continue; |
| 854 } | 856 } |
| 855 return CharCode; | 857 return CharCode; |
| 856 } | 858 } |
| 857 } | 859 } |
| 858 return 0; | 860 return 0; |
| 859 } | 861 } |
| 862 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| 863 |
| 860 static FX_WCHAR _EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap, | 864 static FX_WCHAR _EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap, |
| 861 int charset, | 865 int charset, |
| 862 FX_DWORD charcode) { | 866 FX_DWORD charcode) { |
| 863 if (charset <= 0 || charset > 4) { | 867 if (charset <= 0 || charset > 4) { |
| 864 return 0; | 868 return 0; |
| 865 } | 869 } |
| 866 FX_WORD cid = FPDFAPI_CIDFromCharCode(pEmbedMap, charcode); | 870 FX_WORD cid = FPDFAPI_CIDFromCharCode(pEmbedMap, charcode); |
| 867 if (cid == 0) { | 871 if (cid == 0) { |
| 868 return 0; | 872 return 0; |
| 869 } | 873 } |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 if (middlecode > CID) { | 1654 if (middlecode > CID) { |
| 1651 end = middle - 1; | 1655 end = middle - 1; |
| 1652 } else if (middlecode < CID) { | 1656 } else if (middlecode < CID) { |
| 1653 begin = middle + 1; | 1657 begin = middle + 1; |
| 1654 } else { | 1658 } else { |
| 1655 return &Japan1_VertCIDs[middle].a; | 1659 return &Japan1_VertCIDs[middle].a; |
| 1656 } | 1660 } |
| 1657 } | 1661 } |
| 1658 return NULL; | 1662 return NULL; |
| 1659 } | 1663 } |
| OLD | NEW |