Avoid redundant EnumFontList() invocations.

Instead, use the (idempotent) CFX_FontMapper::LoadInstalledFonts()
which makes this exact call but at most once per font mapper. Continue
to call this in CreateFontStream() even though it appears redundant
because I've not run down all possible call paths.

For the simple_xfa.pdf document, this results in a 4x reduction in
the number of times the font directories are scanned. This is a
contributor to the referenced bug, but other problems still remain.

Bug: pdfium:1460
Change-Id: Ie0329dd329e586db02436b963352a66a6c4e751e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/65532
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index a0a2dd5..c50d9e7 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -469,11 +469,12 @@
     const ByteString& bsFaceName) {
   CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr();
   CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper();
+  pFontMapper->LoadInstalledFonts();
+
   SystemFontInfoIface* pSystemFontInfo = pFontMapper->GetSystemFontInfo();
   if (!pSystemFontInfo)
     return nullptr;
 
-  pSystemFontInfo->EnumFontList(pFontMapper);
   for (int32_t i = 0; i < pFontMapper->GetFaceSize(); ++i) {
     if (pFontMapper->GetFaceName(i) == bsFaceName)
       return CreateFontStream(pFontMapper, pSystemFontInfo, i);
@@ -636,7 +637,6 @@
   if (!pSystemFontInfo)
     return false;
 
-  pSystemFontInfo->EnumFontList(pFontMapper);
   for (int32_t i = 0; i < pFontMapper->GetFaceSize(); ++i) {
     RetainPtr<IFX_SeekableReadStream> pFontStream =
         CreateFontStream(pFontMapper, pSystemFontInfo, i);