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

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp

Issue 1729823004: refactor CPDF_Font and subclasses (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 10 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 "core/src/fpdfapi/fpdf_page/pageint.h" 7 #include "core/src/fpdfapi/fpdf_page/pageint.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 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 } 1251 }
1252 1252
1253 CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) { 1253 CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) {
1254 CPDF_Dictionary* pFontDict = ToDictionary(FindResourceObj("Font", name)); 1254 CPDF_Dictionary* pFontDict = ToDictionary(FindResourceObj("Font", name));
1255 if (!pFontDict) { 1255 if (!pFontDict) {
1256 m_bResourceMissing = TRUE; 1256 m_bResourceMissing = TRUE;
1257 return CPDF_Font::GetStockFont(m_pDocument, "Helvetica"); 1257 return CPDF_Font::GetStockFont(m_pDocument, "Helvetica");
1258 } 1258 }
1259 1259
1260 CPDF_Font* pFont = m_pDocument->LoadFont(pFontDict); 1260 CPDF_Font* pFont = m_pDocument->LoadFont(pFontDict);
1261 if (pFont && pFont->GetType3Font()) { 1261 if (pFont && pFont->IsType3Font()) {
1262 pFont->GetType3Font()->SetPageResources(m_pResources); 1262 pFont->AsType3Font()->SetPageResources(m_pResources);
1263 pFont->GetType3Font()->CheckType3FontMetrics(); 1263 pFont->AsType3Font()->CheckType3FontMetrics();
1264 } 1264 }
1265 return pFont; 1265 return pFont;
1266 } 1266 }
1267 1267
1268 CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace( 1268 CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace(
1269 const CFX_ByteString& name) { 1269 const CFX_ByteString& name) {
1270 if (name == "Pattern") { 1270 if (name == "Pattern") {
1271 return CPDF_ColorSpace::GetStockCS(PDFCS_PATTERN); 1271 return CPDF_ColorSpace::GetStockCS(PDFCS_PATTERN);
1272 } 1272 }
1273 if (name == "DeviceGray" || name == "DeviceCMYK" || name == "DeviceRGB") { 1273 if (name == "DeviceGray" || name == "DeviceCMYK" || name == "DeviceRGB") {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 (fInitKerning * m_pCurStates->m_TextState.GetFontSize()) / 1000; 1329 (fInitKerning * m_pCurStates->m_TextState.GetFontSize()) / 1000;
1330 } else { 1330 } else {
1331 m_pCurStates->m_TextY -= 1331 m_pCurStates->m_TextY -=
1332 (fInitKerning * m_pCurStates->m_TextState.GetFontSize()) / 1000; 1332 (fInitKerning * m_pCurStates->m_TextState.GetFontSize()) / 1000;
1333 } 1333 }
1334 } 1334 }
1335 if (nsegs == 0) { 1335 if (nsegs == 0) {
1336 return; 1336 return;
1337 } 1337 }
1338 int textmode; 1338 int textmode;
1339 if (pFont->GetFontType() == PDFFONT_TYPE3) { 1339 if (pFont->IsType3Font()) {
1340 textmode = 0; 1340 textmode = 0;
1341 } else { 1341 } else {
1342 textmode = m_pCurStates->m_TextState.GetObject()->m_TextMode; 1342 textmode = m_pCurStates->m_TextState.GetObject()->m_TextMode;
1343 } 1343 }
1344 { 1344 {
1345 std::unique_ptr<CPDF_TextObject> pText(new CPDF_TextObject); 1345 std::unique_ptr<CPDF_TextObject> pText(new CPDF_TextObject);
1346 m_pLastTextObject = pText.get(); 1346 m_pLastTextObject = pText.get();
1347 SetGraphicStates(m_pLastTextObject, TRUE, TRUE, TRUE); 1347 SetGraphicStates(m_pLastTextObject, TRUE, TRUE, TRUE);
1348 if (textmode && textmode != 3 && textmode != 4 && textmode != 7) { 1348 if (textmode && textmode != 3 && textmode != 4 && textmode != 7) {
1349 FX_FLOAT* pCTM = pText->m_TextState.GetModify()->m_CTM; 1349 FX_FLOAT* pCTM = pText->m_TextState.GetModify()->m_CTM;
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 } else { 1785 } else {
1786 PDF_ReplaceAbbr(pElement); 1786 PDF_ReplaceAbbr(pElement);
1787 } 1787 }
1788 } 1788 }
1789 break; 1789 break;
1790 } 1790 }
1791 default: 1791 default:
1792 break; 1792 break;
1793 } 1793 }
1794 } 1794 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp ('k') | core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698