diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-03-22 17:57:46 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-03-22 18:45:43 +0100 |
commit | 8308d6a38ff283a2feebf84a95198159887cd685 (patch) | |
tree | fc47906c9c11e9bc0ad9f7e677820074ff48a7c2 /vcl/qa/cppunit/complextext.cxx | |
parent | a05a55ddcfcb6ae18dad9ca5c5fb5ee0ab926b01 (diff) |
Related: tdf#124109 vcl: make glyph item caching work with kashida glyphs
This was broken because GenericSalLayout::LayoutText() sets the
SalLayoutFlags::KashidaJustification flag as a side-effect of building
the glyph list. So in case we cache the list and not build it, the flag
will be missing. This means that later in
GenericSalLayout::ApplyDXArray() kashida glyphs won't be inserted.
With this, the workaround in sw can be removed.
Change-Id: Ic18211bf50ca673daa238e8950a381915e4b3096
Reviewed-on: https://gerrit.libreoffice.org/69566
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'vcl/qa/cppunit/complextext.cxx')
-rw-r--r-- | vcl/qa/cppunit/complextext.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx index 96332585673b..99b05481ed01 100644 --- a/vcl/qa/cppunit/complextext.cxx +++ b/vcl/qa/cppunit/complextext.cxx @@ -19,8 +19,10 @@ static std::ostream& operator<<(std::ostream& rStream, const std::vector<long>& #include <test/bootstrapfixture.hxx> #include <vcl/wrkwin.hxx> +#include <vcl/virdev.hxx> // workaround MSVC2015 issue with std::unique_ptr #include <sallayout.hxx> +#include <salgdi.hxx> #include <osl/file.hxx> #include <osl/process.h> @@ -45,6 +47,7 @@ public: #if HAVE_MORE_FONTS /// Play with font measuring etc. void testArabic(); + void testKashida(); #endif #if defined(_WIN32) void testTdf95650(); // Windows-only issue @@ -53,6 +56,7 @@ public: CPPUNIT_TEST_SUITE(VclComplexTextTest); #if HAVE_MORE_FONTS CPPUNIT_TEST(testArabic); + CPPUNIT_TEST(testKashida); #endif #if defined(_WIN32) CPPUNIT_TEST(testTdf95650); @@ -136,6 +140,29 @@ void VclComplexTextTest::testArabic() (void)aRect; (void)aRectRot; #endif } + +void VclComplexTextTest::testKashida() +{ + // Cache the glyph list of some Arabic text. + ScopedVclPtrInstance<VirtualDevice> pOutputDevice; + auto aText + = OUString::fromUtf8(u8"ﻊﻨﺻﺭ ﺎﻠﻓﻮﺴﻓﻭﺭ ﻊﻨﺻﺭ ﻒﻟﺰﻳ ﺺﻠﺑ. ﺖﺘﻛﻮﻧ ﺎﻟﺩﻭﺭﺓ ﺎﻟﺭﺎﺒﻋﺓ ﻢﻧ ١٥ ﻊﻨﺻﺭﺍ."); + std::unique_ptr<SalLayout> pLayout = pOutputDevice->ImplLayout( + aText, 0, aText.getLength(), Point(0, 0), 0, nullptr, SalLayoutFlags::GlyphItemsOnly); + const SalLayoutGlyphs* pGlyphs = pLayout->GetGlyphs(); + CPPUNIT_ASSERT(pGlyphs); + SalLayoutGlyphs aGlyphs = *pGlyphs; + + // Now lay it out using the cached glyph list. + ImplLayoutArgs aLayoutArgs(aText, 0, aText.getLength(), SalLayoutFlags::NONE, + pOutputDevice->GetFont().GetLanguageTag(), nullptr); + pLayout = pOutputDevice->GetGraphics()->GetTextLayout(0); + CPPUNIT_ASSERT(pLayout->LayoutText(aLayoutArgs, &aGlyphs)); + + // Without the accompanying fix in place, this test would have failed with 'assertion failed'. + // The kashida justification flag was lost when going via the glyph cache. + CPPUNIT_ASSERT(aLayoutArgs.mnFlags & SalLayoutFlags::KashidaJustification); +} #endif #if defined(_WIN32) |