summaryrefslogtreecommitdiff
path: root/vcl/source/gdi
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2021-06-14 10:20:42 +0800
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-24 17:25:24 +0200
commitf5e565eb0dcee2d7e42180b1fd0ad12555de2a22 (patch)
tree4d55702af219f8a5804f56c69c4a4173e8c42624 /vcl/source/gdi
parent14af6ffe303090eecd2b42b09da42e5a748cbb9d (diff)
tdf#142560 handle cached glpyh items in ImplGlyphFallbackLayout
Fallback layout beyond level1 isn't generated because pre-caculated glyph items does not contain glyph items that needs to fallback, i.e. when calling ImplLayoutArgs::PrepareFallback. Hence it produce no maFallbackRuns and maRuns. The patch changes ImplLayoutArgs::PrepareFallback so that it use pre-caculated glyph items in the next level to create maRuns to ensure the same fallback layouts are genrated as layouts generated without pre-caculated glyph items. Change-Id: I672f3be6c4915892792b3cb968ad4a325465ccc0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117105 Tested-by: Jenkins Reviewed-by: Mark Hung <marklh9@gmail.com> (cherry picked from commit 10ea27faec115d4cffd6f66cee8f688399e1e0b2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117570 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r--vcl/source/gdi/sallayout.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 9f4757148b36..7b8f2c2a2a05 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -486,8 +486,23 @@ void ImplLayoutArgs::AddRun( int nCharPos0, int nCharPos1, bool bRTL )
maRuns.AddRun( nCharPos0, nCharPos1, bRTL );
}
-bool ImplLayoutArgs::PrepareFallback()
+bool ImplLayoutArgs::PrepareFallback(const SalLayoutGlyphsImpl* pGlyphsImpl)
{
+ // Generate runs with pre-calculated glyph items instead maFallbackRuns.
+ if( pGlyphsImpl != nullptr )
+ {
+ maRuns.Clear();
+ maFallbackRuns.Clear();
+
+ for (auto const& aGlyphItem : *pGlyphsImpl)
+ {
+ for(int i = aGlyphItem.charPos(); i < aGlyphItem.charPos() + aGlyphItem.charCount(); ++i)
+ maRuns.AddPos(i, aGlyphItem.IsRTLGlyph());
+ }
+
+ return !maRuns.IsEmpty();
+ }
+
// short circuit if no fallback is needed
if( maFallbackRuns.IsEmpty() )
{