vcl/source/gdi/scrptrun.cxx |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 96aad0d0497c8486f8affc8fed79e63a060c9a59
Author:     Khaled Hosny <kha...@aliftype.com>
AuthorDate: Sat Apr 1 23:34:59 2023 +0200
Commit:     خالد حسني <kha...@aliftype.com>
CommitDate: Sun Apr 2 01:52:25 2023 +0200

    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: خالد حسني <kha...@aliftype.com>

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;

Reply via email to