diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-03-22 13:51:39 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-03-22 15:03:07 +0100 |
commit | bb4fcc3d968367d682d6da057083378e9d171a22 (patch) | |
tree | 1bb0efe0fc817c13a7d55a41b78f65357edd0239 /sw | |
parent | d39732fc952f1c12631b891d76f2c5afd2923044 (diff) |
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
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/txtnode/fntcache.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 07889531a4ed..e749bc2bdac4 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(); |