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

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

Issue 2340373002: Deleted unused defintions and methods from PWL_FontMap (Closed)
Patch Set: 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_FontMap.h ('k') | no next file » | 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 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" 7 #include "fpdfsdk/pdfwindow/PWL_FontMap.h"
8 8
9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" 10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 if (!pFont) { 208 if (!pFont) {
209 CFX_ByteString sTemp = sFontName; 209 CFX_ByteString sTemp = sFontName;
210 pFont = AddFontToDocument(GetDocument(), sTemp, nCharset); 210 pFont = AddFontToDocument(GetDocument(), sTemp, nCharset);
211 sAlias = EncodeFontAlias(sTemp, nCharset); 211 sAlias = EncodeFontAlias(sTemp, nCharset);
212 } 212 }
213 AddedFont(pFont, sAlias); 213 AddedFont(pFont, sAlias);
214 return AddFontData(pFont, sAlias, nCharset); 214 return AddFontData(pFont, sAlias, nCharset);
215 } 215 }
216 216
217 int32_t CPWL_FontMap::GetPWLFontIndex(uint16_t word, int32_t nCharset) {
218 int32_t nFind = -1;
219
220 for (int32_t i = 0, sz = m_aData.GetSize(); i < sz; i++) {
221 if (CPWL_FontMap_Data* pData = m_aData.GetAt(i)) {
222 if (pData->nCharset == nCharset) {
223 nFind = i;
224 break;
225 }
226 }
227 }
228
229 CPDF_Font* pNewFont = GetPDFFont(nFind);
230
231 if (!pNewFont)
232 return -1;
233
234 CFX_ByteString sAlias = EncodeFontAlias("Arial_Chrome", nCharset);
235 AddedFont(pNewFont, sAlias);
236
237 return AddFontData(pNewFont, sAlias, nCharset);
238 }
239
240 CPDF_Font* CPWL_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias, 217 CPDF_Font* CPWL_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias,
241 int32_t nCharset) { 218 int32_t nCharset) {
242 return nullptr; 219 return nullptr;
243 } 220 }
244 221
245 int32_t CPWL_FontMap::AddFontData(CPDF_Font* pFont, 222 int32_t CPWL_FontMap::AddFontData(CPDF_Font* pFont,
246 const CFX_ByteString& sFontAlias, 223 const CFX_ByteString& sFontAlias,
247 int32_t nCharset) { 224 int32_t nCharset) {
248 CPWL_FontMap_Data* pNewData = new CPWL_FontMap_Data; 225 CPWL_FontMap_Data* pNewData = new CPWL_FontMap_Data;
249 pNewData->pFont = pFont; 226 pNewData->pFont = pFont;
250 pNewData->sFontName = sFontAlias; 227 pNewData->sFontName = sFontAlias;
251 pNewData->nCharset = nCharset; 228 pNewData->nCharset = nCharset;
252 229
253 m_aData.Add(pNewData); 230 m_aData.Add(pNewData);
254 231
255 return m_aData.GetSize() - 1; 232 return m_aData.GetSize() - 1;
256 } 233 }
257 234
258 void CPWL_FontMap::AddedFont(CPDF_Font* pFont, 235 void CPWL_FontMap::AddedFont(CPDF_Font* pFont,
259 const CFX_ByteString& sFontAlias) {} 236 const CFX_ByteString& sFontAlias) {}
260 237
261 CFX_ByteString CPWL_FontMap::GetFontName(int32_t nFontIndex) {
262 if (nFontIndex >= 0 && nFontIndex < m_aData.GetSize()) {
263 if (CPWL_FontMap_Data* pData = m_aData.GetAt(nFontIndex)) {
264 return pData->sFontName;
265 }
266 }
267
268 return "";
269 }
270
271 CFX_ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) { 238 CFX_ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) {
272 if (nCharset == DEFAULT_CHARSET) 239 if (nCharset == DEFAULT_CHARSET)
273 nCharset = GetNativeCharset(); 240 nCharset = GetNativeCharset();
274 241
275 CFX_ByteString sFontName = GetDefaultFontByCharset(nCharset); 242 CFX_ByteString sFontName = GetDefaultFontByCharset(nCharset);
276 if (m_pSystemHandler->FindNativeTrueTypeFont(sFontName)) 243 if (m_pSystemHandler->FindNativeTrueTypeFont(sFontName))
277 return sFontName; 244 return sFontName;
278 245
279 sFontName.clear(); 246 sFontName.clear();
280 return sFontName; 247 return sFontName;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 sPostfix.Format("_%02X", nCharset); 294 sPostfix.Format("_%02X", nCharset);
328 return EncodeFontAlias(sFontName) + sPostfix; 295 return EncodeFontAlias(sFontName) + sPostfix;
329 } 296 }
330 297
331 CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName) { 298 CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName) {
332 CFX_ByteString sRet = sFontName; 299 CFX_ByteString sRet = sFontName;
333 sRet.Remove(' '); 300 sRet.Remove(' ');
334 return sRet; 301 return sRet;
335 } 302 }
336 303
337 int32_t CPWL_FontMap::GetFontMapCount() const {
338 return m_aData.GetSize();
339 }
340
341 const CPWL_FontMap_Data* CPWL_FontMap::GetFontMapData(int32_t nIndex) const { 304 const CPWL_FontMap_Data* CPWL_FontMap::GetFontMapData(int32_t nIndex) const {
342 if (nIndex >= 0 && nIndex < m_aData.GetSize()) { 305 if (nIndex >= 0 && nIndex < m_aData.GetSize()) {
343 return m_aData.GetAt(nIndex); 306 return m_aData.GetAt(nIndex);
344 } 307 }
345 308
346 return nullptr; 309 return nullptr;
347 } 310 }
348 311
349 int32_t CPWL_FontMap::GetNativeCharset() { 312 int32_t CPWL_FontMap::GetNativeCharset() {
350 uint8_t nCharset = ANSI_CHARSET; 313 uint8_t nCharset = ANSI_CHARSET;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 return RUSSIAN_CHARSET; 432 return RUSSIAN_CHARSET;
470 433
471 if (word >= 0x0100 && word <= 0x024F) 434 if (word >= 0x0100 && word <= 0x024F)
472 return EASTEUROPE_CHARSET; 435 return EASTEUROPE_CHARSET;
473 436
474 if (word >= 0x1E00 && word <= 0x1EFF) 437 if (word >= 0x1E00 && word <= 0x1EFF)
475 return VIETNAMESE_CHARSET; 438 return VIETNAMESE_CHARSET;
476 439
477 return ANSI_CHARSET; 440 return ANSI_CHARSET;
478 } 441 }
OLDNEW
« no previous file with comments | « fpdfsdk/pdfwindow/PWL_FontMap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698