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

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

Issue 1747123002: Fix and enable lint checks. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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/src/fpdfapi/fpdf_font/font_int.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 "core/src/fpdfapi/fpdf_font/font_int.h" 7 #include "core/src/fpdfapi/fpdf_font/font_int.h"
8 8
9 #include "core/include/fpdfapi/fpdf_module.h" 9 #include "core/include/fpdfapi/fpdf_module.h"
10 #include "core/include/fpdfapi/fpdf_page.h" 10 #include "core/include/fpdfapi/fpdf_page.h"
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 return ret; 959 return ret;
960 return m_Encoding.CharCodeFromUnicode(unicode); 960 return m_Encoding.CharCodeFromUnicode(unicode);
961 } 961 }
962 962
963 CPDF_Type1Font::CPDF_Type1Font() : m_Base14Font(-1) {} 963 CPDF_Type1Font::CPDF_Type1Font() : m_Base14Font(-1) {}
964 964
965 FX_BOOL CPDF_Type1Font::Load() { 965 FX_BOOL CPDF_Type1Font::Load() {
966 m_Base14Font = PDF_GetStandardFontName(&m_BaseFont); 966 m_Base14Font = PDF_GetStandardFontName(&m_BaseFont);
967 if (m_Base14Font >= 0) { 967 if (m_Base14Font >= 0) {
968 CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor"); 968 CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor");
969 if (pFontDesc && pFontDesc->KeyExist("Flags")) { 969 if (pFontDesc && pFontDesc->KeyExist("Flags"))
970 m_Flags = pFontDesc->GetIntegerBy("Flags"); 970 m_Flags = pFontDesc->GetIntegerBy("Flags");
971 } else { 971 else
972 m_Flags = m_Base14Font >= 12 ? PDFFONT_SYMBOLIC : PDFFONT_NONSYMBOLIC; 972 m_Flags = m_Base14Font >= 12 ? PDFFONT_SYMBOLIC : PDFFONT_NONSYMBOLIC;
973
974 if (m_Base14Font < 4) {
975 for (int i = 0; i < 256; i++)
976 m_CharWidth[i] = 600;
973 } 977 }
974 if (m_Base14Font < 4) 978 if (m_Base14Font == 12)
975 for (int i = 0; i < 256; i++) {
976 m_CharWidth[i] = 600;
977 }
978 if (m_Base14Font == 12) {
979 m_BaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL; 979 m_BaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL;
980 } else if (m_Base14Font == 13) { 980 else if (m_Base14Font == 13)
981 m_BaseEncoding = PDFFONT_ENCODING_ZAPFDINGBATS; 981 m_BaseEncoding = PDFFONT_ENCODING_ZAPFDINGBATS;
982 } else if (m_Flags & PDFFONT_NONSYMBOLIC) { 982 else if (m_Flags & PDFFONT_NONSYMBOLIC)
983 m_BaseEncoding = PDFFONT_ENCODING_STANDARD; 983 m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
984 }
985 } 984 }
986 return LoadCommon(); 985 return LoadCommon();
987 } 986 }
988 987
989 int CPDF_Type1Font::GlyphFromCharCodeExt(FX_DWORD charcode) { 988 int CPDF_Type1Font::GlyphFromCharCodeExt(FX_DWORD charcode) {
990 if (charcode > 0xff) { 989 if (charcode > 0xff) {
991 return -1; 990 return -1;
992 } 991 }
993 int index = m_ExtGID[(uint8_t)charcode]; 992 int index = m_ExtGID[(uint8_t)charcode];
994 if (index == 0xffff) { 993 if (index == 0xffff) {
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 if (m_Unicodes[i] == unicode) { 1294 if (m_Unicodes[i] == unicode) {
1296 return i; 1295 return i;
1297 } 1296 }
1298 return -1; 1297 return -1;
1299 } 1298 }
1300 1299
1301 CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding) { 1300 CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding) {
1302 const FX_WORD* pSrc = PDF_UnicodesForPredefinedCharSet(PredefinedEncoding); 1301 const FX_WORD* pSrc = PDF_UnicodesForPredefinedCharSet(PredefinedEncoding);
1303 if (!pSrc) { 1302 if (!pSrc) {
1304 FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes)); 1303 FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes));
1305 } else 1304 } else {
1306 for (int i = 0; i < 256; i++) { 1305 for (int i = 0; i < 256; i++)
1307 m_Unicodes[i] = pSrc[i]; 1306 m_Unicodes[i] = pSrc[i];
1308 } 1307 }
1309 } 1308 }
1310 1309
1311 FX_BOOL CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const { 1310 FX_BOOL CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const {
1312 return FXSYS_memcmp(m_Unicodes, pAnother->m_Unicodes, sizeof(m_Unicodes)) == 1311 return FXSYS_memcmp(m_Unicodes, pAnother->m_Unicodes, sizeof(m_Unicodes)) ==
1313 0; 1312 0;
1314 } 1313 }
1315 1314
1316 CPDF_Object* CPDF_FontEncoding::Realize() { 1315 CPDF_Object* CPDF_FontEncoding::Realize() {
1317 int predefined = 0; 1316 int predefined = 0;
1318 for (int cs = PDFFONT_ENCODING_WINANSI; cs < PDFFONT_ENCODING_ZAPFDINGBATS; 1317 for (int cs = PDFFONT_ENCODING_WINANSI; cs < PDFFONT_ENCODING_ZAPFDINGBATS;
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 return pChar ? pChar->m_BBox : FX_RECT(); 1695 return pChar ? pChar->m_BBox : FX_RECT();
1697 } 1696 }
1698 1697
1699 CPDF_Type3Char::CPDF_Type3Char(CPDF_Form* pForm) 1698 CPDF_Type3Char::CPDF_Type3Char(CPDF_Form* pForm)
1700 : m_pForm(pForm), m_pBitmap(nullptr), m_bColored(FALSE) {} 1699 : m_pForm(pForm), m_pBitmap(nullptr), m_bColored(FALSE) {}
1701 1700
1702 CPDF_Type3Char::~CPDF_Type3Char() { 1701 CPDF_Type3Char::~CPDF_Type3Char() {
1703 delete m_pForm; 1702 delete m_pForm;
1704 delete m_pBitmap; 1703 delete m_pBitmap;
1705 } 1704 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_font/font_int.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