| 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 "core/fpdfapi/fpdf_font/font_int.h" | 7 #include "core/fpdfapi/fpdf_font/font_int.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" | 9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" |
| 10 #include "core/fpdfapi/fpdf_font/ttgsubtable.h" | 10 #include "core/fpdfapi/fpdf_font/ttgsubtable.h" |
| (...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 charcode = (charcode % 256) * 256 + (charcode / 256); | 1045 charcode = (charcode % 256) * 256 + (charcode / 256); |
| 1046 charsize = 2; | 1046 charsize = 2; |
| 1047 } | 1047 } |
| 1048 int ret = FXSYS_MultiByteToWideChar(g_CharsetCPs[m_pCMap->m_Coding], 0, | 1048 int ret = FXSYS_MultiByteToWideChar(g_CharsetCPs[m_pCMap->m_Coding], 0, |
| 1049 (const FX_CHAR*)&charcode, charsize, | 1049 (const FX_CHAR*)&charcode, charsize, |
| 1050 &unicode, 1); | 1050 &unicode, 1); |
| 1051 if (ret != 1) { | 1051 if (ret != 1) { |
| 1052 return 0; | 1052 return 0; |
| 1053 } | 1053 } |
| 1054 return unicode; | 1054 return unicode; |
| 1055 #endif | 1055 #else |
| 1056 if (m_pCMap->m_pEmbedMap) { | 1056 if (m_pCMap->m_pEmbedMap) { |
| 1057 return EmbeddedUnicodeFromCharcode(m_pCMap->m_pEmbedMap, | 1057 return EmbeddedUnicodeFromCharcode(m_pCMap->m_pEmbedMap, |
| 1058 m_pCMap->m_Charset, charcode); | 1058 m_pCMap->m_Charset, charcode); |
| 1059 } | 1059 } |
| 1060 return 0; | 1060 return 0; |
| 1061 #endif |
| 1061 } | 1062 } |
| 1062 return m_pCID2UnicodeMap->UnicodeFromCID(CIDFromCharCode(charcode)); | 1063 return m_pCID2UnicodeMap->UnicodeFromCID(CIDFromCharCode(charcode)); |
| 1063 } | 1064 } |
| 1064 | 1065 |
| 1065 FX_DWORD CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const { | 1066 FX_DWORD CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const { |
| 1066 FX_DWORD charcode = CPDF_Font::CharCodeFromUnicode(unicode); | 1067 FX_DWORD charcode = CPDF_Font::CharCodeFromUnicode(unicode); |
| 1067 if (charcode) | 1068 if (charcode) |
| 1068 return charcode; | 1069 return charcode; |
| 1069 switch (m_pCMap->m_Coding) { | 1070 switch (m_pCMap->m_Coding) { |
| 1070 case CIDCODING_UNKNOWN: | 1071 case CIDCODING_UNKNOWN: |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1668 | 1669 |
| 1669 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { | 1670 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { |
| 1670 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) | 1671 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) |
| 1671 return nullptr; | 1672 return nullptr; |
| 1672 | 1673 |
| 1673 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( | 1674 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( |
| 1674 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), | 1675 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), |
| 1675 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); | 1676 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); |
| 1676 return found ? &found->a : nullptr; | 1677 return found ? &found->a : nullptr; |
| 1677 } | 1678 } |
| OLD | NEW |