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/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 "xfa/fgas/crt/fgas_codepage.h" | 10 #include "xfa/fgas/crt/fgas_codepage.h" |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 } | 548 } |
549 return (FX_POSITION)-1; | 549 return (FX_POSITION)-1; |
550 } | 550 } |
551 | 551 |
552 IFX_FileAccess* CFX_FontSourceEnum_File::GetNext(FX_POSITION& pos) { | 552 IFX_FileAccess* CFX_FontSourceEnum_File::GetNext(FX_POSITION& pos) { |
553 IFX_FileAccess* pAccess = FX_CreateDefaultFileAccess(m_wsNext.AsStringC()); | 553 IFX_FileAccess* pAccess = FX_CreateDefaultFileAccess(m_wsNext.AsStringC()); |
554 m_wsNext = GetNextFile().UTF8Decode(); | 554 m_wsNext = GetNextFile().UTF8Decode(); |
555 pos = 0 != m_wsNext.GetLength() ? pAccess : NULL; | 555 pos = 0 != m_wsNext.GetLength() ? pAccess : NULL; |
556 return (IFX_FileAccess*)pAccess; | 556 return (IFX_FileAccess*)pAccess; |
557 } | 557 } |
558 IFX_FontSourceEnum* FX_CreateDefaultFontSourceEnum() { | 558 |
559 return (IFX_FontSourceEnum*)new CFX_FontSourceEnum_File; | 559 IFX_FontMgr* IFX_FontMgr::Create(CFX_FontSourceEnum_File* pFontEnum) { |
| 560 if (!pFontEnum) |
| 561 return nullptr; |
| 562 |
| 563 CFX_FontMgrImp* pFontMgr = new CFX_FontMgrImp(pFontEnum); |
| 564 if (pFontMgr->EnumFonts()) |
| 565 return pFontMgr; |
| 566 |
| 567 delete pFontMgr; |
| 568 return nullptr; |
560 } | 569 } |
561 IFX_FontMgr* IFX_FontMgr::Create(IFX_FontSourceEnum* pFontEnum) { | 570 CFX_FontMgrImp::CFX_FontMgrImp(CFX_FontSourceEnum_File* pFontEnum) |
562 if (NULL == pFontEnum) { | |
563 return NULL; | |
564 } | |
565 CFX_FontMgrImp* pFontMgr = new CFX_FontMgrImp(pFontEnum); | |
566 if (pFontMgr->EnumFonts()) { | |
567 return pFontMgr; | |
568 } | |
569 delete pFontMgr; | |
570 return NULL; | |
571 } | |
572 CFX_FontMgrImp::CFX_FontMgrImp(IFX_FontSourceEnum* pFontEnum) | |
573 : m_pFontSource(pFontEnum) {} | 571 : m_pFontSource(pFontEnum) {} |
574 | 572 |
575 FX_BOOL CFX_FontMgrImp::EnumFontsFromFontMapper() { | 573 FX_BOOL CFX_FontMgrImp::EnumFontsFromFontMapper() { |
576 CFX_FontMapper* pFontMapper = | 574 CFX_FontMapper* pFontMapper = |
577 CFX_GEModule::Get()->GetFontMgr()->GetBuiltinMapper(); | 575 CFX_GEModule::Get()->GetFontMgr()->GetBuiltinMapper(); |
578 if (!pFontMapper) | 576 if (!pFontMapper) |
579 return FALSE; | 577 return FALSE; |
580 | 578 |
581 IFX_SystemFontInfo* pSystemFontInfo = pFontMapper->GetSystemFontInfo(); | 579 IFX_SystemFontInfo* pSystemFontInfo = pFontMapper->GetSystemFontInfo(); |
582 if (!pSystemFontInfo) | 580 if (!pSystemFontInfo) |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 } | 1500 } |
1503 } | 1501 } |
1504 int32_t CFX_FontMgrImp::IsPartName(const CFX_WideString& Name1, | 1502 int32_t CFX_FontMgrImp::IsPartName(const CFX_WideString& Name1, |
1505 const CFX_WideString& Name2) { | 1503 const CFX_WideString& Name2) { |
1506 if (Name1.Find(Name2.c_str()) != -1) { | 1504 if (Name1.Find(Name2.c_str()) != -1) { |
1507 return 1; | 1505 return 1; |
1508 } | 1506 } |
1509 return 0; | 1507 return 0; |
1510 } | 1508 } |
1511 #endif | 1509 #endif |
OLD | NEW |