Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Side by Side Diff: core/src/fpdfapi/fpdf_font/font_int.h

Issue 1566233002: Merge to XFA: Make m_pStockMap a real map. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_font/fpdf_font.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SRC_FPDFAPI_FPDF_FONT_FONT_INT_H_ 7 #ifndef CORE_SRC_FPDFAPI_FPDF_FONT_FONT_INT_H_
8 #define CORE_SRC_FPDFAPI_FPDF_FONT_FONT_INT_H_ 8 #define CORE_SRC_FPDFAPI_FPDF_FONT_FONT_INT_H_
9 9
10 #include <map> 10 #include <map>
11 #include <memory>
11 12
12 #include "core/include/fpdfapi/fpdf_resource.h" 13 #include "core/include/fpdfapi/fpdf_resource.h"
13 #include "core/include/fxcrt/fx_basic.h" 14 #include "core/include/fxcrt/fx_basic.h"
14 15
15 class CPDF_CID2UnicodeMap; 16 class CPDF_CID2UnicodeMap;
16 class CPDF_CMap; 17 class CPDF_CMap;
17 class CPDF_Font; 18 class CPDF_Font;
18 class CPDF_Stream; 19 class CPDF_Stream;
19 20
20 typedef void* FXFT_Library; 21 typedef void* FXFT_Library;
(...skipping 11 matching lines...) Expand all
32 void ReloadAll(); 33 void ReloadAll();
33 34
34 private: 35 private:
35 CPDF_CMap* LoadPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK); 36 CPDF_CMap* LoadPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK);
36 CPDF_CID2UnicodeMap* LoadCID2UnicodeMap(CIDSet charset, FX_BOOL bPromptCJK); 37 CPDF_CID2UnicodeMap* LoadCID2UnicodeMap(CIDSet charset, FX_BOOL bPromptCJK);
37 38
38 FX_BOOL m_bPrompted; 39 FX_BOOL m_bPrompted;
39 std::map<CFX_ByteString, CPDF_CMap*> m_CMaps; 40 std::map<CFX_ByteString, CPDF_CMap*> m_CMaps;
40 CPDF_CID2UnicodeMap* m_CID2UnicodeMaps[6]; 41 CPDF_CID2UnicodeMap* m_CID2UnicodeMaps[6];
41 }; 42 };
43
44 class CFX_StockFontArray {
45 public:
46 CFX_StockFontArray();
47 ~CFX_StockFontArray();
48
49 // Takes ownership of |pFont|.
50 void SetFont(int index, CPDF_Font* pFont);
51 CPDF_Font* GetFont(int index) const;
52
53 private:
54 std::unique_ptr<CPDF_Font> m_StockFonts[14];
55 };
56
42 class CPDF_FontGlobals { 57 class CPDF_FontGlobals {
43 public: 58 public:
44 CPDF_FontGlobals(); 59 CPDF_FontGlobals();
45 ~CPDF_FontGlobals(); 60 ~CPDF_FontGlobals();
46 void ClearAll(); 61
47 void Clear(void* key); 62 void Clear(CPDF_Document* pDoc);
48 CPDF_Font* Find(void* key, int index); 63 CPDF_Font* Find(CPDF_Document* pDoc, int index);
49 void Set(void* key, int index, CPDF_Font* pFont); 64
65 // Takes ownership of |pFont|.
66 void Set(CPDF_Document* key, int index, CPDF_Font* pFont);
67
50 CPDF_CMapManager m_CMapManager; 68 CPDF_CMapManager m_CMapManager;
51 struct { 69 struct {
52 const struct FXCMAP_CMap* m_pMapList; 70 const struct FXCMAP_CMap* m_pMapList;
53 int m_Count; 71 int m_Count;
54 } m_EmbeddedCharsets[CIDSET_NUM_SETS]; 72 } m_EmbeddedCharsets[CIDSET_NUM_SETS];
55 struct { 73 struct {
56 const FX_WORD* m_pMap; 74 const FX_WORD* m_pMap;
57 int m_Count; 75 int m_Count;
58 } m_EmbeddedToUnicodes[CIDSET_NUM_SETS]; 76 } m_EmbeddedToUnicodes[CIDSET_NUM_SETS];
59 77
60 private: 78 private:
61 CFX_MapPtrToPtr m_pStockMap; 79 std::map<CPDF_Document*, std::unique_ptr<CFX_StockFontArray>> m_StockMap;
62 uint8_t* m_pContrastRamps;
63 }; 80 };
64 81
65 struct CMap_CodeRange { 82 struct CMap_CodeRange {
66 int m_CharSize; 83 int m_CharSize;
67 uint8_t m_Lower[4]; 84 uint8_t m_Lower[4];
68 uint8_t m_Upper[4]; 85 uint8_t m_Upper[4];
69 }; 86 };
70 87
71 class CPDF_CMapParser { 88 class CPDF_CMapParser {
72 public: 89 public:
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 public: 211 public:
195 CPDF_FontCharMap(CPDF_Font* pFont); 212 CPDF_FontCharMap(CPDF_Font* pFont);
196 CPDF_Font* m_pFont; 213 CPDF_Font* m_pFont;
197 }; 214 };
198 215
199 void FPDFAPI_LoadCID2UnicodeMap(CIDSet charset, 216 void FPDFAPI_LoadCID2UnicodeMap(CIDSet charset,
200 const FX_WORD*& pMap, 217 const FX_WORD*& pMap,
201 FX_DWORD& count); 218 FX_DWORD& count);
202 219
203 #endif // CORE_SRC_FPDFAPI_FPDF_FONT_FONT_INT_H_ 220 #endif // CORE_SRC_FPDFAPI_FPDF_FONT_FONT_INT_H_
OLDNEW
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_font/fpdf_font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698