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

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

Issue 1821043003: Remove FX_WORD in favor of uint16_t. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use stdint.h directly, bitfield minefield. Created 4 years, 9 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 | « core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp ('k') | core/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_FPDFAPI_FPDF_FONT_FONT_INT_H_ 7 #ifndef CORE_FPDFAPI_FPDF_FONT_FONT_INT_H_
8 #define CORE_FPDFAPI_FPDF_FONT_FONT_INT_H_ 8 #define CORE_FPDFAPI_FPDF_FONT_FONT_INT_H_
9 9
10 #include <map> 10 #include <map>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 // Takes ownership of |pFont|. 65 // Takes ownership of |pFont|.
66 void Set(CPDF_Document* key, int index, CPDF_Font* pFont); 66 void Set(CPDF_Document* key, int index, CPDF_Font* pFont);
67 67
68 CPDF_CMapManager m_CMapManager; 68 CPDF_CMapManager m_CMapManager;
69 struct { 69 struct {
70 const struct FXCMAP_CMap* m_pMapList; 70 const struct FXCMAP_CMap* m_pMapList;
71 int m_Count; 71 int m_Count;
72 } m_EmbeddedCharsets[CIDSET_NUM_SETS]; 72 } m_EmbeddedCharsets[CIDSET_NUM_SETS];
73 struct { 73 struct {
74 const FX_WORD* m_pMap; 74 const uint16_t* m_pMap;
75 int m_Count; 75 int m_Count;
76 } m_EmbeddedToUnicodes[CIDSET_NUM_SETS]; 76 } m_EmbeddedToUnicodes[CIDSET_NUM_SETS];
77 77
78 private: 78 private:
79 std::map<CPDF_Document*, std::unique_ptr<CFX_StockFontArray>> m_StockMap; 79 std::map<CPDF_Document*, std::unique_ptr<CFX_StockFontArray>> m_StockMap;
80 }; 80 };
81 81
82 struct CMap_CodeRange { 82 struct CMap_CodeRange {
83 int m_CharSize; 83 int m_CharSize;
84 uint8_t m_Lower[4]; 84 uint8_t m_Lower[4];
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 class CPDF_CMap { 121 class CPDF_CMap {
122 public: 122 public:
123 CPDF_CMap(); 123 CPDF_CMap();
124 FX_BOOL LoadPredefined(CPDF_CMapManager* pMgr, 124 FX_BOOL LoadPredefined(CPDF_CMapManager* pMgr,
125 const FX_CHAR* name, 125 const FX_CHAR* name,
126 FX_BOOL bPromptCJK); 126 FX_BOOL bPromptCJK);
127 FX_BOOL LoadEmbedded(const uint8_t* pData, FX_DWORD dwSize); 127 FX_BOOL LoadEmbedded(const uint8_t* pData, FX_DWORD dwSize);
128 void Release(); 128 void Release();
129 FX_BOOL IsLoaded() const { return m_bLoaded; } 129 FX_BOOL IsLoaded() const { return m_bLoaded; }
130 FX_BOOL IsVertWriting() const { return m_bVertical; } 130 FX_BOOL IsVertWriting() const { return m_bVertical; }
131 FX_WORD CIDFromCharCode(FX_DWORD charcode) const; 131 uint16_t CIDFromCharCode(FX_DWORD charcode) const;
132 FX_DWORD CharCodeFromCID(FX_WORD CID) const; 132 FX_DWORD CharCodeFromCID(uint16_t CID) const;
133 int GetCharSize(FX_DWORD charcode) const; 133 int GetCharSize(FX_DWORD charcode) const;
134 FX_DWORD GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const; 134 FX_DWORD GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const;
135 int CountChar(const FX_CHAR* pString, int size) const; 135 int CountChar(const FX_CHAR* pString, int size) const;
136 int AppendChar(FX_CHAR* str, FX_DWORD charcode) const; 136 int AppendChar(FX_CHAR* str, FX_DWORD charcode) const;
137 typedef enum { 137 typedef enum {
138 OneByte, 138 OneByte,
139 TwoBytes, 139 TwoBytes,
140 MixedTwoBytes, 140 MixedTwoBytes,
141 MixedFourBytes 141 MixedFourBytes
142 } CodingScheme; 142 } CodingScheme;
143 143
144 protected: 144 protected:
145 ~CPDF_CMap(); 145 ~CPDF_CMap();
146 friend class CPDF_CMapParser; 146 friend class CPDF_CMapParser;
147 friend class CPDF_CMapManager; 147 friend class CPDF_CMapManager;
148 friend class CPDF_CIDFont; 148 friend class CPDF_CIDFont;
149 149
150 protected: 150 protected:
151 CFX_ByteString m_PredefinedCMap; 151 CFX_ByteString m_PredefinedCMap;
152 FX_BOOL m_bVertical; 152 FX_BOOL m_bVertical;
153 CIDSet m_Charset; 153 CIDSet m_Charset;
154 int m_Coding; 154 int m_Coding;
155 CodingScheme m_CodingScheme; 155 CodingScheme m_CodingScheme;
156 int m_nCodeRanges; 156 int m_nCodeRanges;
157 uint8_t* m_pLeadingBytes; 157 uint8_t* m_pLeadingBytes;
158 FX_WORD* m_pMapping; 158 uint16_t* m_pMapping;
159 uint8_t* m_pAddMapping; 159 uint8_t* m_pAddMapping;
160 FX_BOOL m_bLoaded; 160 FX_BOOL m_bLoaded;
161 const FXCMAP_CMap* m_pEmbedMap; 161 const FXCMAP_CMap* m_pEmbedMap;
162 CPDF_CMap* m_pUseMap; 162 CPDF_CMap* m_pUseMap;
163 }; 163 };
164 164
165 class CPDF_CID2UnicodeMap { 165 class CPDF_CID2UnicodeMap {
166 public: 166 public:
167 CPDF_CID2UnicodeMap(); 167 CPDF_CID2UnicodeMap();
168 ~CPDF_CID2UnicodeMap(); 168 ~CPDF_CID2UnicodeMap();
169 FX_BOOL Initialize(); 169 FX_BOOL Initialize();
170 FX_BOOL IsLoaded(); 170 FX_BOOL IsLoaded();
171 void Load(CPDF_CMapManager* pMgr, CIDSet charset, FX_BOOL bPromptCJK); 171 void Load(CPDF_CMapManager* pMgr, CIDSet charset, FX_BOOL bPromptCJK);
172 FX_WCHAR UnicodeFromCID(FX_WORD CID); 172 FX_WCHAR UnicodeFromCID(uint16_t CID);
173 173
174 protected: 174 protected:
175 CIDSet m_Charset; 175 CIDSet m_Charset;
176 const FX_WORD* m_pEmbeddedMap; 176 const uint16_t* m_pEmbeddedMap;
177 FX_DWORD m_EmbeddedCount; 177 FX_DWORD m_EmbeddedCount;
178 }; 178 };
179 179
180 class CPDF_ToUnicodeMap { 180 class CPDF_ToUnicodeMap {
181 public: 181 public:
182 void Load(CPDF_Stream* pStream); 182 void Load(CPDF_Stream* pStream);
183 CFX_WideString Lookup(FX_DWORD charcode); 183 CFX_WideString Lookup(FX_DWORD charcode);
184 FX_DWORD ReverseLookup(FX_WCHAR unicode); 184 FX_DWORD ReverseLookup(FX_WCHAR unicode);
185 185
186 protected: 186 protected:
187 std::map<FX_DWORD, FX_DWORD> m_Map; 187 std::map<FX_DWORD, FX_DWORD> m_Map;
188 CPDF_CID2UnicodeMap* m_pBaseMap; 188 CPDF_CID2UnicodeMap* m_pBaseMap;
189 CFX_WideTextBuf m_MultiCharBuf; 189 CFX_WideTextBuf m_MultiCharBuf;
190 190
191 private: 191 private:
192 friend class fpdf_font_StringToCode_Test; 192 friend class fpdf_font_StringToCode_Test;
193 friend class fpdf_font_StringToWideString_Test; 193 friend class fpdf_font_StringToWideString_Test;
194 194
195 static FX_DWORD StringToCode(const CFX_ByteStringC& str); 195 static FX_DWORD StringToCode(const CFX_ByteStringC& str);
196 static CFX_WideString StringToWideString(const CFX_ByteStringC& str); 196 static CFX_WideString StringToWideString(const CFX_ByteStringC& str);
197 }; 197 };
198 198
199 void FPDFAPI_LoadCID2UnicodeMap(CIDSet charset, 199 void FPDFAPI_LoadCID2UnicodeMap(CIDSet charset,
200 const FX_WORD*& pMap, 200 const uint16_t*& pMap,
201 FX_DWORD& count); 201 FX_DWORD& count);
202 202
203 #endif // CORE_FPDFAPI_FPDF_FONT_FONT_INT_H_ 203 #endif // CORE_FPDFAPI_FPDF_FONT_FONT_INT_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp ('k') | core/fpdfapi/fpdf_font/fpdf_font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698