[Libreoffice-commits] core.git: vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 20 18:21:15 UTC 2018


 vcl/source/gdi/scrptrun.cxx |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 476525277727fe1550ff77f0d9979604ac74d00f
Author:     Khaled Hosny <khaledhosny at eglug.org>
AuthorDate: Tue Nov 20 18:08:24 2018 +0200
Commit:     Khaled Hosny <khaledhosny at eglug.org>
CommitDate: Tue Nov 20 19:20:50 2018 +0100

    Don’t split HarfBuzz runs for Japanese text
    
    Change-Id: Ib1b632690ae8491732d893788c9b09ced8e49933
    Reviewed-on: https://gerrit.libreoffice.org/63668
    Tested-by: Jenkins
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/source/gdi/scrptrun.cxx b/vcl/source/gdi/scrptrun.cxx
index cbf16d6e85bd..f19e169fe93e 100644
--- a/vcl/source/gdi/scrptrun.cxx
+++ b/vcl/source/gdi/scrptrun.cxx
@@ -115,6 +115,19 @@ struct PairIndices
 
 };
 
+// There are three Unicode script codes for Japaneese 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)
+{
+    UScriptCode script = uscript_getScript(ch, status);
+    if (U_FAILURE(*status))
+        return script;
+    if (script == USCRIPT_KATAKANA || script == USCRIPT_KATAKANA_OR_HIRAGANA)
+        return USCRIPT_HIRAGANA;
+    return script;
+}
+
 }
 
 static const PairIndices gPairIndices;
@@ -159,7 +172,7 @@ UBool ScriptRun::next()
             }
         }
 
-        UScriptCode sc = uscript_getScript(ch, &error);
+        UScriptCode sc = getScript(ch, &error);
         int32_t pairIndex = gPairIndices.getPairIndex(ch);
 
         // Paired character handling:


More information about the Libreoffice-commits mailing list