From ea98238666e33cd16b69cb23dcaca047c21c9998 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Tue, 12 Apr 2016 10:51:04 -0700 Subject: Record all fonts, not just one per charset. Attempting to open bug_434.pdf on my Linux box would fail with: ../../xfa/fxfa/app/xfa_fwltheme.cpp:96: virtual FWL_ERR CXFA_FWLTheme::Initialize(): Assertion `__null != m_pCalendarFont' failed. I tracked the regression back to [1]. The issue seems to be in CFX_FontManager::AddInstalledFont we will only add one font for a given Charset. In my case I end up loading 6 charsets, but the fonts are all strange ones. When I open the PDF, it fails to find 'Arial' because I've registered these other fonts. To fix this I changed the m_FaceArray into a struct of {name, chraset}. Then we record all fonts into this list and search over that list for the charset when needed. This allows bug_434.pdf to open and the test to pass successfully. 1- https://pdfium.googlesource.com/pdfium/+/fe73e7849b8b4ce49408d2f52f3fc29b370b82b5 Review URL: https://codereview.chromium.org/1874433002 --- core/fxge/include/fx_font.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'core/fxge/include/fx_font.h') diff --git a/core/fxge/include/fx_font.h b/core/fxge/include/fx_font.h index 48571332ae..37adc832f4 100644 --- a/core/fxge/include/fx_font.h +++ b/core/fxge/include/fx_font.h @@ -312,7 +312,9 @@ class CFX_FontMapper { #endif // PDF_ENABLE_XFA FX_BOOL IsBuiltinFace(const FXFT_Face face) const; int GetFaceSize() const; - CFX_ByteString GetFaceName(int index) const { return m_FaceArray[index]; } + CFX_ByteString GetFaceName(int index) const { + return m_FaceArray[index].name; + } std::vector m_InstalledTTFonts; @@ -328,11 +330,15 @@ class CFX_FontMapper { int weight, int picthfamily); + struct FaceData { + CFX_ByteString name; + uint32_t charset; + }; + FX_BOOL m_bListLoaded; FXFT_Face m_MMFaces[MM_FACE_COUNT]; CFX_ByteString m_LastFamily; - CFX_ArrayTemplate m_CharsetArray; - std::vector m_FaceArray; + std::vector m_FaceArray; IFX_SystemFontInfo* m_pFontInfo; FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT]; CFX_FontMgr* const m_pFontMgr; -- cgit v1.2.3