diff options
-rw-r--r-- | vcl/CppunitTest_vcl_cjk.mk | 71 | ||||
-rw-r--r-- | vcl/Module_vcl.mk | 1 | ||||
-rw-r--r-- | vcl/qa/cppunit/cjktext.cxx | 248 | ||||
-rw-r--r-- | vcl/qa/cppunit/text.cxx | 166 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/fontconfig.cxx | 5 |
5 files changed, 325 insertions, 166 deletions
diff --git a/vcl/CppunitTest_vcl_cjk.mk b/vcl/CppunitTest_vcl_cjk.mk new file mode 100644 index 000000000000..8da3e5da4019 --- /dev/null +++ b/vcl/CppunitTest_vcl_cjk.mk @@ -0,0 +1,71 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_CppunitTest_CppunitTest,vcl_cjk)) + +$(eval $(call gb_CppunitTest_set_include,vcl_cjk,\ + $$(INCLUDE) \ + -I$(SRCDIR)/vcl/inc \ +)) + +$(eval $(call gb_CppunitTest_add_exception_objects,vcl_cjk, \ + vcl/qa/cppunit/cjktext \ +)) + +$(eval $(call gb_CppunitTest_use_externals,vcl_cjk,\ + boost_headers \ + harfbuzz \ +)) + +ifeq ($(SYSTEM_ICU),TRUE) +$(eval $(call gb_CppunitTest_use_externals,vcl_cjk,\ + icuuc \ +)) +else +$(eval $(call gb_CppunitTest_use_externals,vcl_cjk,\ + icu_headers \ +)) +endif + +$(eval $(call gb_CppunitTest_use_libraries,vcl_cjk, \ + comphelper \ + cppu \ + cppuhelper \ + i18nlangtag \ + sal \ + svt \ + test \ + tl \ + unotest \ + vcl \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,vcl_cjk)) + +$(eval $(call gb_CppunitTest_use_ure,vcl_cjk)) +$(eval $(call gb_CppunitTest_use_vcl,vcl_cjk)) + +$(eval $(call gb_CppunitTest_use_components,vcl_cjk,\ + configmgr/source/configmgr \ + i18npool/util/i18npool \ + ucb/source/core/ucb1 \ +)) + +$(eval $(call gb_CppunitTest_use_configuration,vcl_cjk)) + +$(eval $(call gb_CppunitTest_use_more_fonts,vcl_cjk)) + +# we don't have any bundled cjk fonts, so allow use of +# system fonts for the cjk tests, tests have to survive +# unavailable fonts +$(call gb_CppunitTest_get_target,vcl_cjk): \ + EXTRA_ENV_VARS := \ + SAL_NON_APPLICATION_FONT_USE=allow + +# vim: set noet sw=4 ts=4: diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 0e8e3c0e7b43..81f28dcfdd68 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -198,6 +198,7 @@ $(eval $(call gb_Module_add_check_targets,vcl,\ CppunitTest_vcl_lifecycle \ CppunitTest_vcl_bitmap_test \ CppunitTest_vcl_bitmapprocessor_test \ + CppunitTest_vcl_cjk \ CppunitTest_vcl_graphic_test \ CppunitTest_vcl_fontcharmap \ CppunitTest_vcl_font \ diff --git a/vcl/qa/cppunit/cjktext.cxx b/vcl/qa/cppunit/cjktext.cxx new file mode 100644 index 000000000000..4ad8a23ab7d2 --- /dev/null +++ b/vcl/qa/cppunit/cjktext.cxx @@ -0,0 +1,248 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <osl/file.hxx> +#include <osl/process.h> +#include <test/bootstrapfixture.hxx> +#include <sal/log.hxx> +#include <tools/stream.hxx> + +#include <vcl/BitmapReadAccess.hxx> +#include <vcl/errcode.hxx> +#include <vcl/graphicfilter.hxx> +#include <vcl/settings.hxx> +#include <vcl/svapp.hxx> +#include <vcl/virdev.hxx> + +#include <ImplLayoutArgs.hxx> +#include <TextLayoutCache.hxx> +#include <salgdi.hxx> + +class VclCjkTextTest : public test::BootstrapFixture +{ + // if enabled - check the result images with: + // "xdg-open ./workdir/CppunitTest/vcl_cjk_test.test.core/" + static constexpr const bool mbExportBitmap = false; + + void exportDevice(const OUString& filename, const VclPtr<VirtualDevice>& device) + { + if (mbExportBitmap) + { + BitmapEx aBitmapEx(device->GetBitmapEx(Point(0, 0), device->GetOutputSizePixel())); + OUString cwd; + CPPUNIT_ASSERT_EQUAL(osl_Process_E_None, osl_getProcessWorkingDir(&cwd.pData)); + OUString url; + CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, + osl::FileBase::getAbsoluteFileURL(cwd, filename, url)); + SvFileStream aStream(url, StreamMode::WRITE | StreamMode::TRUNC); + CPPUNIT_ASSERT_EQUAL( + ERRCODE_NONE, GraphicFilter::GetGraphicFilter().compressAsPNG(aBitmapEx, aStream)); + } + } + + void testVerticalText(); + +public: + VclCjkTextTest() + : BootstrapFixture(true, false) + { + } + + CPPUNIT_TEST_SUITE(VclCjkTextTest); + CPPUNIT_TEST(testVerticalText); + CPPUNIT_TEST_SUITE_END(); +}; + +// Similar to getCharacterBaseWidth but this time from the top, for U+30E8 (it's straight at the top, not at the bottom). +static tools::Long getCharacterTopWidth(VirtualDevice* device, const Point& start) +{ + Bitmap bitmap = device->GetBitmap(Point(), device->GetOutputSizePixel()); + Bitmap::ScopedReadAccess access(bitmap); + tools::Long y = start.Y(); + while (y < bitmap.GetSizePixel().Height() && access->GetColor(y, start.X()) != COL_BLACK) + ++y; + if (y >= bitmap.GetSizePixel().Height()) + return -1; + tools::Long xmin = start.X(); + while (xmin >= 0 && access->GetColor(y, xmin) != COL_WHITE) + --xmin; + tools::Long xmax = start.X(); + while (xmax < bitmap.GetSizePixel().Width() && access->GetColor(y, xmax) != COL_WHITE) + ++xmax; + return xmax - xmin + 1; +} + +// The same, but from the right side, for U+30E8 (it's straight on the right side, not the left one). +static tools::Long getCharacterRightSideHeight(VirtualDevice* device, const Point& start) +{ + Bitmap bitmap = device->GetBitmap(Point(), device->GetOutputSizePixel()); + Bitmap::ScopedReadAccess access(bitmap); + tools::Long x = start.X(); + while (x >= 0 && access->GetColor(start.Y(), x) != COL_BLACK) + --x; + if (x < 0) + return -1; + tools::Long ymin = start.Y(); + while (ymin >= 0 && access->GetColor(ymin, x) != COL_WHITE) + --ymin; + tools::Long ymax = start.Y(); + while (ymax < bitmap.GetSizePixel().Width() && access->GetColor(ymax, x) != COL_WHITE) + ++ymax; + return ymax - ymin + 1; +} + +// Like testSimpleText() but for a vertical character, here namely U+30E8 (katakana letter yo), +// chosen because it's a fairly simple shape (looks like horizontally mirrored E) that should +// have the right and top lines being straight. Well, and also chosen because I actually +// do not have much clue about CJK. +// IMPORTANT: If you modify this, modify also the void VclTextTest::testSimpleText(). +void VclCjkTextTest::testVerticalText() +{ + OUString text(u"\x30e8"); + ScopedVclPtr<VirtualDevice> device = VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT); + device->SetOutputSizePixel(Size(100, 100)); + device->SetBackground(Wallpaper(COL_WHITE)); + // Disable AA, to make all pixels be black or white. + device->SetAntialiasing(AntialiasingFlags::DisableText); + + // Bail out on all backends that do not work (or I didn't test). Opt-out rather than opt-in + // to make sure new backends fail initially. + if (device->GetGraphics()->getRenderBackendName() == "qt5" + || device->GetGraphics()->getRenderBackendName() == "qt5svp" + || device->GetGraphics()->getRenderBackendName() == "gtk3svp" + || device->GetGraphics()->getRenderBackendName() == "aqua" + || device->GetGraphics()->getRenderBackendName() == "gen" +#ifdef MACOSX // vertical fonts are broken on Mac with or without Skia + || device->GetGraphics()->getRenderBackendName() == "skia" +#endif + || device->GetGraphics()->getRenderBackendName() == "genpsp") + return; + + // We do not ship any CJK fonts, so try to find a common one that is usable for the test. + vcl::Font baseFont; + vcl::Font font; + bool fontFound = false; + for (const char* ptrfontName : + { "Droid Sans Japanese", "Baekmuk Gulim", "Microsoft JhengHei", "Microsoft YaHei", + "MS PGothic", "Hiragino Sans", "Arial Unicode MS" }) + { + OUString fontName = OUString::fromUtf8(ptrfontName); + if (!device->IsFontAvailable(fontName)) + continue; + baseFont = vcl::Font(fontName, "Book", Size(0, 36)); + baseFont.SetLanguage(LANGUAGE_JAPANESE); + baseFont.SetVertical(true); + baseFont.SetOrientation(2700_deg10); + if (device->HasGlyphs(baseFont, text) == -1) // -1 means no glyph is missing + { + fontFound = true; + break; + } + } + if (!fontFound) + { + SAL_WARN("vcl", + "Could not find a font for VclCjkTextTest::testVerticalText, skipping test."); + return; + } + + font = baseFont; + font.SetFontSize(Size(0, 36)); + device->Erase(); + device->SetFont(font); + device->DrawText(Point(90, 10), text); + exportDevice("vertical-text-36.png", device); + // Height of U+30E8 with font 36 size should be roughly 28 pixels, + // but since we don't know which font will be used, allow even more range. + tools::Long height36 = getCharacterRightSideHeight(device, Point(99, 22)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(28), height36, 6); + tools::Long width36 = getCharacterTopWidth(device, Point(65, 0)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(25), width36, 6); + + // Horizontal writing of vertical glyphs. For some reason in this case + // the font is not set to be vertical. + font.SetOrientation(0_deg10); + font.SetVertical(false); + device->Erase(); + device->SetFont(font); + device->DrawText(Point(10, 10), text); + exportDevice("vertical-text-36-0deg.png", device); + // Here width and height should be the same, since the glyphs actually + // not rotated compared to the vertical writing. + tools::Long height36Rotated = getCharacterRightSideHeight(device, Point(99, 35)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(height36, height36Rotated, 1); + tools::Long width36Rotated = getCharacterTopWidth(device, Point(25, 0)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(width36, width36Rotated, 1); + + font = baseFont; + font.SetFontSize(Size(0, 72)); + device->Erase(); + device->SetFont(font); + device->DrawText(Point(90, 10), text); + exportDevice("vertical-text-72.png", device); + // Font size is doubled, so pixel sizes should also roughly double. + tools::Long height72 = getCharacterRightSideHeight(device, Point(99, 35)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(height36 * 2, height72, 4); + tools::Long width72 = getCharacterTopWidth(device, Point(40, 0)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(width36 * 2, width72, 4); + + font.SetOrientation(0_deg10); + font.SetVertical(false); + device->Erase(); + device->SetFont(font); + device->DrawText(Point(10, 10), text); + exportDevice("vertical-text-72-0deg.png", device); + tools::Long height72Rotated = getCharacterRightSideHeight(device, Point(99, 60)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(height72, height72Rotated, 1); + tools::Long width72Rotated = getCharacterTopWidth(device, Point(45, 0)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(width72, width72Rotated, 1); + + // On Windows scaling of vertical glyphs is broken. + if (device->GetGraphics()->getRenderBackendName() == "gdi") + return; + + // Test width scaled to 200%. + font = baseFont; + font.SetFontSize(Size(72, 36)); +#ifdef _WIN32 + // TODO: What is the proper way to draw 200%-wide text? This is needed on Windows + // but it breaks Linux. + font.SetAverageFontWidth(2 * font.GetOrCalculateAverageFontWidth()); +#endif + device->Erase(); + device->SetFont(font); + device->DrawText(Point(90, 10), text); + // Double "width" with vertical text makes the height doubled. + exportDevice("vertical-text-36-200pct.png", device); + tools::Long height36pct200 = getCharacterRightSideHeight(device, Point(99, 35)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(height36 * 2, height36pct200, 4); + tools::Long width36pct200 = getCharacterTopWidth(device, Point(65, 0)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(width36, width36pct200, 2); + + // Test width scaled to 50%. + font = baseFont; + font.SetFontSize(Size(18, 36)); +#ifdef _WIN32 + font.SetAverageFontWidth(0.5 * font.GetOrCalculateAverageFontWidth()); +#endif + device->Erase(); + device->SetFont(font); + device->DrawText(Point(90, 10), text); + exportDevice("vertical-text-36-50pct.png", device); + tools::Long height36pct50 = getCharacterRightSideHeight(device, Point(99, 16)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(height36 / 2, height36pct50, 2); + tools::Long width36pct50 = getCharacterTopWidth(device, Point(65, 0)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(width36, width36pct50, 2); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(VclCjkTextTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx index 7a73ee3bc6e2..379940a9867b 100644 --- a/vcl/qa/cppunit/text.cxx +++ b/vcl/qa/cppunit/text.cxx @@ -53,7 +53,6 @@ public: } void testSimpleText(); - void testVerticalText(); void testTextLayoutCache(); void testImplLayoutRuns_AddPos(); void testImplLayoutRuns_AddRuns(); @@ -66,7 +65,6 @@ public: CPPUNIT_TEST_SUITE(VclTextTest); CPPUNIT_TEST(testSimpleText); - CPPUNIT_TEST(testVerticalText); CPPUNIT_TEST(testTextLayoutCache); CPPUNIT_TEST(testImplLayoutRuns_AddPos); CPPUNIT_TEST(testImplLayoutRuns_AddRuns); @@ -142,28 +140,9 @@ static tools::Long getCharacterLeftSideHeight(VirtualDevice* device, const Point return ymax - ymin + 1; } -// The same, but from the right side, for U+30E8 (it's straight on the right side, not the left one). -static tools::Long getCharacterRightSideHeight(VirtualDevice* device, const Point& start) -{ - Bitmap bitmap = device->GetBitmap(Point(), device->GetOutputSizePixel()); - Bitmap::ScopedReadAccess access(bitmap); - tools::Long x = start.X(); - while (x >= 0 && access->GetColor(start.Y(), x) != COL_BLACK) - --x; - if (x < 0) - return -1; - tools::Long ymin = start.Y(); - while (ymin >= 0 && access->GetColor(ymin, x) != COL_WHITE) - --ymin; - tools::Long ymax = start.Y(); - while (ymax < bitmap.GetSizePixel().Width() && access->GetColor(ymax, x) != COL_WHITE) - ++ymax; - return ymax - ymin + 1; -} - // Test rendering of the 'L' character (chosen because L is a simple shape). // Check things like using a double font size doubling the size of the character, correct rotation, etc. -// IMPORTANT: If you modify this, check also the testVerticalText(). +// IMPORTANT: If you modify this, check also the VclCjkTextTest::testVerticalText(). void VclTextTest::testSimpleText() { OUString text("L"); @@ -262,149 +241,6 @@ void VclTextTest::testSimpleText() CPPUNIT_ASSERT_DOUBLES_EQUAL(width36 / 2, width36pct50, 2); } -// Like testSimpleText() but for a vertical character, here namely U+30E8 (katakana letter yo), -// chosen because it's a fairly simple shape (looks like horizontally mirrored E) that should -// have the right and top lines being straight. Well, and also chosen because I actually -// do not have much clue about CJK. -// IMPORTANT: If you modify this, modify also the testSimpleText(). -void VclTextTest::testVerticalText() -{ - OUString text(u"\x30e8"); - ScopedVclPtr<VirtualDevice> device = VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT); - device->SetOutputSizePixel(Size(100, 100)); - device->SetBackground(Wallpaper(COL_WHITE)); - // Disable AA, to make all pixels be black or white. - device->SetAntialiasing(AntialiasingFlags::DisableText); - - // Bail out on all backends that do not work (or I didn't test). Opt-out rather than opt-in - // to make sure new backends fail initially. - if (device->GetGraphics()->getRenderBackendName() == "qt5" - || device->GetGraphics()->getRenderBackendName() == "qt5svp" - || device->GetGraphics()->getRenderBackendName() == "gtk3svp" - || device->GetGraphics()->getRenderBackendName() == "aqua" - || device->GetGraphics()->getRenderBackendName() == "gen" -#ifdef MACOSX // vertical fonts are broken on Mac with or without Skia - || device->GetGraphics()->getRenderBackendName() == "skia" -#endif - || device->GetGraphics()->getRenderBackendName() == "genpsp") - return; - - // We do not ship any CJK fonts, so try to find a common one that is usable for the test. - vcl::Font baseFont; - vcl::Font font; - bool fontFound = false; - for (const char* ptrfontName : - { "Droid Sans Japanese", "Baekmuk Gulim", "Microsoft JhengHei", "Microsoft YaHei", - "MS PGothic", "Hiragino Sans", "Arial Unicode MS" }) - { - OUString fontName = OUString::fromUtf8(ptrfontName); - if (!device->IsFontAvailable(fontName)) - continue; - baseFont = vcl::Font(fontName, "Book", Size(0, 36)); - baseFont.SetLanguage(LANGUAGE_JAPANESE); - baseFont.SetVertical(true); - baseFont.SetOrientation(2700_deg10); - if (device->HasGlyphs(baseFont, text) == -1) // -1 means no glyph is missing - { - fontFound = true; - break; - } - } - if (!fontFound) - { - SAL_WARN("vcl", "Could not find a font for VclTextTest::testVerticalText, skipping test."); - return; - } - - font = baseFont; - font.SetFontSize(Size(0, 36)); - device->Erase(); - device->SetFont(font); - device->DrawText(Point(90, 10), text); - exportDevice("vertical-text-36.png", device); - // Height of U+30E8 with font 36 size should be roughly 28 pixels, - // but since we don't know which font will be used, allow even more range. - tools::Long height36 = getCharacterRightSideHeight(device, Point(99, 22)); - CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(28), height36, 6); - tools::Long width36 = getCharacterTopWidth(device, Point(65, 0)); - CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(25), width36, 6); - - // Horizontal writing of vertical glyphs. For some reason in this case - // the font is not set to be vertical. - font.SetOrientation(0_deg10); - font.SetVertical(false); - device->Erase(); - device->SetFont(font); - device->DrawText(Point(10, 10), text); - exportDevice("vertical-text-36-0deg.png", device); - // Here width and height should be the same, since the glyphs actually - // not rotated compared to the vertical writing. - tools::Long height36Rotated = getCharacterRightSideHeight(device, Point(99, 35)); - CPPUNIT_ASSERT_DOUBLES_EQUAL(height36, height36Rotated, 1); - tools::Long width36Rotated = getCharacterTopWidth(device, Point(25, 0)); - CPPUNIT_ASSERT_DOUBLES_EQUAL(width36, width36Rotated, 1); - - font = baseFont; - font.SetFontSize(Size(0, 72)); - device->Erase(); - device->SetFont(font); - device->DrawText(Point(90, 10), text); - exportDevice("vertical-text-72.png", device); - // Font size is doubled, so pixel sizes should also roughly double. - tools::Long height72 = getCharacterRightSideHeight(device, Point(99, 35)); - CPPUNIT_ASSERT_DOUBLES_EQUAL(height36 * 2, height72, 4); - tools::Long width72 = getCharacterTopWidth(device, Point(40, 0)); - CPPUNIT_ASSERT_DOUBLES_EQUAL(width36 * 2, width72, 4); - - font.SetOrientation(0_deg10); - font.SetVertical(false); - device->Erase(); - device->SetFont(font); - device->DrawText(Point(10, 10), text); - exportDevice("vertical-text-72-0deg.png", device); - tools::Long height72Rotated = getCharacterRightSideHeight(device, Point(99, 60)); - CPPUNIT_ASSERT_DOUBLES_EQUAL(height72, height72Rotated, 1); - tools::Long width72Rotated = getCharacterTopWidth(device, Point(45, 0)); - CPPUNIT_ASSERT_DOUBLES_EQUAL(width72, width72Rotated, 1); - - // On Windows scaling of vertical glyphs is broken. - if (device->GetGraphics()->getRenderBackendName() == "gdi") - return; - - // Test width scaled to 200%. - font = baseFont; - font.SetFontSize(Size(72, 36)); -#ifdef _WIN32 - // TODO: What is the proper way to draw 200%-wide text? This is needed on Windows - // but it breaks Linux. - font.SetAverageFontWidth(2 * font.GetOrCalculateAverageFontWidth()); -#endif - device->Erase(); - device->SetFont(font); - device->DrawText(Point(90, 10), text); - // Double "width" with vertical text makes the height doubled. - exportDevice("vertical-text-36-200pct.png", device); - tools::Long height36pct200 = getCharacterRightSideHeight(device, Point(99, 35)); - CPPUNIT_ASSERT_DOUBLES_EQUAL(height36 * 2, height36pct200, 4); - tools::Long width36pct200 = getCharacterTopWidth(device, Point(65, 0)); - CPPUNIT_ASSERT_DOUBLES_EQUAL(width36, width36pct200, 2); - - // Test width scaled to 50%. - font = baseFont; - font.SetFontSize(Size(18, 36)); -#ifdef _WIN32 - font.SetAverageFontWidth(0.5 * font.GetOrCalculateAverageFontWidth()); -#endif - device->Erase(); - device->SetFont(font); - device->DrawText(Point(90, 10), text); - exportDevice("vertical-text-36-50pct.png", device); - tools::Long height36pct50 = getCharacterRightSideHeight(device, Point(99, 16)); - CPPUNIT_ASSERT_DOUBLES_EQUAL(height36 / 2, height36pct50, 2); - tools::Long width36pct50 = getCharacterTopWidth(device, Point(65, 0)); - CPPUNIT_ASSERT_DOUBLES_EQUAL(width36, width36pct50, 2); -} - void VclTextTest::testTextLayoutCache() { OUString sTestString = u"The quick brown fox\n jumped over the lazy dogالعاشر"; diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index e4eca6f34d93..712256131cd2 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -308,7 +308,10 @@ FcFontSet* FontCfgWrapper::getFontSet() m_pFontSet = FcFontSetCreate(); bool bRestrictFontSetToApplicationFonts = false; #if HAVE_MORE_FONTS - bRestrictFontSetToApplicationFonts = getenv("SAL_NON_APPLICATION_FONT_USE") != nullptr; + bRestrictFontSetToApplicationFonts = [] { + const char* pEnv = getenv("SAL_NON_APPLICATION_FONT_USE"); + return pEnv && strcmp(pEnv, "allow") != 0; + }(); #endif if (!bRestrictFontSetToApplicationFonts) addFontSet( FcSetSystem ); |