| 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 "fpdfsdk/pdfwindow/PWL_FontMap.h" | 7 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
| 10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" | 10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" |
| 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" |
| 12 #include "core/fpdfapi/include/cpdf_modulemgr.h" | 13 #include "core/fpdfapi/include/cpdf_modulemgr.h" |
| 13 #include "core/fpdfdoc/include/ipvt_fontmap.h" | 14 #include "core/fpdfdoc/include/ipvt_fontmap.h" |
| 14 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | 15 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 const char kDefaultFontName[] = "Helvetica"; | 19 const char kDefaultFontName[] = "Helvetica"; |
| 19 | 20 |
| 20 const char* const g_sDEStandardFontName[] = {"Courier", | 21 const char* const g_sDEStandardFontName[] = {"Courier", |
| 21 "Courier-Bold", | 22 "Courier-Bold", |
| (...skipping 21 matching lines...) Expand all Loading... |
| 43 Empty(); | 44 Empty(); |
| 44 } | 45 } |
| 45 | 46 |
| 46 void CPWL_FontMap::SetSystemHandler(CFX_SystemHandler* pSystemHandler) { | 47 void CPWL_FontMap::SetSystemHandler(CFX_SystemHandler* pSystemHandler) { |
| 47 m_pSystemHandler = pSystemHandler; | 48 m_pSystemHandler = pSystemHandler; |
| 48 } | 49 } |
| 49 | 50 |
| 50 CPDF_Document* CPWL_FontMap::GetDocument() { | 51 CPDF_Document* CPWL_FontMap::GetDocument() { |
| 51 if (!m_pPDFDoc) { | 52 if (!m_pPDFDoc) { |
| 52 if (CPDF_ModuleMgr::Get()) { | 53 if (CPDF_ModuleMgr::Get()) { |
| 53 m_pPDFDoc.reset(new CPDF_Document(nullptr)); | 54 m_pPDFDoc.reset(new CPDF_Document(std::unique_ptr<CPDF_Parser>())); |
| 54 m_pPDFDoc->CreateNewDoc(); | 55 m_pPDFDoc->CreateNewDoc(); |
| 55 } | 56 } |
| 56 } | 57 } |
| 57 | 58 |
| 58 return m_pPDFDoc.get(); | 59 return m_pPDFDoc.get(); |
| 59 } | 60 } |
| 60 | 61 |
| 61 CPDF_Font* CPWL_FontMap::GetPDFFont(int32_t nFontIndex) { | 62 CPDF_Font* CPWL_FontMap::GetPDFFont(int32_t nFontIndex) { |
| 62 if (nFontIndex >= 0 && nFontIndex < m_aData.GetSize()) { | 63 if (nFontIndex >= 0 && nFontIndex < m_aData.GetSize()) { |
| 63 if (CPWL_FontMap_Data* pData = m_aData.GetAt(nFontIndex)) { | 64 if (CPWL_FontMap_Data* pData = m_aData.GetAt(nFontIndex)) { |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 488 |
| 488 CPWL_DocFontMap::CPWL_DocFontMap(CFX_SystemHandler* pSystemHandler, | 489 CPWL_DocFontMap::CPWL_DocFontMap(CFX_SystemHandler* pSystemHandler, |
| 489 CPDF_Document* pAttachedDoc) | 490 CPDF_Document* pAttachedDoc) |
| 490 : CPWL_FontMap(pSystemHandler), m_pAttachedDoc(pAttachedDoc) {} | 491 : CPWL_FontMap(pSystemHandler), m_pAttachedDoc(pAttachedDoc) {} |
| 491 | 492 |
| 492 CPWL_DocFontMap::~CPWL_DocFontMap() {} | 493 CPWL_DocFontMap::~CPWL_DocFontMap() {} |
| 493 | 494 |
| 494 CPDF_Document* CPWL_DocFontMap::GetDocument() { | 495 CPDF_Document* CPWL_DocFontMap::GetDocument() { |
| 495 return m_pAttachedDoc; | 496 return m_pAttachedDoc; |
| 496 } | 497 } |
| OLD | NEW |