| 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 "xfa/fxfa/xfa_fontmgr.h" | 7 #include "xfa/fxfa/xfa_fontmgr.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "core/fpdfapi/font/cpdf_font.h" | 13 #include "core/fpdfapi/font/cpdf_font.h" |
| 14 #include "core/fpdfapi/parser/cpdf_dictionary.h" | 14 #include "core/fpdfapi/parser/cpdf_dictionary.h" |
| 15 #include "core/fpdfapi/parser/cpdf_document.h" | 15 #include "core/fpdfapi/parser/cpdf_document.h" |
| 16 #include "third_party/base/ptr_util.h" |
| 16 #include "xfa/fgas/font/cfgas_gefont.h" | 17 #include "xfa/fgas/font/cfgas_gefont.h" |
| 17 #include "xfa/fxfa/xfa_ffapp.h" | 18 #include "xfa/fxfa/xfa_ffapp.h" |
| 18 #include "xfa/fxfa/xfa_ffdoc.h" | 19 #include "xfa/fxfa/xfa_ffdoc.h" |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 // The 5 names per entry are: PsName, Normal, Bold, Italic, BoldItalic. | 23 // The 5 names per entry are: PsName, Normal, Bold, Italic, BoldItalic. |
| 23 const char* const g_XFAPDFFontName[][5] = { | 24 const char* const g_XFAPDFFontName[][5] = { |
| 24 {"Adobe PI Std", "AdobePIStd", "AdobePIStd", "AdobePIStd", "AdobePIStd"}, | 25 {"Adobe PI Std", "AdobePIStd", "AdobePIStd", "AdobePIStd", "AdobePIStd"}, |
| 25 {"Myriad Pro Light", "MyriadPro-Light", "MyriadPro-Semibold", | 26 {"Myriad Pro Light", "MyriadPro-Light", "MyriadPro-Semibold", |
| (...skipping 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2040 pMgr->SetFont(pFont, pPDFFont); | 2041 pMgr->SetFont(pFont, pPDFFont); |
| 2041 pFont->SetFontProvider(pMgr); | 2042 pFont->SetFontProvider(pMgr); |
| 2042 } | 2043 } |
| 2043 m_FontMap[bsKey] = pFont; | 2044 m_FontMap[bsKey] = pFont; |
| 2044 } | 2045 } |
| 2045 return pFont; | 2046 return pFont; |
| 2046 } | 2047 } |
| 2047 | 2048 |
| 2048 void CXFA_FontMgr::LoadDocFonts(CXFA_FFDoc* hDoc) { | 2049 void CXFA_FontMgr::LoadDocFonts(CXFA_FFDoc* hDoc) { |
| 2049 if (!m_PDFFontMgrMap[hDoc]) | 2050 if (!m_PDFFontMgrMap[hDoc]) |
| 2050 m_PDFFontMgrMap[hDoc].reset(new CXFA_PDFFontMgr(hDoc)); | 2051 m_PDFFontMgrMap[hDoc] = pdfium::MakeUnique<CXFA_PDFFontMgr>(hDoc); |
| 2051 } | 2052 } |
| 2052 | 2053 |
| 2053 void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) { | 2054 void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) { |
| 2054 m_PDFFontMgrMap.erase(hDoc); | 2055 m_PDFFontMgrMap.erase(hDoc); |
| 2055 } | 2056 } |
| 2056 | 2057 |
| 2057 void CXFA_FontMgr::SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) { | 2058 void CXFA_FontMgr::SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) { |
| 2058 m_pDefFontMgr = std::move(pFontMgr); | 2059 m_pDefFontMgr = std::move(pFontMgr); |
| 2059 } | 2060 } |
| OLD | NEW |