OLD | NEW |
1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 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/fgas/font/fgas_stdfontmgr.h" | 7 #include "xfa/fgas/font/fgas_stdfontmgr.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_stream.h" | 9 #include "core/fxcrt/include/fx_stream.h" |
10 #include "core/fxge/include/cfx_fontmapper.h" | 10 #include "core/fxge/include/cfx_fontmapper.h" |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 return nullptr; | 840 return nullptr; |
841 | 841 |
842 IFX_SystemFontInfo* pSystemFontInfo = pFontMapper->GetSystemFontInfo(); | 842 IFX_SystemFontInfo* pSystemFontInfo = pFontMapper->GetSystemFontInfo(); |
843 if (!pSystemFontInfo) | 843 if (!pSystemFontInfo) |
844 return nullptr; | 844 return nullptr; |
845 | 845 |
846 IFX_FileRead* pFontStream = CreateFontStream(wsFaceName.UTF8Encode()); | 846 IFX_FileRead* pFontStream = CreateFontStream(wsFaceName.UTF8Encode()); |
847 if (!pFontStream) | 847 if (!pFontStream) |
848 return nullptr; | 848 return nullptr; |
849 | 849 |
850 CFX_Font* pInternalFont = new CFX_Font(); | 850 std::unique_ptr<CFX_Font> pInternalFont(new CFX_Font()); |
851 if (!pInternalFont->LoadFile(pFontStream, iFaceIndex)) { | 851 if (!pInternalFont->LoadFile(pFontStream, iFaceIndex)) { |
852 pFontStream->Release(); | 852 pFontStream->Release(); |
853 return nullptr; | 853 return nullptr; |
854 } | 854 } |
855 | 855 |
856 CFGAS_GEFont* pFont = CFGAS_GEFont::LoadFont(pInternalFont, this); | 856 CFGAS_GEFont* pFont = CFGAS_GEFont::LoadFont(std::move(pInternalFont), this); |
857 if (!pFont) { | 857 if (!pFont) { |
858 pFontStream->Release(); | 858 pFontStream->Release(); |
859 return nullptr; | 859 return nullptr; |
860 } | 860 } |
861 | 861 |
862 m_IFXFont2FileRead.SetAt(pFont, pFontStream); | 862 m_IFXFont2FileRead.SetAt(pFont, pFontStream); |
863 if (pFaceCount) | 863 if (pFaceCount) |
864 *pFaceCount = pFont->GetDevFont()->GetFace()->num_faces; | 864 *pFaceCount = pFont->GetDevFont()->GetFace()->num_faces; |
865 | 865 |
866 return pFont; | 866 return pFont; |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 | 1382 |
1383 int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1, | 1383 int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1, |
1384 const CFX_WideString& Name2) { | 1384 const CFX_WideString& Name2) { |
1385 if (Name1.Find(Name2.c_str()) != -1) { | 1385 if (Name1.Find(Name2.c_str()) != -1) { |
1386 return 1; | 1386 return 1; |
1387 } | 1387 } |
1388 return 0; | 1388 return 0; |
1389 } | 1389 } |
1390 | 1390 |
1391 #endif | 1391 #endif |
OLD | NEW |