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_FONT_FONT_INT_H_ | 7 #ifndef CORE_FPDFAPI_FONT_FONT_INT_H_ |
8 #define CORE_FPDFAPI_FONT_FONT_INT_H_ | 8 #define CORE_FPDFAPI_FONT_FONT_INT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "core/fpdfapi/font/cpdf_cidfont.h" | 14 #include "core/fpdfapi/font/cpdf_cidfont.h" |
| 15 #include "core/fxcrt/cfx_maybe_owned.h" |
15 #include "core/fxcrt/fx_basic.h" | 16 #include "core/fxcrt/fx_basic.h" |
16 | 17 |
17 class CPDF_CID2UnicodeMap; | 18 class CPDF_CID2UnicodeMap; |
18 class CPDF_CMap; | 19 class CPDF_CMap; |
19 class CPDF_Font; | 20 class CPDF_Font; |
20 class CPDF_Stream; | 21 class CPDF_Stream; |
21 | 22 |
22 using FXFT_Library = void*; | 23 using FXFT_Library = void*; |
23 | 24 |
24 int TT2PDF(int m, FXFT_Face face); | 25 int TT2PDF(int m, FXFT_Face face); |
25 bool FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id); | 26 bool FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id); |
26 CIDSet CharsetFromOrdering(const CFX_ByteStringC& ordering); | 27 CIDSet CharsetFromOrdering(const CFX_ByteStringC& ordering); |
27 | 28 |
28 class CPDF_CMapManager { | 29 class CPDF_CMapManager { |
29 public: | 30 public: |
30 CPDF_CMapManager(); | 31 CPDF_CMapManager(); |
31 ~CPDF_CMapManager(); | 32 ~CPDF_CMapManager(); |
32 | 33 |
33 CPDF_CMap* GetPredefinedCMap(const CFX_ByteString& name, bool bPromptCJK); | 34 CFX_MaybeOwned<CPDF_CMap> GetPredefinedCMap(const CFX_ByteString& name, |
| 35 bool bPromptCJK); |
34 CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset, bool bPromptCJK); | 36 CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset, bool bPromptCJK); |
35 | 37 |
36 private: | 38 private: |
37 CPDF_CMap* LoadPredefinedCMap(const CFX_ByteString& name, bool bPromptCJK); | 39 std::unique_ptr<CPDF_CMap> LoadPredefinedCMap(const CFX_ByteString& name, |
38 CPDF_CID2UnicodeMap* LoadCID2UnicodeMap(CIDSet charset, bool bPromptCJK); | 40 bool bPromptCJK); |
| 41 std::unique_ptr<CPDF_CID2UnicodeMap> LoadCID2UnicodeMap(CIDSet charset, |
| 42 bool bPromptCJK); |
39 | 43 |
40 std::map<CFX_ByteString, CPDF_CMap*> m_CMaps; | 44 std::map<CFX_ByteString, std::unique_ptr<CPDF_CMap>> m_CMaps; |
41 CPDF_CID2UnicodeMap* m_CID2UnicodeMaps[6]; | 45 std::unique_ptr<CPDF_CID2UnicodeMap> m_CID2UnicodeMaps[6]; |
42 }; | 46 }; |
43 | 47 |
44 class CFX_StockFontArray { | 48 class CFX_StockFontArray { |
45 public: | 49 public: |
46 CFX_StockFontArray(); | 50 CFX_StockFontArray(); |
47 ~CFX_StockFontArray(); | 51 ~CFX_StockFontArray(); |
48 | 52 |
49 // Takes ownership of |pFont|, returns unowned pointer to it. | 53 // Takes ownership of |pFont|, returns unowned pointer to it. |
50 CPDF_Font* SetFont(uint32_t index, std::unique_ptr<CPDF_Font> pFont); | 54 CPDF_Font* SetFont(uint32_t index, std::unique_ptr<CPDF_Font> pFont); |
51 CPDF_Font* GetFont(uint32_t index) const; | 55 CPDF_Font* GetFont(uint32_t index) const; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 static CFX_WideString StringToWideString(const CFX_ByteStringC& str); | 202 static CFX_WideString StringToWideString(const CFX_ByteStringC& str); |
199 | 203 |
200 uint32_t GetUnicode(); | 204 uint32_t GetUnicode(); |
201 | 205 |
202 std::map<uint32_t, uint32_t> m_Map; | 206 std::map<uint32_t, uint32_t> m_Map; |
203 CPDF_CID2UnicodeMap* m_pBaseMap; | 207 CPDF_CID2UnicodeMap* m_pBaseMap; |
204 CFX_WideTextBuf m_MultiCharBuf; | 208 CFX_WideTextBuf m_MultiCharBuf; |
205 }; | 209 }; |
206 | 210 |
207 #endif // CORE_FPDFAPI_FONT_FONT_INT_H_ | 211 #endif // CORE_FPDFAPI_FONT_FONT_INT_H_ |
OLD | NEW |