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

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

Issue 1417033004: Merge to XFA: Add type cast definitions for CPDF_Name. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 2 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_module.h" 7 #include "../../../include/fpdfapi/fpdf_module.h"
8 #include "../../../include/fpdfapi/fpdf_page.h" 8 #include "../../../include/fpdfapi/fpdf_page.h"
9 #include "../../../include/fpdfapi/fpdf_pageobj.h" 9 #include "../../../include/fpdfapi/fpdf_pageobj.h"
10 #include "../../../include/fpdfapi/fpdf_resource.h" 10 #include "../../../include/fpdfapi/fpdf_resource.h"
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 FX_BOOL bTrueType) { 720 FX_BOOL bTrueType) {
721 if (pEncoding == NULL) { 721 if (pEncoding == NULL) {
722 if (m_BaseFont == FX_BSTRC("Symbol")) { 722 if (m_BaseFont == FX_BSTRC("Symbol")) {
723 iBaseEncoding = bTrueType ? PDFFONT_ENCODING_MS_SYMBOL 723 iBaseEncoding = bTrueType ? PDFFONT_ENCODING_MS_SYMBOL
724 : PDFFONT_ENCODING_ADOBE_SYMBOL; 724 : PDFFONT_ENCODING_ADOBE_SYMBOL;
725 } else if (!bEmbedded && iBaseEncoding == PDFFONT_ENCODING_BUILTIN) { 725 } else if (!bEmbedded && iBaseEncoding == PDFFONT_ENCODING_BUILTIN) {
726 iBaseEncoding = PDFFONT_ENCODING_WINANSI; 726 iBaseEncoding = PDFFONT_ENCODING_WINANSI;
727 } 727 }
728 return; 728 return;
729 } 729 }
730 if (pEncoding->GetType() == PDFOBJ_NAME) { 730 if (pEncoding->IsName()) {
731 if (iBaseEncoding == PDFFONT_ENCODING_ADOBE_SYMBOL || 731 if (iBaseEncoding == PDFFONT_ENCODING_ADOBE_SYMBOL ||
732 iBaseEncoding == PDFFONT_ENCODING_ZAPFDINGBATS) { 732 iBaseEncoding == PDFFONT_ENCODING_ZAPFDINGBATS) {
733 return; 733 return;
734 } 734 }
735 if ((m_Flags & PDFFONT_SYMBOLIC) && m_BaseFont == FX_BSTRC("Symbol")) { 735 if ((m_Flags & PDFFONT_SYMBOLIC) && m_BaseFont == FX_BSTRC("Symbol")) {
736 if (!bTrueType) { 736 if (!bTrueType) {
737 iBaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL; 737 iBaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL;
738 } 738 }
739 return; 739 return;
740 } 740 }
(...skipping 21 matching lines...) Expand all
762 iBaseEncoding = PDFFONT_ENCODING_STANDARD; 762 iBaseEncoding = PDFFONT_ENCODING_STANDARD;
763 } 763 }
764 CPDF_Array* pDiffs = pDict->GetArray(FX_BSTRC("Differences")); 764 CPDF_Array* pDiffs = pDict->GetArray(FX_BSTRC("Differences"));
765 if (pDiffs == NULL) { 765 if (pDiffs == NULL) {
766 return; 766 return;
767 } 767 }
768 pCharNames = new CFX_ByteString[256]; 768 pCharNames = new CFX_ByteString[256];
769 FX_DWORD cur_code = 0; 769 FX_DWORD cur_code = 0;
770 for (FX_DWORD i = 0; i < pDiffs->GetCount(); i++) { 770 for (FX_DWORD i = 0; i < pDiffs->GetCount(); i++) {
771 CPDF_Object* pElement = pDiffs->GetElementValue(i); 771 CPDF_Object* pElement = pDiffs->GetElementValue(i);
772 if (pElement == NULL) { 772 if (!pElement)
773 continue; 773 continue;
774 } 774
775 if (pElement->GetType() == PDFOBJ_NAME) { 775 if (CPDF_Name* pName = pElement->AsName()) {
776 if (cur_code < 256) { 776 if (cur_code < 256)
777 pCharNames[cur_code] = ((CPDF_Name*)pElement)->GetString(); 777 pCharNames[cur_code] = pName->GetString();
778 }
779 cur_code++; 778 cur_code++;
780 } else { 779 } else {
781 cur_code = pElement->GetInteger(); 780 cur_code = pElement->GetInteger();
782 } 781 }
783 } 782 }
784 } 783 }
785 784
786 FX_BOOL CPDF_Font::IsStandardFont() const { 785 FX_BOOL CPDF_Font::IsStandardFont() const {
787 if (m_FontType != PDFFONT_TYPE1) { 786 if (m_FontType != PDFFONT_TYPE1) {
788 return FALSE; 787 return FALSE;
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 CPDF_Type3Char::CPDF_Type3Char() { 1782 CPDF_Type3Char::CPDF_Type3Char() {
1784 m_pForm = NULL; 1783 m_pForm = NULL;
1785 m_pBitmap = NULL; 1784 m_pBitmap = NULL;
1786 m_bPageRequired = FALSE; 1785 m_bPageRequired = FALSE;
1787 m_bColored = FALSE; 1786 m_bColored = FALSE;
1788 } 1787 }
1789 CPDF_Type3Char::~CPDF_Type3Char() { 1788 CPDF_Type3Char::~CPDF_Type3Char() {
1790 delete m_pForm; 1789 delete m_pForm;
1791 delete m_pBitmap; 1790 delete m_pBitmap;
1792 } 1791 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698