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