diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-08-20 13:38:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-08-22 16:13:44 +0200 |
commit | b04507b6cc36de337b6aae67ed51fd36cc4a3482 (patch) | |
tree | 4a64d188c67609319af6fd34804251853b182a07 /vcl/source/outdev/font.cxx | |
parent | 91ebf44e997483d38096c4abac0c31fdcc3722b8 (diff) |
ensure no font/glyph fallback is happening for repeatable results
Change-Id: I7098ea59f1da2c80cde138109dd6a5c8e5b7e997
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138681
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/outdev/font.cxx')
-rw-r--r-- | vcl/source/outdev/font.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index af0faea6dd74..e334d1bb1fb9 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -613,11 +613,14 @@ void OutputDevice::RemoveFontsSubstitute() vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice* pOutDev ) { - if (!pOutDev && !utl::ConfigManager::IsFuzzing()) // default is NULL + static bool bFuzzing = utl::ConfigManager::IsFuzzing(); + static bool bAbortOnFontSubstitute = getenv("SAL_ABORT_ON_NON_APPLICATION_FONT_USE") != nullptr; + + if (!pOutDev && !bFuzzing) // default is NULL pOutDev = Application::GetDefaultDevice(); OUString aSearch; - if (!utl::ConfigManager::IsFuzzing()) + if (!bFuzzing) { LanguageTag aLanguageTag( ( eLang == LANGUAGE_NONE || eLang == LANGUAGE_SYSTEM || eLang == LANGUAGE_DONTKNOW ) ? @@ -631,6 +634,15 @@ vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLan aSearch = aDefault; else aSearch = rDefaults.getUserInterfaceFont( aLanguageTag ); // use the UI font as a fallback + + // during SAL_ABORT_ON_NON_APPLICATION_FONT_USE cppunit tests we don't have any bundled fonts + // that support the default CTL and CJK languages of Hindi and Chinese, so just pick something + // (unsuitable) that does exist, if they get used, then glyph fallback will trigger std::abort + if (bAbortOnFontSubstitute) + { + if (eLang == LANGUAGE_HINDI || eLang == LANGUAGE_CHINESE_SIMPLIFIED) + aSearch = "DejaVu Sans"; + } } else aSearch = "Liberation Serif"; |