| 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/cfgas_fontmgr.h" | 7 #include "xfa/fgas/font/cfgas_fontmgr.h" |
| 8 | 8 |
| 9 #include <algorithm> |
| 9 #include <memory> | 10 #include <memory> |
| 10 #include <utility> | 11 #include <utility> |
| 11 | 12 |
| 12 #include "core/fxcrt/fx_stream.h" | 13 #include "core/fxcrt/fx_stream.h" |
| 13 #include "core/fxge/cfx_fontmapper.h" | 14 #include "core/fxge/cfx_fontmapper.h" |
| 14 #include "core/fxge/cfx_fontmgr.h" | 15 #include "core/fxge/cfx_fontmgr.h" |
| 15 #include "core/fxge/cfx_gemodule.h" | 16 #include "core/fxge/cfx_gemodule.h" |
| 16 #include "core/fxge/ifx_systemfontinfo.h" | 17 #include "core/fxge/ifx_systemfontinfo.h" |
| 17 #include "third_party/base/ptr_util.h" | 18 #include "third_party/base/ptr_util.h" |
| 18 #include "third_party/base/stl_util.h" | 19 #include "third_party/base/stl_util.h" |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 | 566 |
| 566 auto pFontMgr = pdfium::MakeUnique<CFGAS_FontMgr>(pFontEnum); | 567 auto pFontMgr = pdfium::MakeUnique<CFGAS_FontMgr>(pFontEnum); |
| 567 if (!pFontMgr->EnumFonts()) | 568 if (!pFontMgr->EnumFonts()) |
| 568 return nullptr; | 569 return nullptr; |
| 569 return pFontMgr; | 570 return pFontMgr; |
| 570 } | 571 } |
| 571 | 572 |
| 572 CFGAS_FontMgr::CFGAS_FontMgr(CFX_FontSourceEnum_File* pFontEnum) | 573 CFGAS_FontMgr::CFGAS_FontMgr(CFX_FontSourceEnum_File* pFontEnum) |
| 573 : m_pFontSource(pFontEnum) {} | 574 : m_pFontSource(pFontEnum) {} |
| 574 | 575 |
| 575 CFGAS_FontMgr::~CFGAS_FontMgr() { | 576 CFGAS_FontMgr::~CFGAS_FontMgr() {} |
| 576 for (int32_t i = 0; i < m_InstalledFonts.GetSize(); i++) | |
| 577 delete m_InstalledFonts[i]; | |
| 578 } | |
| 579 | 577 |
| 580 bool CFGAS_FontMgr::EnumFontsFromFontMapper() { | 578 bool CFGAS_FontMgr::EnumFontsFromFontMapper() { |
| 581 CFX_FontMapper* pFontMapper = | 579 CFX_FontMapper* pFontMapper = |
| 582 CFX_GEModule::Get()->GetFontMgr()->GetBuiltinMapper(); | 580 CFX_GEModule::Get()->GetFontMgr()->GetBuiltinMapper(); |
| 583 if (!pFontMapper) | 581 if (!pFontMapper) |
| 584 return false; | 582 return false; |
| 585 | 583 |
| 586 IFX_SystemFontInfo* pSystemFontInfo = pFontMapper->GetSystemFontInfo(); | 584 IFX_SystemFontInfo* pSystemFontInfo = pFontMapper->GetSystemFontInfo(); |
| 587 if (!pSystemFontInfo) | 585 if (!pSystemFontInfo) |
| 588 return false; | 586 return false; |
| 589 | 587 |
| 590 pSystemFontInfo->EnumFontList(pFontMapper); | 588 pSystemFontInfo->EnumFontList(pFontMapper); |
| 591 for (int32_t i = 0; i < pFontMapper->GetFaceSize(); ++i) { | 589 for (int32_t i = 0; i < pFontMapper->GetFaceSize(); ++i) { |
| 592 CFX_RetainPtr<IFX_SeekableReadStream> pFontStream = | 590 CFX_RetainPtr<IFX_SeekableReadStream> pFontStream = |
| 593 CreateFontStream(pFontMapper, pSystemFontInfo, i); | 591 CreateFontStream(pFontMapper, pSystemFontInfo, i); |
| 594 if (!pFontStream) | 592 if (!pFontStream) |
| 595 continue; | 593 continue; |
| 596 | 594 |
| 597 CFX_WideString wsFaceName = | 595 CFX_WideString wsFaceName = |
| 598 CFX_WideString::FromLocal(pFontMapper->GetFaceName(i).c_str()); | 596 CFX_WideString::FromLocal(pFontMapper->GetFaceName(i).c_str()); |
| 599 RegisterFaces(pFontStream, &wsFaceName); | 597 RegisterFaces(pFontStream, &wsFaceName); |
| 600 } | 598 } |
| 601 return m_InstalledFonts.GetSize() != 0; | 599 return !m_InstalledFonts.empty(); |
| 602 } | 600 } |
| 603 | 601 |
| 604 bool CFGAS_FontMgr::EnumFontsFromFiles() { | 602 bool CFGAS_FontMgr::EnumFontsFromFiles() { |
| 605 CFX_GEModule::Get()->GetFontMgr()->InitFTLibrary(); | 603 CFX_GEModule::Get()->GetFontMgr()->InitFTLibrary(); |
| 606 FX_POSITION pos = m_pFontSource->GetStartPosition(); | 604 FX_POSITION pos = m_pFontSource->GetStartPosition(); |
| 607 while (pos) { | 605 while (pos) { |
| 608 CFX_RetainPtr<IFX_FileAccess> pFontSource = m_pFontSource->GetNext(pos); | 606 CFX_RetainPtr<IFX_FileAccess> pFontSource = m_pFontSource->GetNext(pos); |
| 609 CFX_RetainPtr<IFX_SeekableReadStream> pFontStream = | 607 CFX_RetainPtr<IFX_SeekableReadStream> pFontStream = |
| 610 pFontSource->CreateFileStream(FX_FILEMODE_ReadOnly); | 608 pFontSource->CreateFileStream(FX_FILEMODE_ReadOnly); |
| 611 if (pFontStream) | 609 if (pFontStream) |
| 612 RegisterFaces(pFontStream, nullptr); | 610 RegisterFaces(pFontStream, nullptr); |
| 613 } | 611 } |
| 614 return m_InstalledFonts.GetSize() != 0; | 612 return !m_InstalledFonts.empty(); |
| 615 } | 613 } |
| 616 | 614 |
| 617 bool CFGAS_FontMgr::EnumFonts() { | 615 bool CFGAS_FontMgr::EnumFonts() { |
| 618 return EnumFontsFromFontMapper() || EnumFontsFromFiles(); | 616 return EnumFontsFromFontMapper() || EnumFontsFromFiles(); |
| 619 } | 617 } |
| 620 | 618 |
| 621 CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( | 619 CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( |
| 622 const FX_WCHAR* pszFontFamily, | 620 const FX_WCHAR* pszFontFamily, |
| 623 uint32_t dwFontStyles, | 621 uint32_t dwFontStyles, |
| 624 uint16_t wCodePage) { | 622 uint16_t wCodePage) { |
| 625 return GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily); | 623 return GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily); |
| 626 } | 624 } |
| 627 | 625 |
| 628 CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( | 626 CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( |
| 629 uint16_t wCodePage, | 627 uint16_t wCodePage, |
| 630 uint32_t dwFontStyles, | 628 uint32_t dwFontStyles, |
| 631 const FX_WCHAR* pszFontFamily) { | 629 const FX_WCHAR* pszFontFamily) { |
| 632 CFX_ByteString bsHash; | 630 CFX_ByteString bsHash; |
| 633 bsHash.Format("%d, %d", wCodePage, dwFontStyles); | 631 bsHash.Format("%d, %d", wCodePage, dwFontStyles); |
| 634 bsHash += CFX_WideString(pszFontFamily).UTF8Encode(); | 632 bsHash += CFX_WideString(pszFontFamily).UTF8Encode(); |
| 635 uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false); | 633 uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false); |
| 636 std::vector<CFX_RetainPtr<CFGAS_GEFont>>* pFontArray = &m_Hash2Fonts[dwHash]; | 634 std::vector<CFX_RetainPtr<CFGAS_GEFont>>* pFontArray = &m_Hash2Fonts[dwHash]; |
| 637 if (!pFontArray->empty()) | 635 if (!pFontArray->empty()) |
| 638 return (*pFontArray)[0]; | 636 return (*pFontArray)[0]; |
| 639 | 637 |
| 640 CFX_FontDescriptorInfos* sortedFonts = m_Hash2CandidateList[dwHash].get(); | 638 std::vector<CFX_FontDescriptorInfo>* sortedFontInfos = |
| 641 if (!sortedFonts) { | 639 m_Hash2CandidateList[dwHash].get(); |
| 642 auto pNewFonts = pdfium::MakeUnique<CFX_FontDescriptorInfos>(); | 640 if (!sortedFontInfos) { |
| 643 sortedFonts = pNewFonts.get(); | 641 auto pNewFonts = pdfium::MakeUnique<std::vector<CFX_FontDescriptorInfo>>(); |
| 644 MatchFonts(*sortedFonts, wCodePage, dwFontStyles, | 642 sortedFontInfos = pNewFonts.get(); |
| 643 MatchFonts(sortedFontInfos, wCodePage, dwFontStyles, |
| 645 CFX_WideString(pszFontFamily), 0); | 644 CFX_WideString(pszFontFamily), 0); |
| 646 m_Hash2CandidateList[dwHash] = std::move(pNewFonts); | 645 m_Hash2CandidateList[dwHash] = std::move(pNewFonts); |
| 647 } | 646 } |
| 648 if (sortedFonts->GetSize() == 0) | 647 if (sortedFontInfos->empty()) |
| 649 return nullptr; | 648 return nullptr; |
| 650 | 649 |
| 651 CFX_FontDescriptor* pDesc = sortedFonts->GetAt(0).pFont; | 650 CFX_FontDescriptor* pDesc = (*sortedFontInfos)[0].pFont; |
| 652 CFX_RetainPtr<CFGAS_GEFont> pFont = | 651 CFX_RetainPtr<CFGAS_GEFont> pFont = |
| 653 LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); | 652 LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); |
| 654 if (!pFont) | 653 if (!pFont) |
| 655 return nullptr; | 654 return nullptr; |
| 656 | 655 |
| 657 pFont->SetLogicalFontStyle(dwFontStyles); | 656 pFont->SetLogicalFontStyle(dwFontStyles); |
| 658 pFontArray->push_back(pFont); | 657 pFontArray->push_back(pFont); |
| 659 return pFont; | 658 return pFont; |
| 660 } | 659 } |
| 661 | 660 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 674 bsHash.Format("%d, %d, %d", wCodePage, wBitField, dwFontStyles); | 673 bsHash.Format("%d, %d, %d", wCodePage, wBitField, dwFontStyles); |
| 675 else | 674 else |
| 676 bsHash.Format("%d, %d", wCodePage, dwFontStyles); | 675 bsHash.Format("%d, %d", wCodePage, dwFontStyles); |
| 677 bsHash += CFX_WideString(pszFontFamily).UTF8Encode(); | 676 bsHash += CFX_WideString(pszFontFamily).UTF8Encode(); |
| 678 uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false); | 677 uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false); |
| 679 std::vector<CFX_RetainPtr<CFGAS_GEFont>>* pFonts = &m_Hash2Fonts[dwHash]; | 678 std::vector<CFX_RetainPtr<CFGAS_GEFont>>* pFonts = &m_Hash2Fonts[dwHash]; |
| 680 for (size_t i = 0; i < pFonts->size(); ++i) { | 679 for (size_t i = 0; i < pFonts->size(); ++i) { |
| 681 if (VerifyUnicode((*pFonts)[i], wUnicode)) | 680 if (VerifyUnicode((*pFonts)[i], wUnicode)) |
| 682 return (*pFonts)[i]; | 681 return (*pFonts)[i]; |
| 683 } | 682 } |
| 684 CFX_FontDescriptorInfos* sortedFonts = m_Hash2CandidateList[dwHash].get(); | 683 std::vector<CFX_FontDescriptorInfo>* sortedFontInfos = |
| 685 if (!sortedFonts) { | 684 m_Hash2CandidateList[dwHash].get(); |
| 686 auto pNewFonts = pdfium::MakeUnique<CFX_FontDescriptorInfos>(); | 685 if (!sortedFontInfos) { |
| 687 sortedFonts = pNewFonts.get(); | 686 auto pNewFonts = pdfium::MakeUnique<std::vector<CFX_FontDescriptorInfo>>(); |
| 688 MatchFonts(*sortedFonts, wCodePage, dwFontStyles, | 687 sortedFontInfos = pNewFonts.get(); |
| 688 MatchFonts(sortedFontInfos, wCodePage, dwFontStyles, |
| 689 CFX_WideString(pszFontFamily), wUnicode); | 689 CFX_WideString(pszFontFamily), wUnicode); |
| 690 m_Hash2CandidateList[dwHash] = std::move(pNewFonts); | 690 m_Hash2CandidateList[dwHash] = std::move(pNewFonts); |
| 691 } | 691 } |
| 692 for (int32_t i = 0; i < sortedFonts->GetSize(); ++i) { | 692 for (const auto& info : *sortedFontInfos) { |
| 693 CFX_FontDescriptor* pDesc = sortedFonts->GetAt(i).pFont; | 693 CFX_FontDescriptor* pDesc = info.pFont; |
| 694 if (!VerifyUnicode(pDesc, wUnicode)) | 694 if (!VerifyUnicode(pDesc, wUnicode)) |
| 695 continue; | 695 continue; |
| 696 CFX_RetainPtr<CFGAS_GEFont> pFont = | 696 CFX_RetainPtr<CFGAS_GEFont> pFont = |
| 697 LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); | 697 LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); |
| 698 if (!pFont) | 698 if (!pFont) |
| 699 continue; | 699 continue; |
| 700 pFont->SetLogicalFontStyle(dwFontStyles); | 700 pFont->SetLogicalFontStyle(dwFontStyles); |
| 701 pFonts->push_back(pFont); | 701 pFonts->push_back(pFont); |
| 702 return pFont; | 702 return pFont; |
| 703 } | 703 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 return nullptr; | 867 return nullptr; |
| 868 | 868 |
| 869 pSystemFontInfo->EnumFontList(pFontMapper); | 869 pSystemFontInfo->EnumFontList(pFontMapper); |
| 870 for (int32_t i = 0; i < pFontMapper->GetFaceSize(); ++i) { | 870 for (int32_t i = 0; i < pFontMapper->GetFaceSize(); ++i) { |
| 871 if (pFontMapper->GetFaceName(i) == bsFaceName) | 871 if (pFontMapper->GetFaceName(i) == bsFaceName) |
| 872 return CreateFontStream(pFontMapper, pSystemFontInfo, i); | 872 return CreateFontStream(pFontMapper, pSystemFontInfo, i); |
| 873 } | 873 } |
| 874 return nullptr; | 874 return nullptr; |
| 875 } | 875 } |
| 876 | 876 |
| 877 int32_t CFGAS_FontMgr::MatchFonts(CFX_FontDescriptorInfos& MatchedFonts, | 877 void CFGAS_FontMgr::MatchFonts( |
| 878 uint16_t wCodePage, | 878 std::vector<CFX_FontDescriptorInfo>* pMatchedFonts, |
| 879 uint32_t dwFontStyles, | 879 uint16_t wCodePage, |
| 880 const CFX_WideString& FontName, | 880 uint32_t dwFontStyles, |
| 881 FX_WCHAR wcUnicode) { | 881 const CFX_WideString& FontName, |
| 882 MatchedFonts.RemoveAll(); | 882 FX_WCHAR wcUnicode) { |
| 883 CFX_WideString wsNormalizedFontName = FontName; | 883 pMatchedFonts->clear(); |
| 884 | 884 for (const auto& pFont : m_InstalledFonts) { |
| 885 CFX_FontDescriptor* pFont = nullptr; | 885 int32_t nPenalty = |
| 886 int32_t nCount = m_InstalledFonts.GetSize(); | 886 CalcPenalty(pFont.get(), wCodePage, dwFontStyles, FontName, wcUnicode); |
| 887 for (int32_t i = 0; i < nCount; i++) { | |
| 888 pFont = m_InstalledFonts[i]; | |
| 889 int32_t nPenalty = CalcPenalty(pFont, wCodePage, dwFontStyles, | |
| 890 wsNormalizedFontName, wcUnicode); | |
| 891 if (nPenalty >= 0xffff) | 887 if (nPenalty >= 0xffff) |
| 892 continue; | 888 continue; |
| 893 | 889 pMatchedFonts->push_back({pFont.get(), nPenalty}); |
| 894 FX_FontDescriptorInfo FontInfo; | 890 if (pMatchedFonts->size() == 0xffff) |
| 895 FontInfo.pFont = pFont; | |
| 896 FontInfo.nPenalty = nPenalty; | |
| 897 MatchedFonts.Add(FontInfo); | |
| 898 if (MatchedFonts.GetSize() == 0xffff) | |
| 899 break; | 891 break; |
| 900 } | 892 } |
| 901 if (MatchedFonts.GetSize() == 0) | 893 std::sort(pMatchedFonts->begin(), pMatchedFonts->end()); |
| 902 return 0; | |
| 903 | |
| 904 CFX_SSortTemplate<FX_FontDescriptorInfo> ssort; | |
| 905 ssort.ShellSort(MatchedFonts.GetData(), MatchedFonts.GetSize()); | |
| 906 return MatchedFonts.GetSize(); | |
| 907 } | 894 } |
| 908 | 895 |
| 909 int32_t CFGAS_FontMgr::CalcPenalty(CFX_FontDescriptor* pInstalled, | 896 int32_t CFGAS_FontMgr::CalcPenalty(CFX_FontDescriptor* pInstalled, |
| 910 uint16_t wCodePage, | 897 uint16_t wCodePage, |
| 911 uint32_t dwFontStyles, | 898 uint32_t dwFontStyles, |
| 912 const CFX_WideString& FontName, | 899 const CFX_WideString& FontName, |
| 913 FX_WCHAR wcUnicode) { | 900 FX_WCHAR wcUnicode) { |
| 914 int32_t nPenalty = 30000; | 901 int32_t nPenalty = 30000; |
| 915 if (FontName.GetLength() != 0) { | 902 if (FontName.GetLength() != 0) { |
| 916 if (FontName != pInstalled->m_wsFaceName) { | 903 if (FontName != pInstalled->m_wsFaceName) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 if (all_empty) | 983 if (all_empty) |
| 997 m_Hash2Fonts.erase(old_iter); | 984 m_Hash2Fonts.erase(old_iter); |
| 998 } | 985 } |
| 999 } | 986 } |
| 1000 | 987 |
| 1001 void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace, | 988 void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace, |
| 1002 const CFX_WideString* pFaceName) { | 989 const CFX_WideString* pFaceName) { |
| 1003 if ((pFace->face_flags & FT_FACE_FLAG_SCALABLE) == 0) | 990 if ((pFace->face_flags & FT_FACE_FLAG_SCALABLE) == 0) |
| 1004 return; | 991 return; |
| 1005 | 992 |
| 1006 std::unique_ptr<CFX_FontDescriptor> pFont(new CFX_FontDescriptor); | 993 auto pFont = pdfium::MakeUnique<CFX_FontDescriptor>(); |
| 1007 pFont->m_dwFontStyles |= FXFT_Is_Face_Bold(pFace) ? FX_FONTSTYLE_Bold : 0; | 994 pFont->m_dwFontStyles |= FXFT_Is_Face_Bold(pFace) ? FX_FONTSTYLE_Bold : 0; |
| 1008 pFont->m_dwFontStyles |= FXFT_Is_Face_Italic(pFace) ? FX_FONTSTYLE_Italic : 0; | 995 pFont->m_dwFontStyles |= FXFT_Is_Face_Italic(pFace) ? FX_FONTSTYLE_Italic : 0; |
| 1009 pFont->m_dwFontStyles |= GetFlags(pFace); | 996 pFont->m_dwFontStyles |= GetFlags(pFace); |
| 1010 | 997 |
| 1011 std::vector<uint16_t> charsets = GetCharsets(pFace); | 998 std::vector<uint16_t> charsets = GetCharsets(pFace); |
| 1012 GetUSBCSB(pFace, pFont->m_dwUsb, pFont->m_dwCsb); | 999 GetUSBCSB(pFace, pFont->m_dwUsb, pFont->m_dwCsb); |
| 1013 | 1000 |
| 1014 FT_ULong dwTag; | 1001 FT_ULong dwTag; |
| 1015 FT_ENC_TAG(dwTag, 'n', 'a', 'm', 'e'); | 1002 FT_ENC_TAG(dwTag, 'n', 'a', 'm', 'e'); |
| 1016 | 1003 |
| 1017 std::vector<uint8_t> table; | 1004 std::vector<uint8_t> table; |
| 1018 unsigned long nLength = 0; | 1005 unsigned long nLength = 0; |
| 1019 unsigned int error = FXFT_Load_Sfnt_Table(pFace, dwTag, 0, nullptr, &nLength); | 1006 unsigned int error = FXFT_Load_Sfnt_Table(pFace, dwTag, 0, nullptr, &nLength); |
| 1020 if (error == 0 && nLength != 0) { | 1007 if (error == 0 && nLength != 0) { |
| 1021 table.resize(nLength); | 1008 table.resize(nLength); |
| 1022 if (FXFT_Load_Sfnt_Table(pFace, dwTag, 0, table.data(), nullptr)) | 1009 if (FXFT_Load_Sfnt_Table(pFace, dwTag, 0, table.data(), nullptr)) |
| 1023 table.clear(); | 1010 table.clear(); |
| 1024 } | 1011 } |
| 1025 GetNames(table.empty() ? nullptr : table.data(), pFont->m_wsFamilyNames); | 1012 GetNames(table.empty() ? nullptr : table.data(), pFont->m_wsFamilyNames); |
| 1026 pFont->m_wsFamilyNames.push_back( | 1013 pFont->m_wsFamilyNames.push_back( |
| 1027 CFX_ByteString(pFace->family_name).UTF8Decode()); | 1014 CFX_ByteString(pFace->family_name).UTF8Decode()); |
| 1028 pFont->m_wsFaceName = | 1015 pFont->m_wsFaceName = |
| 1029 pFaceName ? *pFaceName | 1016 pFaceName ? *pFaceName |
| 1030 : CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(pFace)); | 1017 : CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(pFace)); |
| 1031 pFont->m_nFaceIndex = pFace->face_index; | 1018 pFont->m_nFaceIndex = pFace->face_index; |
| 1032 m_InstalledFonts.Add(pFont.release()); | 1019 m_InstalledFonts.push_back(std::move(pFont)); |
| 1033 } | 1020 } |
| 1034 | 1021 |
| 1035 void CFGAS_FontMgr::RegisterFaces( | 1022 void CFGAS_FontMgr::RegisterFaces( |
| 1036 const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, | 1023 const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, |
| 1037 const CFX_WideString* pFaceName) { | 1024 const CFX_WideString* pFaceName) { |
| 1038 int32_t index = 0; | 1025 int32_t index = 0; |
| 1039 int32_t num_faces = 0; | 1026 int32_t num_faces = 0; |
| 1040 do { | 1027 do { |
| 1041 FXFT_Face pFace = LoadFace(pFontStream, index++); | 1028 FXFT_Face pFace = LoadFace(pFontStream, index++); |
| 1042 if (!pFace) | 1029 if (!pFace) |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 } | 1131 } |
| 1145 | 1132 |
| 1146 int32_t CFGAS_FontMgr::IsPartName(const CFX_WideString& Name1, | 1133 int32_t CFGAS_FontMgr::IsPartName(const CFX_WideString& Name1, |
| 1147 const CFX_WideString& Name2) { | 1134 const CFX_WideString& Name2) { |
| 1148 if (Name1.Find(Name2.c_str()) != -1) | 1135 if (Name1.Find(Name2.c_str()) != -1) |
| 1149 return 1; | 1136 return 1; |
| 1150 return 0; | 1137 return 0; |
| 1151 } | 1138 } |
| 1152 | 1139 |
| 1153 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 1140 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| OLD | NEW |