Related: tdf#124109 sw: save one vcl layout call in SwFntObj::DrawText()
Commit 436b829f5b904d76039db0818cff5dedf1ae89f1 (sw: save one vcl layout
call in SwFntObj::DrawText(), 2018-08-16) did this unconditionally,
which broke kashida justification. Re-introduce the same mechanism, but
this time opt out in the kashida case to keep that working.
This means that for Latin scripts we are back to 2 layout calls (instead
of 3) for each keypress in Writer.
Change-Id: I890f0ab04d1f5dce561f1536d7c8a6d67a639813
Reviewed-on: https://gerrit.libreoffice.org/69557
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 0788953..e749bc2 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1492,6 +1492,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
long nSpaceAdd = rInf.GetSpace() / SPACING_PRECISION_FACTOR;
bool bNoHalfSpace = false;
bool bCacheLayout = true;
if ( rInf.GetFont() && rInf.GetLen() )
{
@@ -1534,7 +1535,12 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
if ( pSI && pSI->CountKashida() &&
pSI->KashidaJustify( pKernArray.get(), pScrArray.get(), rInf.GetIdx(),
rInf.GetLen(), nSpaceAdd ) != -1 )
{
nSpaceAdd = 0;
// Layout can't be reused in this case, it would lead to missing gaps in
// place of kashida.
bCacheLayout = false;
}
else
bNoHalfSpace = true;
}
@@ -1815,8 +1821,12 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
? (rInf.GetIdx() ? 1 : 0)
: sal_Int32(rInf.GetIdx());
aGlyphsKey = SwTextGlyphsKey{ &rInf.GetOut(), *pStr, nTmpIdx, nLen };
if (bCacheLayout)
pGlyphs = lcl_CreateLayout(aGlyphsKey, m_aTextGlyphs[aGlyphsKey]);
else
pGlyphs = nullptr;
rInf.GetOut().DrawTextArray( aTextOriginPos, *pStr, pKernArray.get(),
nTmpIdx , nLen );
nTmpIdx , nLen, SalLayoutFlags::NONE, pGlyphs );
if (bBullet)
{
rInf.GetOut().Push();