summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-05-04 06:28:49 +0200
committerLuboš Luňák <l.lunak@collabora.com>2022-05-04 08:43:00 +0200
commit3d0d3ae9e08b701c0762a751a431ed2b1f5010c7 (patch)
tree10847fb883c9033b823b9e335360ec7d01bb1b7d
parent51c986230316643e42a3deff7e802a8455fd0459 (diff)
don't lay out entire strings for Writer layout tests
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 <l.lunak@collabora.com>
-rw-r--r--vcl/source/gdi/impglyphitem.cxx11
1 files changed, 10 insertions, 1 deletions
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<const OutputDevice> 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<const OutputDevice> 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<SalLayout> layout