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

Side by Side Diff: core/src/fpdfapi/fpdf_font/fpdf_font.cpp

Issue 1194933003: Make CPDF_Object::GetString() a virtual method. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 5 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
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 "../../../include/fpdfapi/fpdf_page.h" 7 #include "../../../include/fpdfapi/fpdf_page.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../../../include/fpdfapi/fpdf_pageobj.h" 9 #include "../../../include/fpdfapi/fpdf_pageobj.h"
10 #include "font_int.h" 10 #include "font_int.h"
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 414 }
415 const uint8_t ChineseFontNames[][5] = { 415 const uint8_t ChineseFontNames[][5] = {
416 {0xCB, 0xCE, 0xCC, 0xE5, 0x00}, 416 {0xCB, 0xCE, 0xCC, 0xE5, 0x00},
417 {0xBF, 0xAC, 0xCC, 0xE5, 0x00}, 417 {0xBF, 0xAC, 0xCC, 0xE5, 0x00},
418 {0xBA, 0xDA, 0xCC, 0xE5, 0x00}, 418 {0xBA, 0xDA, 0xCC, 0xE5, 0x00},
419 {0xB7, 0xC2, 0xCB, 0xCE, 0x00}, 419 {0xB7, 0xC2, 0xCB, 0xCE, 0x00},
420 {0xD0, 0xC2, 0xCB, 0xCE, 0x00} 420 {0xD0, 0xC2, 0xCB, 0xCE, 0x00}
421 }; 421 };
422 CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary* pFontDic t) 422 CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary* pFontDic t)
423 { 423 {
424 CFX_ByteString type = pFontDict->GetString(FX_BSTRC("Subtype")); 424 CFX_ByteString type = pFontDict->GetStringAt("Subtype");
425 CPDF_Font* pFont; 425 CPDF_Font* pFont;
426 if (type == FX_BSTRC("TrueType")) { 426 if (type == FX_BSTRC("TrueType")) {
427 { 427 {
428 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ || _FXM_PLATFORM_ == _FXM_PLATFORM _LINUX_ || _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ || _FXM_PLATFORM_ == _FXM_PL ATFORM_APPLE_ 428 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ || _FXM_PLATFORM_ == _FXM_PLATFORM _LINUX_ || _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ || _FXM_PLATFORM_ == _FXM_PL ATFORM_APPLE_
429 CFX_ByteString basefont = pFontDict->GetString(FX_BSTRC("BaseFont")) ; 429 CFX_ByteString basefont = pFontDict->GetStringAt("BaseFont");
430 CFX_ByteString tag = basefont.Left(4); 430 CFX_ByteString tag = basefont.Left(4);
431 int i; 431 int i;
432 int count = sizeof(ChineseFontNames) / sizeof(ChineseFontNames[0]); 432 int count = sizeof(ChineseFontNames) / sizeof(ChineseFontNames[0]);
433 for (i = 0; i < count; ++i) { 433 for (i = 0; i < count; ++i) {
434 if (tag == CFX_ByteString((const FX_CHAR*)ChineseFontNames[i])) { 434 if (tag == CFX_ByteString((const FX_CHAR*)ChineseFontNames[i])) {
435 break; 435 break;
436 } 436 }
437 } 437 }
438 if (i < count) { 438 if (i < count) {
439 CPDF_Dictionary* pFontDesc = pFontDict->GetDict(FX_BSTRC("FontDe scriptor")); 439 CPDF_Dictionary* pFontDesc = pFontDict->GetDict(FX_BSTRC("FontDe scriptor"));
(...skipping 24 matching lines...) Expand all
464 delete pFont; 464 delete pFont;
465 return NULL; 465 return NULL;
466 } 466 }
467 return pFont; 467 return pFont;
468 } 468 }
469 FX_BOOL CPDF_Font::Load() 469 FX_BOOL CPDF_Font::Load()
470 { 470 {
471 if (m_pFontDict == NULL) { 471 if (m_pFontDict == NULL) {
472 return FALSE; 472 return FALSE;
473 } 473 }
474 CFX_ByteString type = m_pFontDict->GetString(FX_BSTRC("Subtype")); 474 CFX_ByteString type = m_pFontDict->GetStringAt("Subtype");
475 m_BaseFont = m_pFontDict->GetString(FX_BSTRC("BaseFont")); 475 m_BaseFont = m_pFontDict->GetStringAt("BaseFont");
476 if (type == FX_BSTRC("MMType1")) { 476 if (type == FX_BSTRC("MMType1")) {
477 type = FX_BSTRC("Type1"); 477 type = FX_BSTRC("Type1");
478 } 478 }
479 return _Load(); 479 return _Load();
480 } 480 }
481 static CFX_WideString _FontMap_GetWideString(CFX_CharMap* pMap, const CFX_ByteSt ring& bytestr) 481 static CFX_WideString _FontMap_GetWideString(CFX_CharMap* pMap, const CFX_ByteSt ring& bytestr)
482 { 482 {
483 return ((CPDF_FontCharMap*)pMap)->m_pFont->DecodeString(bytestr); 483 return ((CPDF_FontCharMap*)pMap)->m_pFont->DecodeString(bytestr);
484 } 484 }
485 static CFX_ByteString _FontMap_GetByteString(CFX_CharMap* pMap, const CFX_WideSt ring& widestr) 485 static CFX_ByteString _FontMap_GetByteString(CFX_CharMap* pMap, const CFX_WideSt ring& widestr)
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 bsEncoding = FX_BSTRC("WinAnsiEncoding"); 766 bsEncoding = FX_BSTRC("WinAnsiEncoding");
767 } 767 }
768 GetPredefinedEncoding(iBaseEncoding, bsEncoding); 768 GetPredefinedEncoding(iBaseEncoding, bsEncoding);
769 return; 769 return;
770 } 770 }
771 if (pEncoding->GetType() != PDFOBJ_DICTIONARY) { 771 if (pEncoding->GetType() != PDFOBJ_DICTIONARY) {
772 return; 772 return;
773 } 773 }
774 CPDF_Dictionary* pDict = (CPDF_Dictionary*)pEncoding; 774 CPDF_Dictionary* pDict = (CPDF_Dictionary*)pEncoding;
775 if (iBaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL && iBaseEncoding != PDFFO NT_ENCODING_ZAPFDINGBATS) { 775 if (iBaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL && iBaseEncoding != PDFFO NT_ENCODING_ZAPFDINGBATS) {
776 CFX_ByteString bsEncoding = pDict->GetString(FX_BSTRC("BaseEncoding")); 776 CFX_ByteString bsEncoding = pDict->GetStringAt("BaseEncoding");
777 if (bsEncoding.Compare(FX_BSTRC("MacExpertEncoding")) == 0 && bTrueType) { 777 if (bsEncoding.Compare(FX_BSTRC("MacExpertEncoding")) == 0 && bTrueType) {
778 bsEncoding = FX_BSTRC("WinAnsiEncoding"); 778 bsEncoding = FX_BSTRC("WinAnsiEncoding");
779 } 779 }
780 GetPredefinedEncoding(iBaseEncoding, bsEncoding); 780 GetPredefinedEncoding(iBaseEncoding, bsEncoding);
781 } 781 }
782 if ((!bEmbedded || bTrueType) && iBaseEncoding == PDFFONT_ENCODING_BUILTIN) { 782 if ((!bEmbedded || bTrueType) && iBaseEncoding == PDFFONT_ENCODING_BUILTIN) {
783 iBaseEncoding = PDFFONT_ENCODING_STANDARD; 783 iBaseEncoding = PDFFONT_ENCODING_STANDARD;
784 } 784 }
785 CPDF_Array* pDiffs = pDict->GetArray(FX_BSTRC("Differences")); 785 CPDF_Array* pDiffs = pDict->GetArray(FX_BSTRC("Differences"));
786 if (pDiffs == NULL) { 786 if (pDiffs == NULL) {
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 m_pForm = NULL; 1740 m_pForm = NULL;
1741 m_pBitmap = NULL; 1741 m_pBitmap = NULL;
1742 m_bPageRequired = FALSE; 1742 m_bPageRequired = FALSE;
1743 m_bColored = FALSE; 1743 m_bColored = FALSE;
1744 } 1744 }
1745 CPDF_Type3Char::~CPDF_Type3Char() 1745 CPDF_Type3Char::~CPDF_Type3Char()
1746 { 1746 {
1747 delete m_pForm; 1747 delete m_pForm;
1748 delete m_pBitmap; 1748 delete m_pBitmap;
1749 } 1749 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698