summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@aliftype.com>2023-04-01 23:34:59 +0200
committerAndras Timar <andras.timar@collabora.com>2023-04-03 00:53:20 +0200
commitfd5992493d6fdd8ca4392a8dd242bb96982ebce6 (patch)
tree09c876dca1fa0bb61bc4ded6dbc426b046e08fd3
parent39b5fa6dab4d941818310c0aed9b7dc96e317cc4 (diff)
tdf#154549: Make combining marks inherit the script of their base
... regardless of the script of the mark itself. Change-Id: I15a5d8cb2e1d7b7a26316689ffa11c278d1f6365 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149925 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com> (cherry picked from commit b320a33c01e4b87d42c2f3828a1dfd88c386df67) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149884 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--vcl/source/gdi/scrptrun.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/vcl/source/gdi/scrptrun.cxx b/vcl/source/gdi/scrptrun.cxx
index fbc68ca41bf1..19cb54772b30 100644
--- a/vcl/source/gdi/scrptrun.cxx
+++ b/vcl/source/gdi/scrptrun.cxx
@@ -41,6 +41,7 @@
#include <sal/config.h>
#include <rtl/character.hxx>
+#include <unicode/uchar.h>
#include <unicode/utypes.h>
#include <unicode/uscript.h>
@@ -119,14 +120,21 @@ struct PairIndices
};
-// There are three Unicode script codes for Japanese text, but only one
-// OpenType script tag, so we want to keep them in one run as splitting is
-// pointless for the purpose of OpenType shaping.
UScriptCode getScript(UChar32 ch, UErrorCode* status)
{
+ // tdf#154549
+ // Make combining marks inherit the script of their bases, regardless of
+ // their own script.
+ if (u_getIntPropertyValue(ch, UCHAR_GENERAL_CATEGORY) == U_NON_SPACING_MARK)
+ return USCRIPT_INHERITED;
+
UScriptCode script = uscript_getScript(ch, status);
if (U_FAILURE(*status))
return script;
+
+ // There are three Unicode script codes for Japanese text, but only one
+ // OpenType script tag, so we want to keep them in one run as splitting is
+ // pointless for the purpose of OpenType shaping.
if (script == USCRIPT_KATAKANA || script == USCRIPT_KATAKANA_OR_HIRAGANA)
return USCRIPT_HIRAGANA;
return script;