summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@libreoffice.org>2023-07-05 17:12:19 +0300
committerخالد حسني <khaled@libreoffice.org>2023-07-05 23:21:24 +0200
commit5d2fa4ab6e75609c30351f0623dac63182be4c27 (patch)
treeae039ae6298679c0bc9de1033aa22fec796191e4 /slideshow
parentd378a44b4aa917d1f000f6ed2aa682009c544b6f (diff)
tdf#113290: Fix handling of grapheme clusters in slideshow animations
When doing animations by character cells (AKA grapheme clusters), we were taking the first character of the cluster only and lumping the rest with the next cluster, so a combining mark would appear at the start of the next sequence instead of the end of the current one. For surrogate pairs it was even more broken we were splitting in the middle of the pair resulting in invalid Unicode sequence. Change-Id: I9bbfe412e9b0a876b69e33c0916067bf75064122 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154066 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/shapes/drawshapesubsetting.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/slideshow/source/engine/shapes/drawshapesubsetting.cxx b/slideshow/source/engine/shapes/drawshapesubsetting.cxx
index 264f8f3316b2..13ea0300fa63 100644
--- a/slideshow/source/engine/shapes/drawshapesubsetting.cxx
+++ b/slideshow/source/engine/shapes/drawshapesubsetting.cxx
@@ -579,16 +579,24 @@ namespace slideshow::internal
aLastWordStart = aNext;
[[fallthrough]];
case DrawShapeSubsetting::CLASS_CHARACTER_CELL_END:
+ // tdf#113290
+ // This is a special case since a character cell
+ // (AKA grapheme cluster) can have multiple
+ // characters, so if we passed nCurrCharCount to
+ // io_rFunctor() it would stop at the first
+ // character in the cluster, so we subtract one
+ // so that it matches when we reach the start of
+ // the next cluster.
if( !io_rFunctor( DrawShapeSubsetting::CLASS_CHARACTER_CELL_END,
- nCurrCharCount,
+ nCurrCharCount - 1,
aLastCharStart,
- aNext ) )
+ aCurr ) )
{
return;
}
++nCurrCharCount;
- aLastCharStart = aNext;
+ aLastCharStart = aCurr;
break;
}