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

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

Issue 1410043003: Declare PDF_GetStandardFontName() in the header. (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
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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 int CPDF_Font::GetCharTypeWidth(FX_DWORD charcode) { 363 int CPDF_Font::GetCharTypeWidth(FX_DWORD charcode) {
364 if (!m_Font.GetFace()) 364 if (!m_Font.GetFace())
365 return 0; 365 return 0;
366 366
367 int glyph_index = GlyphFromCharCode(charcode); 367 int glyph_index = GlyphFromCharCode(charcode);
368 if (glyph_index == 0xffff) { 368 if (glyph_index == 0xffff) {
369 return 0; 369 return 0;
370 } 370 }
371 return m_Font.GetGlyphWidth(glyph_index); 371 return m_Font.GetGlyphWidth(glyph_index);
372 } 372 }
373 int _PDF_GetStandardFontName(CFX_ByteString& name); 373
374 CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc, 374 CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc,
375 const CFX_ByteStringC& name) { 375 const CFX_ByteStringC& name) {
376 CFX_ByteString fontname(name); 376 CFX_ByteString fontname(name);
377 int font_id = _PDF_GetStandardFontName(fontname); 377 int font_id = PDF_GetStandardFontName(&fontname);
378 if (font_id < 0) { 378 if (font_id < 0) {
379 return NULL; 379 return nullptr;
380 } 380 }
381 CPDF_FontGlobals* pFontGlobals = 381 CPDF_FontGlobals* pFontGlobals =
382 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); 382 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
383 CPDF_Font* pFont = pFontGlobals->Find(pDoc, font_id); 383 CPDF_Font* pFont = pFontGlobals->Find(pDoc, font_id);
384 if (pFont) { 384 if (pFont) {
385 return pFont; 385 return pFont;
386 } 386 }
387 CPDF_Dictionary* pDict = CPDF_Dictionary::Create(); 387 CPDF_Dictionary* pDict = CPDF_Dictionary::Create();
388 pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("Font")); 388 pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("Font"));
389 pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Type1")); 389 pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Type1"));
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 } 994 }
995 FX_BOOL CPDF_SimpleFont::IsUnicodeCompatible() const { 995 FX_BOOL CPDF_SimpleFont::IsUnicodeCompatible() const {
996 return m_BaseEncoding != PDFFONT_ENCODING_BUILTIN && 996 return m_BaseEncoding != PDFFONT_ENCODING_BUILTIN &&
997 m_BaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL && 997 m_BaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL &&
998 m_BaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS; 998 m_BaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS;
999 } 999 }
1000 CPDF_Type1Font::CPDF_Type1Font() : CPDF_SimpleFont(PDFFONT_TYPE1) { 1000 CPDF_Type1Font::CPDF_Type1Font() : CPDF_SimpleFont(PDFFONT_TYPE1) {
1001 m_Base14Font = -1; 1001 m_Base14Font = -1;
1002 } 1002 }
1003 FX_BOOL CPDF_Type1Font::_Load() { 1003 FX_BOOL CPDF_Type1Font::_Load() {
1004 m_Base14Font = _PDF_GetStandardFontName(m_BaseFont); 1004 m_Base14Font = PDF_GetStandardFontName(&m_BaseFont);
1005 if (m_Base14Font >= 0) { 1005 if (m_Base14Font >= 0) {
1006 CPDF_Dictionary* pFontDesc = 1006 CPDF_Dictionary* pFontDesc =
1007 m_pFontDict->GetDict(FX_BSTRC("FontDescriptor")); 1007 m_pFontDict->GetDict(FX_BSTRC("FontDescriptor"));
1008 if (pFontDesc && pFontDesc->KeyExist(FX_BSTRC("Flags"))) { 1008 if (pFontDesc && pFontDesc->KeyExist(FX_BSTRC("Flags"))) {
1009 m_Flags = pFontDesc->GetInteger(FX_BSTRC("Flags")); 1009 m_Flags = pFontDesc->GetInteger(FX_BSTRC("Flags"));
1010 } else { 1010 } else {
1011 m_Flags = m_Base14Font >= 12 ? PDFFONT_SYMBOLIC : PDFFONT_NONSYMBOLIC; 1011 m_Flags = m_Base14Font >= 12 ? PDFFONT_SYMBOLIC : PDFFONT_NONSYMBOLIC;
1012 } 1012 }
1013 if (m_Base14Font < 4) 1013 if (m_Base14Font < 4)
1014 for (int i = 0; i < 256; i++) { 1014 for (int i = 0; i < 256; i++) {
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 CPDF_Type3Char::CPDF_Type3Char() { 1780 CPDF_Type3Char::CPDF_Type3Char() {
1781 m_pForm = NULL; 1781 m_pForm = NULL;
1782 m_pBitmap = NULL; 1782 m_pBitmap = NULL;
1783 m_bPageRequired = FALSE; 1783 m_bPageRequired = FALSE;
1784 m_bColored = FALSE; 1784 m_bColored = FALSE;
1785 } 1785 }
1786 CPDF_Type3Char::~CPDF_Type3Char() { 1786 CPDF_Type3Char::~CPDF_Type3Char() {
1787 delete m_pForm; 1787 delete m_pForm;
1788 delete m_pBitmap; 1788 delete m_pBitmap;
1789 } 1789 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698