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

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

Issue 1417823005: Add type cast definitions for CPDF_Name. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
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
« no previous file with comments | « core/include/fpdfapi/fpdf_objects.h ('k') | core/src/fpdfapi/fpdf_font/fpdf_font_cid.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 #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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 FX_BOOL bTrueType) { 721 FX_BOOL bTrueType) {
722 if (pEncoding == NULL) { 722 if (pEncoding == NULL) {
723 if (m_BaseFont == FX_BSTRC("Symbol")) { 723 if (m_BaseFont == FX_BSTRC("Symbol")) {
724 iBaseEncoding = bTrueType ? PDFFONT_ENCODING_MS_SYMBOL 724 iBaseEncoding = bTrueType ? PDFFONT_ENCODING_MS_SYMBOL
725 : PDFFONT_ENCODING_ADOBE_SYMBOL; 725 : PDFFONT_ENCODING_ADOBE_SYMBOL;
726 } else if (!bEmbedded && iBaseEncoding == PDFFONT_ENCODING_BUILTIN) { 726 } else if (!bEmbedded && iBaseEncoding == PDFFONT_ENCODING_BUILTIN) {
727 iBaseEncoding = PDFFONT_ENCODING_WINANSI; 727 iBaseEncoding = PDFFONT_ENCODING_WINANSI;
728 } 728 }
729 return; 729 return;
730 } 730 }
731 if (pEncoding->GetType() == PDFOBJ_NAME) { 731 if (pEncoding->IsName()) {
732 if (iBaseEncoding == PDFFONT_ENCODING_ADOBE_SYMBOL || 732 if (iBaseEncoding == PDFFONT_ENCODING_ADOBE_SYMBOL ||
733 iBaseEncoding == PDFFONT_ENCODING_ZAPFDINGBATS) { 733 iBaseEncoding == PDFFONT_ENCODING_ZAPFDINGBATS) {
734 return; 734 return;
735 } 735 }
736 if ((m_Flags & PDFFONT_SYMBOLIC) && m_BaseFont == FX_BSTRC("Symbol")) { 736 if ((m_Flags & PDFFONT_SYMBOLIC) && m_BaseFont == FX_BSTRC("Symbol")) {
737 if (!bTrueType) { 737 if (!bTrueType) {
738 iBaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL; 738 iBaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL;
739 } 739 }
740 return; 740 return;
741 } 741 }
(...skipping 21 matching lines...) Expand all
763 iBaseEncoding = PDFFONT_ENCODING_STANDARD; 763 iBaseEncoding = PDFFONT_ENCODING_STANDARD;
764 } 764 }
765 CPDF_Array* pDiffs = pDict->GetArray(FX_BSTRC("Differences")); 765 CPDF_Array* pDiffs = pDict->GetArray(FX_BSTRC("Differences"));
766 if (pDiffs == NULL) { 766 if (pDiffs == NULL) {
767 return; 767 return;
768 } 768 }
769 pCharNames = new CFX_ByteString[256]; 769 pCharNames = new CFX_ByteString[256];
770 FX_DWORD cur_code = 0; 770 FX_DWORD cur_code = 0;
771 for (FX_DWORD i = 0; i < pDiffs->GetCount(); i++) { 771 for (FX_DWORD i = 0; i < pDiffs->GetCount(); i++) {
772 CPDF_Object* pElement = pDiffs->GetElementValue(i); 772 CPDF_Object* pElement = pDiffs->GetElementValue(i);
773 if (pElement == NULL) { 773 if (!pElement)
774 continue; 774 continue;
775 } 775
776 if (pElement->GetType() == PDFOBJ_NAME) { 776 if (CPDF_Name* pName = pElement->AsName()) {
777 if (cur_code < 256) { 777 if (cur_code < 256)
778 pCharNames[cur_code] = ((CPDF_Name*)pElement)->GetString(); 778 pCharNames[cur_code] = pName->GetString();
779 }
780 cur_code++; 779 cur_code++;
781 } else { 780 } else {
782 cur_code = pElement->GetInteger(); 781 cur_code = pElement->GetInteger();
783 } 782 }
784 } 783 }
785 } 784 }
786 785
787 FX_BOOL CPDF_Font::IsStandardFont() const { 786 FX_BOOL CPDF_Font::IsStandardFont() const {
788 if (m_FontType != PDFFONT_TYPE1) 787 if (m_FontType != PDFFONT_TYPE1)
789 return FALSE; 788 return FALSE;
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 CPDF_Type3Char::CPDF_Type3Char() { 1781 CPDF_Type3Char::CPDF_Type3Char() {
1783 m_pForm = NULL; 1782 m_pForm = NULL;
1784 m_pBitmap = NULL; 1783 m_pBitmap = NULL;
1785 m_bPageRequired = FALSE; 1784 m_bPageRequired = FALSE;
1786 m_bColored = FALSE; 1785 m_bColored = FALSE;
1787 } 1786 }
1788 CPDF_Type3Char::~CPDF_Type3Char() { 1787 CPDF_Type3Char::~CPDF_Type3Char() {
1789 delete m_pForm; 1788 delete m_pForm;
1790 delete m_pBitmap; 1789 delete m_pBitmap;
1791 } 1790 }
OLDNEW
« no previous file with comments | « core/include/fpdfapi/fpdf_objects.h ('k') | core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698