From 1118a66bfe024e137324075ac4d9433b9425e373 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Thu, 31 May 2018 19:26:52 +0000 Subject: Make XFA pixel tests more stable When generating PDFs using the fixup script and a .in, specify them to to use Ahem.ttf as the text font. Ahem is a font designed to reduce flakiness in pixel tests due to font rendering differences between platforms. Specifically the glyphs in the font are standard size black boxes, so though the specific text content cannot be easily compared, things like layout and high level changes to the content can still be tested. Testing things like specific text changes should be done via an embedder test, where the strings in the elements can be extracted and inspected. The font itself is is CID type 2 font, which is relatively complex to correctly embed in a PDF due to subsetting and other features. Instead of embedding it in the generated PDFs, which was originally attempted, it is being supplied to pdfium_test via the --font-dir flag. This flag overrides where the binary looks for system fonts. This works correctly on Mac and Linux, but not on Windows, which is why that platform remains suppressed. BUG=pdfium:1008,pdfium:1020 Change-Id: I00811536de98f736fc599d96b397194ccf8db0cd Reviewed-on: https://pdfium-review.googlesource.com/27790 Commit-Queue: Ryan Harrison Reviewed-by: Lei Zhang --- xfa/fgas/font/cfgas_fontmgr.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'xfa/fgas') diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index 354db0be43..abd5aa716a 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp @@ -478,6 +478,8 @@ bool CFGAS_FontMgr::EnumFontsFromFontMapper() { if (!pFontMapper) return false; + pFontMapper->LoadInstalledFonts(); + SystemFontInfoIface* pSystemFontInfo = pFontMapper->GetSystemFontInfo(); if (!pSystemFontInfo) return false; @@ -493,6 +495,7 @@ bool CFGAS_FontMgr::EnumFontsFromFontMapper() { WideString::FromLocal(pFontMapper->GetFaceName(i).c_str()); RegisterFaces(pFontStream, &wsFaceName); } + return !m_InstalledFonts.empty(); } -- cgit v1.2.3