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

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

Issue 2347313002: Remove duplicated charset definitions (Closed)
Patch Set: Nits Created 4 years, 3 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/pdfwindow/PWL_EditCtrl.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> 10 #include <memory>
11 11
12 #include "core/fpdfdoc/include/ipvt_fontmap.h" 12 #include "core/fpdfdoc/include/ipvt_fontmap.h"
13 #include "core/fxge/include/fx_font.h"
13 #include "fpdfsdk/fxedit/include/fx_edit.h" 14 #include "fpdfsdk/fxedit/include/fx_edit.h"
14 #include "public/fpdf_sysfontinfo.h" 15 #include "public/fpdf_sysfontinfo.h"
15 16
16 class CPDF_Document; 17 class CPDF_Document;
17 class CFX_SystemHandler; 18 class CFX_SystemHandler;
18 19
19 struct CPWL_FontMap_Data { 20 struct CPWL_FontMap_Data {
20 CPDF_Font* pFont; 21 CPDF_Font* pFont;
21 int32_t nCharset; 22 int32_t nCharset;
22 CFX_ByteString sFontName; 23 CFX_ByteString sFontName;
23 }; 24 };
24 25
25 struct CPWL_FontMap_Native { 26 struct CPWL_FontMap_Native {
26 int32_t nCharset; 27 int32_t nCharset;
27 CFX_ByteString sFontName; 28 CFX_ByteString sFontName;
28 }; 29 };
29 30
30 #ifndef ANSI_CHARSET
31
32 #define ANSI_CHARSET 0
33 #define DEFAULT_CHARSET 1
34 #define SYMBOL_CHARSET 2
35 #define SHIFTJIS_CHARSET 128
36 #define HANGUL_CHARSET 129
37 #define GB2312_CHARSET 134
38 #define CHINESEBIG5_CHARSET 136
39 #define JOHAB_CHARSET 130
40 #define HEBREW_CHARSET 177
41 #define ARABIC_CHARSET 178
42 #define GREEK_CHARSET 161
43 #define TURKISH_CHARSET 162
44 #define VIETNAMESE_CHARSET 163
45 #define THAI_CHARSET 222
46 #define EASTEUROPE_CHARSET 238
47 #define RUSSIAN_CHARSET 204
48 #define BALTIC_CHARSET 186
49
50 #endif
51
52 class CPWL_FontMap : public IPVT_FontMap { 31 class CPWL_FontMap : public IPVT_FontMap {
53 public: 32 public:
54 CPWL_FontMap(CFX_SystemHandler* pSystemHandler); 33 CPWL_FontMap(CFX_SystemHandler* pSystemHandler);
55 ~CPWL_FontMap() override; 34 ~CPWL_FontMap() override;
56 35
57 // IPVT_FontMap 36 // IPVT_FontMap
58 CPDF_Font* GetPDFFont(int32_t nFontIndex) override; 37 CPDF_Font* GetPDFFont(int32_t nFontIndex) override;
59 CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) override; 38 CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) override;
60 int32_t GetWordFontIndex(uint16_t word, 39 int32_t GetWordFontIndex(uint16_t word,
61 int32_t nCharset, 40 int32_t nCharset,
(...skipping 16 matching lines...) Expand all
78 virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias); 57 virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
79 58
80 FX_BOOL KnowWord(int32_t nFontIndex, uint16_t word); 59 FX_BOOL KnowWord(int32_t nFontIndex, uint16_t word);
81 60
82 void Empty(); 61 void Empty();
83 int32_t GetFontIndex(const CFX_ByteString& sFontName, 62 int32_t GetFontIndex(const CFX_ByteString& sFontName,
84 int32_t nCharset, 63 int32_t nCharset,
85 FX_BOOL bFind); 64 FX_BOOL bFind);
86 int32_t AddFontData(CPDF_Font* pFont, 65 int32_t AddFontData(CPDF_Font* pFont,
87 const CFX_ByteString& sFontAlias, 66 const CFX_ByteString& sFontAlias,
88 int32_t nCharset = DEFAULT_CHARSET); 67 int32_t nCharset = FXFONT_DEFAULT_CHARSET);
89 68
90 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName, 69 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName,
91 int32_t nCharset); 70 int32_t nCharset);
92 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName); 71 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName);
93 72
94 CFX_ArrayTemplate<CPWL_FontMap_Data*> m_aData; 73 CFX_ArrayTemplate<CPWL_FontMap_Data*> m_aData;
95 CFX_ArrayTemplate<CPWL_FontMap_Native*> m_aNativeFont; 74 CFX_ArrayTemplate<CPWL_FontMap_Native*> m_aNativeFont;
96 75
97 private: 76 private:
98 int32_t FindFont(const CFX_ByteString& sFontName, 77 int32_t FindFont(const CFX_ByteString& sFontName,
99 int32_t nCharset = DEFAULT_CHARSET); 78 int32_t nCharset = FXFONT_DEFAULT_CHARSET);
100 79
101 CFX_ByteString GetNativeFont(int32_t nCharset); 80 CFX_ByteString GetNativeFont(int32_t nCharset);
102 CPDF_Font* AddFontToDocument(CPDF_Document* pDoc, 81 CPDF_Font* AddFontToDocument(CPDF_Document* pDoc,
103 CFX_ByteString& sFontName, 82 CFX_ByteString& sFontName,
104 uint8_t nCharset); 83 uint8_t nCharset);
105 FX_BOOL IsStandardFont(const CFX_ByteString& sFontName); 84 FX_BOOL IsStandardFont(const CFX_ByteString& sFontName);
106 CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName); 85 CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName);
107 CPDF_Font* AddSystemFont(CPDF_Document* pDoc, 86 CPDF_Font* AddSystemFont(CPDF_Document* pDoc,
108 CFX_ByteString& sFontName, 87 CFX_ByteString& sFontName,
109 uint8_t nCharset); 88 uint8_t nCharset);
110 89
111 std::unique_ptr<CPDF_Document> m_pPDFDoc; 90 std::unique_ptr<CPDF_Document> m_pPDFDoc;
112 CFX_SystemHandler* const m_pSystemHandler; 91 CFX_SystemHandler* const m_pSystemHandler;
113 }; 92 };
114 93
115 #endif // FPDFSDK_PDFWINDOW_PWL_FONTMAP_H_ 94 #endif // FPDFSDK_PDFWINDOW_PWL_FONTMAP_H_
OLDNEW
« no previous file with comments | « fpdfsdk/pdfwindow/PWL_EditCtrl.cpp ('k') | fpdfsdk/pdfwindow/PWL_FontMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698