OLD | NEW |
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/font/cpdf_fontencoding.h" | 7 #include "core/fpdfapi/font/cpdf_fontencoding.h" |
8 | 8 |
9 #include "core/fpdfapi/parser/cpdf_array.h" | 9 #include "core/fpdfapi/parser/cpdf_array.h" |
10 #include "core/fpdfapi/parser/cpdf_dictionary.h" | 10 #include "core/fpdfapi/parser/cpdf_dictionary.h" |
(...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding) { | 1658 CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding) { |
1659 const uint16_t* pSrc = PDF_UnicodesForPredefinedCharSet(PredefinedEncoding); | 1659 const uint16_t* pSrc = PDF_UnicodesForPredefinedCharSet(PredefinedEncoding); |
1660 if (!pSrc) { | 1660 if (!pSrc) { |
1661 FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes)); | 1661 FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes)); |
1662 } else { | 1662 } else { |
1663 for (int i = 0; i < 256; i++) | 1663 for (int i = 0; i < 256; i++) |
1664 m_Unicodes[i] = pSrc[i]; | 1664 m_Unicodes[i] = pSrc[i]; |
1665 } | 1665 } |
1666 } | 1666 } |
1667 | 1667 |
1668 FX_BOOL CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const { | 1668 bool CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const { |
1669 return FXSYS_memcmp(m_Unicodes, pAnother->m_Unicodes, sizeof(m_Unicodes)) == | 1669 return FXSYS_memcmp(m_Unicodes, pAnother->m_Unicodes, sizeof(m_Unicodes)) == |
1670 0; | 1670 0; |
1671 } | 1671 } |
1672 | 1672 |
1673 CPDF_Object* CPDF_FontEncoding::Realize(CFX_WeakPtr<CFX_ByteStringPool> pPool) { | 1673 CPDF_Object* CPDF_FontEncoding::Realize(CFX_WeakPtr<CFX_ByteStringPool> pPool) { |
1674 int predefined = 0; | 1674 int predefined = 0; |
1675 for (int cs = PDFFONT_ENCODING_WINANSI; cs < PDFFONT_ENCODING_ZAPFDINGBATS; | 1675 for (int cs = PDFFONT_ENCODING_WINANSI; cs < PDFFONT_ENCODING_ZAPFDINGBATS; |
1676 cs++) { | 1676 cs++) { |
1677 const uint16_t* pSrc = PDF_UnicodesForPredefinedCharSet(cs); | 1677 const uint16_t* pSrc = PDF_UnicodesForPredefinedCharSet(cs); |
1678 FX_BOOL match = TRUE; | 1678 bool match = true; |
1679 for (int i = 0; i < 256; ++i) { | 1679 for (int i = 0; i < 256; ++i) { |
1680 if (m_Unicodes[i] != pSrc[i]) { | 1680 if (m_Unicodes[i] != pSrc[i]) { |
1681 match = FALSE; | 1681 match = false; |
1682 break; | 1682 break; |
1683 } | 1683 } |
1684 } | 1684 } |
1685 if (match) { | 1685 if (match) { |
1686 predefined = cs; | 1686 predefined = cs; |
1687 break; | 1687 break; |
1688 } | 1688 } |
1689 } | 1689 } |
1690 if (predefined) { | 1690 if (predefined) { |
1691 if (predefined == PDFFONT_ENCODING_WINANSI) { | 1691 if (predefined == PDFFONT_ENCODING_WINANSI) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 return MacExpertEncoding[(uint8_t)charcode]; | 1809 return MacExpertEncoding[(uint8_t)charcode]; |
1810 case FXFT_ENCODING_ADOBE_LATIN_1: | 1810 case FXFT_ENCODING_ADOBE_LATIN_1: |
1811 return AdobeWinAnsiEncoding[(uint8_t)charcode]; | 1811 return AdobeWinAnsiEncoding[(uint8_t)charcode]; |
1812 case FXFT_ENCODING_APPLE_ROMAN: | 1812 case FXFT_ENCODING_APPLE_ROMAN: |
1813 return MacRomanEncoding[(uint8_t)charcode]; | 1813 return MacRomanEncoding[(uint8_t)charcode]; |
1814 case PDFFONT_ENCODING_PDFDOC: | 1814 case PDFFONT_ENCODING_PDFDOC: |
1815 return PDFDocEncoding[(uint8_t)charcode]; | 1815 return PDFDocEncoding[(uint8_t)charcode]; |
1816 } | 1816 } |
1817 return 0; | 1817 return 0; |
1818 } | 1818 } |
OLD | NEW |