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

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

Issue 1134003007: Merge to XFA: Remove FX_NEW_VECTOR() macros. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 7 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/fxcrt/fx_memory.h ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.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_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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) {
787 return; 787 return;
788 } 788 }
789 FX_NEW_VECTOR(pCharNames, CFX_ByteString, 256); 789 pCharNames = new CFX_ByteString[256];
790 FX_DWORD cur_code = 0; 790 FX_DWORD cur_code = 0;
791 for (FX_DWORD i = 0; i < pDiffs->GetCount(); i ++) { 791 for (FX_DWORD i = 0; i < pDiffs->GetCount(); i ++) {
792 CPDF_Object* pElement = pDiffs->GetElementValue(i); 792 CPDF_Object* pElement = pDiffs->GetElementValue(i);
793 if (pElement == NULL) { 793 if (pElement == NULL) {
794 continue; 794 continue;
795 } 795 }
796 if (pElement->GetType() == PDFOBJ_NAME) { 796 if (pElement->GetType() == PDFOBJ_NAME) {
797 if (cur_code < 256) { 797 if (cur_code < 256) {
798 pCharNames[cur_code] = ((CPDF_Name*)pElement)->GetString(); 798 pCharNames[cur_code] = ((CPDF_Name*)pElement)->GetString();
799 } 799 }
(...skipping 21 matching lines...) Expand all
821 { 821 {
822 FXSYS_memset8(m_CharBBox, 0xff, sizeof m_CharBBox); 822 FXSYS_memset8(m_CharBBox, 0xff, sizeof m_CharBBox);
823 FXSYS_memset8(m_CharWidth, 0xff, sizeof m_CharWidth); 823 FXSYS_memset8(m_CharWidth, 0xff, sizeof m_CharWidth);
824 FXSYS_memset8(m_GlyphIndex, 0xff, sizeof m_GlyphIndex); 824 FXSYS_memset8(m_GlyphIndex, 0xff, sizeof m_GlyphIndex);
825 FXSYS_memset8(m_ExtGID, 0xff, sizeof m_ExtGID); 825 FXSYS_memset8(m_ExtGID, 0xff, sizeof m_ExtGID);
826 m_pCharNames = NULL; 826 m_pCharNames = NULL;
827 m_BaseEncoding = PDFFONT_ENCODING_BUILTIN; 827 m_BaseEncoding = PDFFONT_ENCODING_BUILTIN;
828 } 828 }
829 CPDF_SimpleFont::~CPDF_SimpleFont() 829 CPDF_SimpleFont::~CPDF_SimpleFont()
830 { 830 {
831 if (m_pCharNames) { 831 delete[] m_pCharNames;
832 FX_DELETE_VECTOR(m_pCharNames, CFX_ByteString, 256);
833 }
834 } 832 }
835 int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph) 833 int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph)
836 { 834 {
837 if (pVertGlyph) { 835 if (pVertGlyph) {
838 *pVertGlyph = FALSE; 836 *pVertGlyph = FALSE;
839 } 837 }
840 if (charcode > 0xff) { 838 if (charcode > 0xff) {
841 return -1; 839 return -1;
842 } 840 }
843 int index = m_GlyphIndex[(FX_BYTE)charcode]; 841 int index = m_GlyphIndex[(FX_BYTE)charcode];
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 if (m_BaseFont.GetLength() > 8 && m_BaseFont[7] == '+') { 962 if (m_BaseFont.GetLength() > 8 && m_BaseFont[7] == '+') {
965 m_BaseFont = m_BaseFont.Mid(8); 963 m_BaseFont = m_BaseFont.Mid(8);
966 } 964 }
967 } 965 }
968 if (!(m_Flags & PDFFONT_SYMBOLIC)) { 966 if (!(m_Flags & PDFFONT_SYMBOLIC)) {
969 m_BaseEncoding = PDFFONT_ENCODING_STANDARD; 967 m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
970 } 968 }
971 CPDF_Object* pEncoding = m_pFontDict->GetElementValue(FX_BSTRC("Encoding")); 969 CPDF_Object* pEncoding = m_pFontDict->GetElementValue(FX_BSTRC("Encoding"));
972 LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, m_pFontFile != NULL , m_Font.IsTTFont()); 970 LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, m_pFontFile != NULL , m_Font.IsTTFont());
973 LoadGlyphMap(); 971 LoadGlyphMap();
974 if (m_pCharNames) { 972 delete[] m_pCharNames;
975 FX_DELETE_VECTOR(m_pCharNames, CFX_ByteString, 256); 973 m_pCharNames = NULL;
976 m_pCharNames = NULL;
977 }
978 if (m_Font.m_Face == NULL) { 974 if (m_Font.m_Face == NULL) {
979 return TRUE; 975 return TRUE;
980 } 976 }
981 if (m_Flags & PDFFONT_ALLCAP) { 977 if (m_Flags & PDFFONT_ALLCAP) {
982 unsigned char lowercases[] = {'a', 'z', 0xe0, 0xf6, 0xf8, 0xfd}; 978 unsigned char lowercases[] = {'a', 'z', 0xe0, 0xf6, 0xf8, 0xfd};
983 for (size_t range = 0; range < sizeof lowercases / 2; range ++) { 979 for (size_t range = 0; range < sizeof lowercases / 2; range ++) {
984 for (int i = lowercases[range * 2]; i <= lowercases[range * 2 + 1]; i ++) { 980 for (int i = lowercases[range * 2]; i <= lowercases[range * 2 + 1]; i ++) {
985 if (m_GlyphIndex[i] != 0xffff && m_pFontFile != NULL) { 981 if (m_GlyphIndex[i] != 0xffff && m_pFontFile != NULL) {
986 continue; 982 continue;
987 } 983 }
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 } 1742 }
1747 CPDF_Type3Char::~CPDF_Type3Char() 1743 CPDF_Type3Char::~CPDF_Type3Char()
1748 { 1744 {
1749 if (m_pForm) { 1745 if (m_pForm) {
1750 delete m_pForm; 1746 delete m_pForm;
1751 } 1747 }
1752 if (m_pBitmap) { 1748 if (m_pBitmap) {
1753 delete m_pBitmap; 1749 delete m_pBitmap;
1754 } 1750 }
1755 } 1751 }
OLDNEW
« no previous file with comments | « core/include/fxcrt/fx_memory.h ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698