| 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 #ifndef CORE_FPDFAPI_FPDF_FONT_FONT_INT_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_FONT_FONT_INT_H_ |
| 8 #define CORE_FPDFAPI_FPDF_FONT_FONT_INT_H_ | 8 #define CORE_FPDFAPI_FPDF_FONT_FONT_INT_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 CPDF_CMapParser(); | 91 CPDF_CMapParser(); |
| 92 ~CPDF_CMapParser() {} | 92 ~CPDF_CMapParser() {} |
| 93 FX_BOOL Initialize(CPDF_CMap* pMap); | 93 FX_BOOL Initialize(CPDF_CMap* pMap); |
| 94 void ParseWord(const CFX_ByteStringC& str); | 94 void ParseWord(const CFX_ByteStringC& str); |
| 95 CFX_BinaryBuf m_AddMaps; | 95 CFX_BinaryBuf m_AddMaps; |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 friend class fpdf_font_cid_CMap_GetCode_Test; | 98 friend class fpdf_font_cid_CMap_GetCode_Test; |
| 99 friend class fpdf_font_cid_CMap_GetCodeRange_Test; | 99 friend class fpdf_font_cid_CMap_GetCodeRange_Test; |
| 100 | 100 |
| 101 static FX_DWORD CMap_GetCode(const CFX_ByteStringC& word); | 101 static uint32_t CMap_GetCode(const CFX_ByteStringC& word); |
| 102 static bool CMap_GetCodeRange(CMap_CodeRange& range, | 102 static bool CMap_GetCodeRange(CMap_CodeRange& range, |
| 103 const CFX_ByteStringC& first, | 103 const CFX_ByteStringC& first, |
| 104 const CFX_ByteStringC& second); | 104 const CFX_ByteStringC& second); |
| 105 | 105 |
| 106 CPDF_CMap* m_pCMap; | 106 CPDF_CMap* m_pCMap; |
| 107 int m_Status; | 107 int m_Status; |
| 108 int m_CodeSeq; | 108 int m_CodeSeq; |
| 109 FX_DWORD m_CodePoints[4]; | 109 uint32_t m_CodePoints[4]; |
| 110 CFX_ArrayTemplate<CMap_CodeRange> m_CodeRanges; | 110 CFX_ArrayTemplate<CMap_CodeRange> m_CodeRanges; |
| 111 CFX_ByteString m_Registry, m_Ordering, m_Supplement; | 111 CFX_ByteString m_Registry, m_Ordering, m_Supplement; |
| 112 CFX_ByteString m_LastWord; | 112 CFX_ByteString m_LastWord; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 enum CIDCoding : uint8_t { | 115 enum CIDCoding : uint8_t { |
| 116 CIDCODING_UNKNOWN = 0, | 116 CIDCODING_UNKNOWN = 0, |
| 117 CIDCODING_GB, | 117 CIDCODING_GB, |
| 118 CIDCODING_BIG5, | 118 CIDCODING_BIG5, |
| 119 CIDCODING_JIS, | 119 CIDCODING_JIS, |
| 120 CIDCODING_KOREA, | 120 CIDCODING_KOREA, |
| 121 CIDCODING_UCS2, | 121 CIDCODING_UCS2, |
| 122 CIDCODING_CID, | 122 CIDCODING_CID, |
| 123 CIDCODING_UTF16, | 123 CIDCODING_UTF16, |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 class CPDF_CMap { | 126 class CPDF_CMap { |
| 127 public: | 127 public: |
| 128 enum CodingScheme : uint8_t { | 128 enum CodingScheme : uint8_t { |
| 129 OneByte, | 129 OneByte, |
| 130 TwoBytes, | 130 TwoBytes, |
| 131 MixedTwoBytes, | 131 MixedTwoBytes, |
| 132 MixedFourBytes | 132 MixedFourBytes |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 CPDF_CMap(); | 135 CPDF_CMap(); |
| 136 FX_BOOL LoadPredefined(CPDF_CMapManager* pMgr, | 136 FX_BOOL LoadPredefined(CPDF_CMapManager* pMgr, |
| 137 const FX_CHAR* name, | 137 const FX_CHAR* name, |
| 138 FX_BOOL bPromptCJK); | 138 FX_BOOL bPromptCJK); |
| 139 FX_BOOL LoadEmbedded(const uint8_t* pData, FX_DWORD dwSize); | 139 FX_BOOL LoadEmbedded(const uint8_t* pData, uint32_t dwSize); |
| 140 void Release(); | 140 void Release(); |
| 141 FX_BOOL IsLoaded() const { return m_bLoaded; } | 141 FX_BOOL IsLoaded() const { return m_bLoaded; } |
| 142 FX_BOOL IsVertWriting() const { return m_bVertical; } | 142 FX_BOOL IsVertWriting() const { return m_bVertical; } |
| 143 uint16_t CIDFromCharCode(FX_DWORD charcode) const; | 143 uint16_t CIDFromCharCode(uint32_t charcode) const; |
| 144 FX_DWORD CharCodeFromCID(uint16_t CID) const; | 144 uint32_t CharCodeFromCID(uint16_t CID) const; |
| 145 int GetCharSize(FX_DWORD charcode) const; | 145 int GetCharSize(uint32_t charcode) const; |
| 146 FX_DWORD GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const; | 146 uint32_t GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const; |
| 147 int CountChar(const FX_CHAR* pString, int size) const; | 147 int CountChar(const FX_CHAR* pString, int size) const; |
| 148 int AppendChar(FX_CHAR* str, FX_DWORD charcode) const; | 148 int AppendChar(FX_CHAR* str, uint32_t charcode) const; |
| 149 | 149 |
| 150 protected: | 150 protected: |
| 151 ~CPDF_CMap(); | 151 ~CPDF_CMap(); |
| 152 friend class CPDF_CMapParser; | 152 friend class CPDF_CMapParser; |
| 153 friend class CPDF_CMapManager; | 153 friend class CPDF_CMapManager; |
| 154 friend class CPDF_CIDFont; | 154 friend class CPDF_CIDFont; |
| 155 | 155 |
| 156 CFX_ByteString m_PredefinedCMap; | 156 CFX_ByteString m_PredefinedCMap; |
| 157 FX_BOOL m_bVertical; | 157 FX_BOOL m_bVertical; |
| 158 CIDSet m_Charset; | 158 CIDSet m_Charset; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 172 CPDF_CID2UnicodeMap(); | 172 CPDF_CID2UnicodeMap(); |
| 173 ~CPDF_CID2UnicodeMap(); | 173 ~CPDF_CID2UnicodeMap(); |
| 174 FX_BOOL Initialize(); | 174 FX_BOOL Initialize(); |
| 175 FX_BOOL IsLoaded(); | 175 FX_BOOL IsLoaded(); |
| 176 void Load(CPDF_CMapManager* pMgr, CIDSet charset, FX_BOOL bPromptCJK); | 176 void Load(CPDF_CMapManager* pMgr, CIDSet charset, FX_BOOL bPromptCJK); |
| 177 FX_WCHAR UnicodeFromCID(uint16_t CID); | 177 FX_WCHAR UnicodeFromCID(uint16_t CID); |
| 178 | 178 |
| 179 protected: | 179 protected: |
| 180 CIDSet m_Charset; | 180 CIDSet m_Charset; |
| 181 const uint16_t* m_pEmbeddedMap; | 181 const uint16_t* m_pEmbeddedMap; |
| 182 FX_DWORD m_EmbeddedCount; | 182 uint32_t m_EmbeddedCount; |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 class CPDF_ToUnicodeMap { | 185 class CPDF_ToUnicodeMap { |
| 186 public: | 186 public: |
| 187 void Load(CPDF_Stream* pStream); | 187 void Load(CPDF_Stream* pStream); |
| 188 CFX_WideString Lookup(FX_DWORD charcode); | 188 CFX_WideString Lookup(uint32_t charcode); |
| 189 FX_DWORD ReverseLookup(FX_WCHAR unicode); | 189 uint32_t ReverseLookup(FX_WCHAR unicode); |
| 190 | 190 |
| 191 protected: | 191 protected: |
| 192 std::map<FX_DWORD, FX_DWORD> m_Map; | 192 std::map<uint32_t, uint32_t> m_Map; |
| 193 CPDF_CID2UnicodeMap* m_pBaseMap; | 193 CPDF_CID2UnicodeMap* m_pBaseMap; |
| 194 CFX_WideTextBuf m_MultiCharBuf; | 194 CFX_WideTextBuf m_MultiCharBuf; |
| 195 | 195 |
| 196 private: | 196 private: |
| 197 friend class fpdf_font_StringToCode_Test; | 197 friend class fpdf_font_StringToCode_Test; |
| 198 friend class fpdf_font_StringToWideString_Test; | 198 friend class fpdf_font_StringToWideString_Test; |
| 199 | 199 |
| 200 static FX_DWORD StringToCode(const CFX_ByteStringC& str); | 200 static uint32_t StringToCode(const CFX_ByteStringC& str); |
| 201 static CFX_WideString StringToWideString(const CFX_ByteStringC& str); | 201 static CFX_WideString StringToWideString(const CFX_ByteStringC& str); |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 void FPDFAPI_LoadCID2UnicodeMap(CIDSet charset, | 204 void FPDFAPI_LoadCID2UnicodeMap(CIDSet charset, |
| 205 const uint16_t*& pMap, | 205 const uint16_t*& pMap, |
| 206 FX_DWORD& count); | 206 uint32_t& count); |
| 207 | 207 |
| 208 #endif // CORE_FPDFAPI_FPDF_FONT_FONT_INT_H_ | 208 #endif // CORE_FPDFAPI_FPDF_FONT_FONT_INT_H_ |
| OLD | NEW |