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 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 | 843 |
844 IFX_FileRead* pFontStream = CreateFontStream(wsFaceName.UTF8Encode()); | 844 IFX_FileRead* pFontStream = CreateFontStream(wsFaceName.UTF8Encode()); |
845 if (!pFontStream) | 845 if (!pFontStream) |
846 return nullptr; | 846 return nullptr; |
847 | 847 |
848 if (!LoadFace(pFontStream, 0)) { | 848 if (!LoadFace(pFontStream, 0)) { |
849 pFontStream->Release(); | 849 pFontStream->Release(); |
850 return nullptr; | 850 return nullptr; |
851 } | 851 } |
852 | 852 |
853 CFX_Font* pInternalFont = new CFX_Font(); | 853 std::unique_ptr<CFX_Font> pInternalFont(new CFX_Font()); |
854 if (!pInternalFont->LoadFile(pFontStream, iFaceIndex)) { | 854 if (!pInternalFont->LoadFile(pFontStream, iFaceIndex)) { |
855 pFontStream->Release(); | 855 pFontStream->Release(); |
856 return nullptr; | 856 return nullptr; |
857 } | 857 } |
858 | 858 |
859 CFGAS_GEFont* pFont = CFGAS_GEFont::LoadFont(pInternalFont, this); | 859 CFGAS_GEFont* pFont = CFGAS_GEFont::LoadFont(std::move(pInternalFont), this); |
860 if (!pFont) { | 860 if (!pFont) { |
861 pFontStream->Release(); | 861 pFontStream->Release(); |
862 return nullptr; | 862 return nullptr; |
863 } | 863 } |
864 | 864 |
865 m_IFXFont2FileRead.SetAt(pFont, pFontStream); | 865 m_IFXFont2FileRead.SetAt(pFont, pFontStream); |
866 if (pFaceCount) | 866 if (pFaceCount) |
867 *pFaceCount = pFont->GetDevFont()->GetFace()->num_faces; | 867 *pFaceCount = pFont->GetDevFont()->GetFace()->num_faces; |
868 | 868 |
869 return pFont; | 869 return pFont; |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 | 1385 |
1386 int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1, | 1386 int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1, |
1387 const CFX_WideString& Name2) { | 1387 const CFX_WideString& Name2) { |
1388 if (Name1.Find(Name2.c_str()) != -1) { | 1388 if (Name1.Find(Name2.c_str()) != -1) { |
1389 return 1; | 1389 return 1; |
1390 } | 1390 } |
1391 return 0; | 1391 return 0; |
1392 } | 1392 } |
1393 | 1393 |
1394 #endif | 1394 #endif |
OLD | NEW |