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>
This commit is contained in:
Khaled Hosny
2023-07-05 23:21:24 +02:00
committed by خالد حسني
parent d378a44b4a
commit 5d2fa4ab6e
@@ -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;
}