From 3d0d3ae9e08b701c0762a751a431ed2b1f5010c7 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Wed, 4 May 2022 06:28:49 +0200 Subject: don't lay out entire strings for Writer layout tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SalLayoutGlyphsCache optimization of laying out an entire string if it looks like a caller will call it repeatedly for parts of the string conflicts with the SAL_ABORT_ON_NON_APPLICATION_FONT_USE checks causing PrintFontManager::Substitute() abort if font fallback happens. Simply disable the optimization, the output should be the same. Change-Id: I0cce6a0c2a1a2ce93b95df54d18fedbdc779f34f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133789 Tested-by: Jenkins Reviewed-by: Luboš Luňák --- vcl/source/gdi/impglyphitem.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx index 23a2b2a96fc9..ed7e2895310e 100644 --- a/vcl/source/gdi/impglyphitem.cxx +++ b/vcl/source/gdi/impglyphitem.cxx @@ -322,6 +322,14 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, c // and then return subsets of them. So if the first call is for a prefix of the string, // remember that, and if the next call follows the previous part of the string, // cache the entire string. + // Writer layouts tests enable SAL_ABORT_ON_NON_APPLICATION_FONT_USE 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; if (nIndex == 0) { mLastPrefixKey = key; @@ -330,7 +338,8 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, c else if (mLastPrefixKey.has_value() && mLastPrefixKey->len == nIndex && mLastPrefixKey == CachedGlyphsKey(outputDevice, text, mLastPrefixKey->index, - mLastPrefixKey->len, nLogicWidth)) + mLastPrefixKey->len, nLogicWidth) + && !bAbortOnFontSubstitute) { assert(mLastPrefixKey->index == 0); std::unique_ptr layout -- cgit