diff options
-rw-r--r-- | sw/CppunitTest_sw_core_layout.mk | 2 | ||||
-rw-r--r-- | sw/layoutwriter_setup.mk | 2 | ||||
-rw-r--r-- | vcl/CppunitTest_vcl_pdfexport.mk | 2 | ||||
-rw-r--r-- | vcl/CppunitTest_vcl_text.mk | 5 | ||||
-rw-r--r-- | vcl/source/gdi/impglyphitem.cxx | 8 | ||||
-rw-r--r-- | vcl/source/outdev/font.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/fontconfig.cxx | 7 |
7 files changed, 25 insertions, 11 deletions
diff --git a/sw/CppunitTest_sw_core_layout.mk b/sw/CppunitTest_sw_core_layout.mk index 80dc1530fdb3..8d8458ea8c4e 100644 --- a/sw/CppunitTest_sw_core_layout.mk +++ b/sw/CppunitTest_sw_core_layout.mk @@ -74,7 +74,7 @@ $(eval $(call gb_CppunitTest_use_uiconfigs,sw_core_layout, \ # assert if font/glyph fallback occurs $(call gb_CppunitTest_get_target,sw_core_layout): \ EXTRA_ENV_VARS := \ - SAL_ABORT_ON_NON_APPLICATION_FONT_USE=1 + SAL_NON_APPLICATION_FONT_USE=abort $(eval $(call gb_CppunitTest_use_more_fonts,sw_core_layout)) diff --git a/sw/layoutwriter_setup.mk b/sw/layoutwriter_setup.mk index 9d10fa9ac2c6..683ca04f4a9f 100644 --- a/sw/layoutwriter_setup.mk +++ b/sw/layoutwriter_setup.mk @@ -85,7 +85,7 @@ $(call gb_CppunitTest_get_target,sw_layoutwriter$(1)): \ # assert if font/glyph fallback occurs $(call gb_CppunitTest_get_target,sw_layoutwriter$(1)): \ EXTRA_ENV_VARS := \ - SAL_ABORT_ON_NON_APPLICATION_FONT_USE=1 + SAL_NON_APPLICATION_FONT_USE=abort $(eval $(call gb_CppunitTest_use_more_fonts,sw_layoutwriter$(1))) diff --git a/vcl/CppunitTest_vcl_pdfexport.mk b/vcl/CppunitTest_vcl_pdfexport.mk index 1810d69042e0..b43d14ee9857 100644 --- a/vcl/CppunitTest_vcl_pdfexport.mk +++ b/vcl/CppunitTest_vcl_pdfexport.mk @@ -46,7 +46,7 @@ $(eval $(call gb_CppunitTest_use_configuration,vcl_pdfexport)) # assert if font/glyph fallback occurs $(call gb_CppunitTest_get_target,vcl_pdfexport): \ EXTRA_ENV_VARS := \ - SAL_ABORT_ON_NON_APPLICATION_FONT_USE=1 + SAL_NON_APPLICATION_FONT_USE=abort $(eval $(call gb_CppunitTest_use_more_fonts,vcl_pdfexport)) diff --git a/vcl/CppunitTest_vcl_text.mk b/vcl/CppunitTest_vcl_text.mk index 4ffa3b1990ca..cf091ba88c25 100644 --- a/vcl/CppunitTest_vcl_text.mk +++ b/vcl/CppunitTest_vcl_text.mk @@ -61,6 +61,11 @@ $(eval $(call gb_CppunitTest_use_components,vcl_text,\ $(eval $(call gb_CppunitTest_use_configuration,vcl_text)) +# only allow bundled fonts, but don't abort if font/glyph fallback occurs +$(call gb_CppunitTest_get_target,vcl_text): \ + EXTRA_ENV_VARS := \ + SAL_NON_APPLICATION_FONT_USE=deny + $(eval $(call gb_CppunitTest_use_more_fonts,vcl_text)) # vim: set noet sw=4 ts=4: diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx index 53f9b1d18b9a..7bed1391c0d5 100644 --- a/vcl/source/gdi/impglyphitem.cxx +++ b/vcl/source/gdi/impglyphitem.cxx @@ -363,14 +363,16 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr<const OutputDevice> outputDevice, c // part being underlined. Doing this for any two segments allows this optimization // even when the prefix of the string would use a different font. // TODO: Can those font differences be ignored? - // Writer layouts tests enable SAL_ABORT_ON_NON_APPLICATION_FONT_USE in order + // Writer layouts tests enable SAL_NON_APPLICATION_FONT_USE=abort in order // to make PrintFontManager::Substitute() abort if font fallback happens. When // laying out the entire string the chance this happens increases (e.g. testAbi11870 // normally calls this function only for a part of a string, but this optimization // lays out the entire string and causes a fallback). Since this optimization // does not change result of this function, simply disable it for those tests. - static bool bAbortOnFontSubstitute - = getenv("SAL_ABORT_ON_NON_APPLICATION_FONT_USE") != nullptr; + static const bool bAbortOnFontSubstitute = [] { + const char* pEnv = getenv("SAL_NON_APPLICATION_FONT_USE"); + return pEnv && strcmp(pEnv, "abort") == 0; + }(); if (mLastSubstringKey.has_value() && !bAbortOnFontSubstitute) { sal_Int32 pos = nIndex; diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index dc5ca50abaf9..56d476e0a8f1 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -588,7 +588,10 @@ vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLan GetDefaultFontFlags nFlags, const OutputDevice* pOutDev ) { static bool bFuzzing = utl::ConfigManager::IsFuzzing(); - static bool bAbortOnFontSubstitute = getenv("SAL_ABORT_ON_NON_APPLICATION_FONT_USE") != nullptr; + static bool bAbortOnFontSubstitute = [] { + const char* pEnv = getenv("SAL_NON_APPLICATION_FONT_USE"); + return pEnv && strcmp(pEnv, "abort") == 0; + }(); if (!pOutDev && !bFuzzing) // default is NULL pOutDev = Application::GetDefaultDevice(); @@ -609,9 +612,10 @@ vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLan 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 + // during cppunit tests with SAL_NON_APPLICATION_FONT_USE set 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 + // (unsuitable) that does exist, if they get used with SAL_NON_APPLICATION_FONT_USE=abort then + // glyph fallback will trigger std::abort if (bAbortOnFontSubstitute) { if (eLang == LANGUAGE_HINDI || eLang == LANGUAGE_CHINESE_SIMPLIFIED) diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index d1589a18473a..e4eca6f34d93 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -308,7 +308,7 @@ FcFontSet* FontCfgWrapper::getFontSet() m_pFontSet = FcFontSetCreate(); bool bRestrictFontSetToApplicationFonts = false; #if HAVE_MORE_FONTS - bRestrictFontSetToApplicationFonts = getenv("SAL_ABORT_ON_NON_APPLICATION_FONT_USE") != nullptr; + bRestrictFontSetToApplicationFonts = getenv("SAL_NON_APPLICATION_FONT_USE") != nullptr; #endif if (!bRestrictFontSetToApplicationFonts) addFontSet( FcSetSystem ); @@ -1172,7 +1172,10 @@ void PrintFontManager::Substitute(vcl::font::FontSelectPattern &rPattern, OUStri << rPattern.maTargetName << "' with '" << rPattern.maSearchName << "'"); - static bool bAbortOnFontSubstitute = getenv("SAL_ABORT_ON_NON_APPLICATION_FONT_USE") != nullptr; + static const bool bAbortOnFontSubstitute = [] { + const char* pEnv = getenv("SAL_NON_APPLICATION_FONT_USE"); + return pEnv && strcmp(pEnv, "abort") == 0; + }(); if (bAbortOnFontSubstitute && rPattern.maTargetName != rPattern.maSearchName) { if (bMissingJustBullet) |