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

Unified Diff: core/src/fpdfapi/fpdf_font/font_int.h

Issue 1564783003: Make m_pStockMap a real map. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_font/fpdf_font.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_font/font_int.h
diff --git a/core/src/fpdfapi/fpdf_font/font_int.h b/core/src/fpdfapi/fpdf_font/font_int.h
index 5418ffd2c952774cd7accae57ba54001a9c7482f..33fa926b2ab329d6733787152e083423392c3c09 100644
--- a/core/src/fpdfapi/fpdf_font/font_int.h
+++ b/core/src/fpdfapi/fpdf_font/font_int.h
@@ -8,6 +8,7 @@
#define CORE_SRC_FPDFAPI_FPDF_FONT_FONT_INT_H_
#include <map>
+#include <memory>
#include "core/include/fpdfapi/fpdf_resource.h"
#include "core/include/fxcrt/fx_basic.h"
@@ -39,14 +40,31 @@ class CPDF_CMapManager {
std::map<CFX_ByteString, CPDF_CMap*> m_CMaps;
CPDF_CID2UnicodeMap* m_CID2UnicodeMaps[6];
};
+
+class CFX_StockFontArray {
+ public:
+ CFX_StockFontArray();
+ ~CFX_StockFontArray();
+
+ // Takes ownership of |pFont|.
+ void SetFont(int index, CPDF_Font* pFont);
+ CPDF_Font* GetFont(int index) const;
+
+ private:
+ std::unique_ptr<CPDF_Font> m_StockFonts[14];
+};
+
class CPDF_FontGlobals {
public:
CPDF_FontGlobals();
~CPDF_FontGlobals();
- void ClearAll();
- void Clear(void* key);
- CPDF_Font* Find(void* key, int index);
- void Set(void* key, int index, CPDF_Font* pFont);
+
+ void Clear(CPDF_Document* pDoc);
+ CPDF_Font* Find(CPDF_Document* pDoc, int index);
+
+ // Takes ownership of |pFont|.
+ void Set(CPDF_Document* key, int index, CPDF_Font* pFont);
+
CPDF_CMapManager m_CMapManager;
struct {
const struct FXCMAP_CMap* m_pMapList;
@@ -58,8 +76,7 @@ class CPDF_FontGlobals {
} m_EmbeddedToUnicodes[CIDSET_NUM_SETS];
private:
- CFX_MapPtrToPtr m_pStockMap;
- uint8_t* m_pContrastRamps;
+ std::map<CPDF_Document*, std::unique_ptr<CFX_StockFontArray>> m_StockMap;
};
struct CMap_CodeRange {
« 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