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

Side by Side Diff: fpdfsdk/pdfwindow/PWL_FontMap.h

Issue 2173253002: Use smart pointers for class owned pointers (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 4 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 | « fpdfsdk/javascript/cjs_context.cpp ('k') | fpdfsdk/pdfwindow/PWL_FontMap.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 FPDFSDK_PDFWINDOW_PWL_FONTMAP_H_ 7 #ifndef FPDFSDK_PDFWINDOW_PWL_FONTMAP_H_
8 #define FPDFSDK_PDFWINDOW_PWL_FONTMAP_H_ 8 #define FPDFSDK_PDFWINDOW_PWL_FONTMAP_H_
9 9
10 #include <memory>
11
10 #include "core/fpdfdoc/include/ipvt_fontmap.h" 12 #include "core/fpdfdoc/include/ipvt_fontmap.h"
11 #include "fpdfsdk/fxedit/include/fx_edit.h" 13 #include "fpdfsdk/fxedit/include/fx_edit.h"
12 #include "public/fpdf_sysfontinfo.h" 14 #include "public/fpdf_sysfontinfo.h"
13 15
14 class CPDF_Document; 16 class CPDF_Document;
15 class CFX_SystemHandler; 17 class CFX_SystemHandler;
16 18
17 struct CPWL_FontMap_Data { 19 struct CPWL_FontMap_Data {
18 CPDF_Font* pFont; 20 CPDF_Font* pFont;
19 int32_t nCharset; 21 int32_t nCharset;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 75
74 CPDF_Font* AddFontToDocument(CPDF_Document* pDoc, 76 CPDF_Font* AddFontToDocument(CPDF_Document* pDoc,
75 CFX_ByteString& sFontName, 77 CFX_ByteString& sFontName,
76 uint8_t nCharset); 78 uint8_t nCharset);
77 static FX_BOOL IsStandardFont(const CFX_ByteString& sFontName); 79 static FX_BOOL IsStandardFont(const CFX_ByteString& sFontName);
78 CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName); 80 CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName);
79 CPDF_Font* AddSystemFont(CPDF_Document* pDoc, 81 CPDF_Font* AddSystemFont(CPDF_Document* pDoc,
80 CFX_ByteString& sFontName, 82 CFX_ByteString& sFontName,
81 uint8_t nCharset); 83 uint8_t nCharset);
82 84
85 static const FPDF_CharsetFontMap defaultTTFMap[];
86
83 protected: 87 protected:
84 virtual void Initialize(); 88 virtual void Initialize();
85 virtual CPDF_Document* GetDocument(); 89 virtual CPDF_Document* GetDocument();
86 virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, 90 virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias,
87 int32_t nCharset); 91 int32_t nCharset);
88 virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias); 92 virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
89 93
90 FX_BOOL KnowWord(int32_t nFontIndex, uint16_t word); 94 FX_BOOL KnowWord(int32_t nFontIndex, uint16_t word);
91 95
92 void Empty(); 96 void Empty();
93 int32_t GetFontIndex(const CFX_ByteString& sFontName, 97 int32_t GetFontIndex(const CFX_ByteString& sFontName,
94 int32_t nCharset, 98 int32_t nCharset,
95 FX_BOOL bFind); 99 FX_BOOL bFind);
96 int32_t GetPWLFontIndex(uint16_t word, int32_t nCharset); 100 int32_t GetPWLFontIndex(uint16_t word, int32_t nCharset);
97 int32_t AddFontData(CPDF_Font* pFont, 101 int32_t AddFontData(CPDF_Font* pFont,
98 const CFX_ByteString& sFontAlias, 102 const CFX_ByteString& sFontAlias,
99 int32_t nCharset = DEFAULT_CHARSET); 103 int32_t nCharset = DEFAULT_CHARSET);
100 104
101 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName, 105 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName,
102 int32_t nCharset); 106 int32_t nCharset);
103 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName); 107 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName);
104 108
109 CFX_ArrayTemplate<CPWL_FontMap_Data*> m_aData;
110 CFX_ArrayTemplate<CPWL_FontMap_Native*> m_aNativeFont;
111
105 private: 112 private:
106 CFX_ByteString GetFontName(int32_t nFontIndex); 113 CFX_ByteString GetFontName(int32_t nFontIndex);
107 int32_t FindFont(const CFX_ByteString& sFontName, 114 int32_t FindFont(const CFX_ByteString& sFontName,
108 int32_t nCharset = DEFAULT_CHARSET); 115 int32_t nCharset = DEFAULT_CHARSET);
109 116
110 CFX_ByteString GetNativeFont(int32_t nCharset); 117 CFX_ByteString GetNativeFont(int32_t nCharset);
111 118
112 public: 119 std::unique_ptr<CPDF_Document> m_pPDFDoc;
113 using CharsetFontMap = FPDF_CharsetFontMap;
114 static const CharsetFontMap defaultTTFMap[];
115
116 protected:
117 CFX_ArrayTemplate<CPWL_FontMap_Data*> m_aData;
118 CFX_ArrayTemplate<CPWL_FontMap_Native*> m_aNativeFont;
119
120 private:
121 CPDF_Document* m_pPDFDoc;
122 CFX_SystemHandler* m_pSystemHandler; 120 CFX_SystemHandler* m_pSystemHandler;
123 }; 121 };
124 122
125 class CPWL_DocFontMap : public CPWL_FontMap { 123 class CPWL_DocFontMap : public CPWL_FontMap {
126 public: 124 public:
127 CPWL_DocFontMap(CFX_SystemHandler* pSystemHandler, 125 CPWL_DocFontMap(CFX_SystemHandler* pSystemHandler,
128 CPDF_Document* pAttachedDoc); 126 CPDF_Document* pAttachedDoc);
129 ~CPWL_DocFontMap() override; 127 ~CPWL_DocFontMap() override;
130 128
131 private: 129 private:
132 // CPWL_FontMap: 130 // CPWL_FontMap:
133 CPDF_Document* GetDocument() override; 131 CPDF_Document* GetDocument() override;
134 132
135 CPDF_Document* m_pAttachedDoc; 133 CPDF_Document* m_pAttachedDoc;
136 }; 134 };
137 135
138 #endif // FPDFSDK_PDFWINDOW_PWL_FONTMAP_H_ 136 #endif // FPDFSDK_PDFWINDOW_PWL_FONTMAP_H_
OLDNEW
« no previous file with comments | « fpdfsdk/javascript/cjs_context.cpp ('k') | fpdfsdk/pdfwindow/PWL_FontMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698