summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-04-27 17:26:46 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-05-01 15:43:31 +0200
commit172270a8f04388a8f8062f672f9c3f3144a01a1f (patch)
treed791e213a56098f72af6e2fc343536a923f687b3 /vcl
parentcd9602dcc51a7ce54fadf9796642ee9d7fcf3cfe (diff)
abort writer layout tests if a font isn't found
if (the default) of --with-fonts is enabled then additionally restrict fontconfig to those "application" fonts so the linux ci can be used to safeguard that font and glyph fallback isn't in operation during the layout tests Change-Id: Ic7fc705827c8177b8367cf41f55cdd8ae002c1f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133523 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/generic/fontmanager/fontconfig.cxx29
1 files changed, 28 insertions, 1 deletions
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 4546de18162a..c8852639c7b5 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -45,6 +45,7 @@
#include <unicode/uscript.h>
#include <officecfg/Office/Common.hxx>
#include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp>
+#include <config_fonts.h>
using namespace psp;
@@ -305,7 +306,12 @@ FcFontSet* FontCfgWrapper::getFontSet()
if( !m_pFontSet )
{
m_pFontSet = FcFontSetCreate();
- addFontSet( FcSetSystem );
+ bool bRestrictFontSetToApplicationFonts = false;
+#if HAVE_MORE_FONTS
+ bRestrictFontSetToApplicationFonts = getenv("SAL_ABORT_ON_NON_APPLICATION_FONT_USE") != nullptr;
+#endif
+ if (!bRestrictFontSetToApplicationFonts)
+ addFontSet( FcSetSystem );
addFontSet( FcSetApplication );
std::stable_sort(m_pFontSet->fonts,m_pFontSet->fonts+m_pFontSet->nfont,SortFont());
@@ -989,10 +995,13 @@ void PrintFontManager::Substitute(vcl::font::FontSelectPattern &rPattern, OUStri
LanguageTag aLangTag(rPattern.meLanguage);
OString aLangAttrib = mapToFontConfigLangTag(aLangTag);
+ bool bMissingJustBullet = false;
+
// Add required Unicode characters, if any
if ( !rMissingCodes.isEmpty() )
{
FcCharSet *codePoints = FcCharSetCreate();
+ bMissingJustBullet = rMissingCodes.getLength() == 1 && rMissingCodes[0] == 0xb7;
for( sal_Int32 nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); )
{
// also handle unicode surrogates
@@ -1162,6 +1171,24 @@ void PrintFontManager::Substitute(vcl::font::FontSelectPattern &rPattern, OUStri
SAL_INFO("vcl.fonts", "PrintFontManager::Substitute: replacing missing font: '"
<< rPattern.maTargetName << "' with '" << rPattern.maSearchName
<< "'");
+
+ static bool bAbortOnFontSubstitute = getenv("SAL_ABORT_ON_NON_APPLICATION_FONT_USE") != nullptr;
+ if (bAbortOnFontSubstitute && rPattern.maTargetName != rPattern.maSearchName)
+ {
+ SAL_INFO("vcl.fonts", "PrintFontManager::Substitute: missing font: '" << rPattern.maTargetName <<
+ "' try: " << rPattern.maSearchName << " instead");
+ if (bMissingJustBullet)
+ {
+ assert(rPattern.maTargetName == "Amiri Quran" || rPattern.maTargetName == "David CLM" ||
+ rPattern.maTargetName == "EmojiOne Color" || rPattern.maTargetName == "Frank Ruehl CLM" ||
+ rPattern.maTargetName == "KacstBook" || rPattern.maTargetName == "KacstOffice");
+ // These fonts exist in "more_fonts", but have no U+00B7 MIDDLE DOT
+ // so will always glyph fallback on measuring mnBulletOffset in
+ // ImplFontMetricData::ImplInitTextLineSize
+ return;
+ }
+ std::abort();
+ }
}
FontConfigFontOptions::~FontConfigFontOptions()