| 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 uint32_t dwHash; | 584 uint32_t dwHash; |
| 585 CFX_FontDescriptorInfos* pDescs; | 585 CFX_FontDescriptorInfos* pDescs; |
| 586 m_Hash2CandidateList.GetNextAssoc(pos, dwHash, pDescs); | 586 m_Hash2CandidateList.GetNextAssoc(pos, dwHash, pDescs); |
| 587 delete pDescs; | 587 delete pDescs; |
| 588 } | 588 } |
| 589 pos = m_Hash2Fonts.GetStartPosition(); | 589 pos = m_Hash2Fonts.GetStartPosition(); |
| 590 while (pos) { | 590 while (pos) { |
| 591 uint32_t dwHash; | 591 uint32_t dwHash; |
| 592 CFX_ArrayTemplate<CFGAS_GEFont*>* pFonts; | 592 CFX_ArrayTemplate<CFGAS_GEFont*>* pFonts; |
| 593 m_Hash2Fonts.GetNextAssoc(pos, dwHash, pFonts); | 593 m_Hash2Fonts.GetNextAssoc(pos, dwHash, pFonts); |
| 594 for (int32_t i = 0; i < pFonts->GetSize(); i++) |
| 595 delete pFonts->GetAt(i); |
| 594 delete pFonts; | 596 delete pFonts; |
| 595 } | 597 } |
| 596 m_Hash2Fonts.RemoveAll(); | 598 m_Hash2Fonts.RemoveAll(); |
| 597 pos = m_IFXFont2FileRead.GetStartPosition(); | 599 pos = m_IFXFont2FileRead.GetStartPosition(); |
| 598 while (pos) { | 600 while (pos) { |
| 599 CFGAS_GEFont* pFont; | 601 CFGAS_GEFont* pFont; |
| 600 IFX_FileRead* pFileRead; | 602 IFX_FileRead* pFileRead; |
| 601 m_IFXFont2FileRead.GetNextAssoc(pos, pFont, pFileRead); | 603 m_IFXFont2FileRead.GetNextAssoc(pos, pFont, pFileRead); |
| 602 pFileRead->Release(); | 604 pFileRead->Release(); |
| 603 } | 605 } |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 return nullptr; | 840 return nullptr; |
| 839 | 841 |
| 840 IFX_SystemFontInfo* pSystemFontInfo = pFontMapper->GetSystemFontInfo(); | 842 IFX_SystemFontInfo* pSystemFontInfo = pFontMapper->GetSystemFontInfo(); |
| 841 if (!pSystemFontInfo) | 843 if (!pSystemFontInfo) |
| 842 return nullptr; | 844 return nullptr; |
| 843 | 845 |
| 844 IFX_FileRead* pFontStream = CreateFontStream(wsFaceName.UTF8Encode()); | 846 IFX_FileRead* pFontStream = CreateFontStream(wsFaceName.UTF8Encode()); |
| 845 if (!pFontStream) | 847 if (!pFontStream) |
| 846 return nullptr; | 848 return nullptr; |
| 847 | 849 |
| 848 if (!LoadFace(pFontStream, 0)) { | |
| 849 pFontStream->Release(); | |
| 850 return nullptr; | |
| 851 } | |
| 852 | |
| 853 CFX_Font* pInternalFont = new CFX_Font(); | 850 CFX_Font* pInternalFont = new CFX_Font(); |
| 854 if (!pInternalFont->LoadFile(pFontStream, iFaceIndex)) { | 851 if (!pInternalFont->LoadFile(pFontStream, iFaceIndex)) { |
| 855 pFontStream->Release(); | 852 pFontStream->Release(); |
| 856 return nullptr; | 853 return nullptr; |
| 857 } | 854 } |
| 858 | 855 |
| 859 CFGAS_GEFont* pFont = CFGAS_GEFont::LoadFont(pInternalFont, this); | 856 CFGAS_GEFont* pFont = CFGAS_GEFont::LoadFont(pInternalFont, this); |
| 860 if (!pFont) { | 857 if (!pFont) { |
| 861 pFontStream->Release(); | 858 pFontStream->Release(); |
| 862 return nullptr; | 859 return nullptr; |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 | 1382 |
| 1386 int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1, | 1383 int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1, |
| 1387 const CFX_WideString& Name2) { | 1384 const CFX_WideString& Name2) { |
| 1388 if (Name1.Find(Name2.c_str()) != -1) { | 1385 if (Name1.Find(Name2.c_str()) != -1) { |
| 1389 return 1; | 1386 return 1; |
| 1390 } | 1387 } |
| 1391 return 0; | 1388 return 0; |
| 1392 } | 1389 } |
| 1393 | 1390 |
| 1394 #endif | 1391 #endif |
| OLD | NEW |