i18nutil/qa/cppunit/test_scriptchangescanner.cxx |    7 ++---
 i18nutil/source/utility/scriptchangescanner.cxx  |   29 -----------------------
 2 files changed, 3 insertions(+), 33 deletions(-)

New commits:
commit 4955c78db541cc73ea85f0990562c78349400030
Author:     Jonathan Clark <jonat...@libreoffice.org>
AuthorDate: Mon May 26 08:57:52 2025 -0600
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu May 29 22:51:21 2025 +0200

    tdf#166104 sw: Fix for apostrophes changing to Asian font
    
    Regression from 537645c0834eab2d277113f1e3fcf039c994832d
    "tdf#66791 sw: Treat weak punctuation as Asian in Asian paragraphs"
    
    The fix for tdf#66791 extended the script change scanner to always treat
    weak quotation-like punctuation as Asian script in paragraphs containing
    Asian characters. That new behavior emulates the behavior of other word
    processing programs.
    
    Unfortunately, the change proved too disruptive. This change
    substantially reverts the new behavior added for tdf#66791, but leaves
    the refactoring and testing work intact.
    
    Change-Id: I9eaf91f27a4e8f7440c949a713c6b64fe8dc579b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185812
    Tested-by: Jenkins
    Reviewed-by: Jonathan Clark <jonat...@libreoffice.org>
    (cherry picked from commit 86ffb108824d884320bde3320d58c8c497780099)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186015
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/i18nutil/qa/cppunit/test_scriptchangescanner.cxx 
b/i18nutil/qa/cppunit/test_scriptchangescanner.cxx
index ea8f6c9e1518..805efd2bb53f 100644
--- a/i18nutil/qa/cppunit/test_scriptchangescanner.cxx
+++ b/i18nutil/qa/cppunit/test_scriptchangescanner.cxx
@@ -232,8 +232,7 @@ void ScriptChangeScannerTest::testNonspacingMark()
 
 void ScriptChangeScannerTest::testSmartQuoteCompatibilityCJ()
 {
-    // tdf#66791: For compatibility with other programs, weak-script quotes in 
paragraphs
-    // containing CJ characters should be treated as Asian script
+    // tdf#166104: Weak-script quotes should take the previously-seen script 
type
 
     auto aText = u"Before \u201c水\u201d After"_ustr;
     auto pDirScanner = MakeDirectionChangeScanner(aText, 0);
@@ -242,13 +241,13 @@ void 
ScriptChangeScannerTest::testSmartQuoteCompatibilityCJ()
     CPPUNIT_ASSERT(!pScanner->AtEnd());
     CPPUNIT_ASSERT_EQUAL(css::i18n::ScriptType::LATIN, 
pScanner->Peek().m_nScriptType);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pScanner->Peek().m_nStartIndex);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(7), pScanner->Peek().m_nEndIndex);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(8), pScanner->Peek().m_nEndIndex);
 
     pScanner->Advance();
 
     CPPUNIT_ASSERT(!pScanner->AtEnd());
     CPPUNIT_ASSERT_EQUAL(css::i18n::ScriptType::ASIAN, 
pScanner->Peek().m_nScriptType);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(7), pScanner->Peek().m_nStartIndex);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(8), pScanner->Peek().m_nStartIndex);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(11), pScanner->Peek().m_nEndIndex);
 
     pScanner->Advance();
diff --git a/i18nutil/source/utility/scriptchangescanner.cxx 
b/i18nutil/source/utility/scriptchangescanner.cxx
index a3e27bdaf155..0f53e16e0383 100644
--- a/i18nutil/source/utility/scriptchangescanner.cxx
+++ b/i18nutil/source/utility/scriptchangescanner.cxx
@@ -136,7 +136,6 @@ private:
     sal_Int32 m_nNextStart = 0;
     sal_Int16 m_nPrevScript = css::i18n::ScriptType::WEAK;
     bool m_bAtEnd = false;
-    bool m_bApplyAsianToWeakQuotes = false;
 
     void AdvanceOnce()
     {
@@ -193,15 +192,6 @@ private:
             else if (nScript == css::i18n::ScriptType::WEAK)
             {
                 nScript = m_nPrevScript;
-                if (m_bApplyAsianToWeakQuotes)
-                {
-                    auto nType = unicode::getUnicodeType(nChar);
-                    if (nType == css::i18n::UnicodeType::INITIAL_PUNCTUATION
-                        || nType == css::i18n::UnicodeType::FINAL_PUNCTUATION)
-                    {
-                        nScript = css::i18n::ScriptType::ASIAN;
-                    }
-                }
             }
 
             if (nScript != m_nPrevScript)
@@ -262,25 +252,6 @@ public:
             {
                 m_nPrevScript = nScript;
             }
-
-            if (nScript == css::i18n::ScriptType::COMPLEX)
-            {
-                m_bApplyAsianToWeakQuotes = false;
-                break;
-            }
-
-            auto nUnicodeScript = u_getIntPropertyValue(nChar, UCHAR_SCRIPT);
-            switch (nUnicodeScript)
-            {
-                case USCRIPT_HAN:
-                case USCRIPT_HIRAGANA:
-                case USCRIPT_KATAKANA:
-                    m_bApplyAsianToWeakQuotes = true;
-                    break;
-
-                default:
-                    break;
-            }
         }
 
         // Fall back to the application language for leading weak characters 
if a

Reply via email to