]> git.lyx.org Git - features.git/commitdiff
Mirror all delimiters in RTL context with luabidi, regardless of the language or...
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 18 Aug 2023 07:20:26 +0000 (09:20 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 18 Aug 2023 07:20:26 +0000 (09:20 +0200)
Patch by Udi Fogiel

src/Paragraph.cpp

index 641f8b1e033842a746696aa84285d70817e324cc..0ff0e157a2e74e3d8daa2c1386fddef1f62a6efd 100644 (file)
@@ -2053,11 +2053,11 @@ char_type Paragraph::getUChar(BufferParams const & bparams,
        char_type c = d->text_[pos];
 
        // Return unchanged character in LTR languages
-       // or if we use poylglossia/bidi (XeTeX)
-       // or with babel and Xe/LuaTeX.
+       // or if we use XeTeX
+       // or with babel and LuaTeX.
        if (!getFontSettings(bparams, pos).isRightToLeft()
-           || bparams.useBidiPackage(rp)
-           || (rp.use_babel && rp.isFullUnicode()))
+           || rp.flavor == Flavor::XeTeX
+           || (rp.use_babel && rp.flavor == Flavor::LuaTeX))
                return c;
 
        // Without polyglossia/bidi, we need to account for some special cases.
@@ -2079,14 +2079,15 @@ char_type Paragraph::getUChar(BufferParams const & bparams,
        string const & lang = getFontSettings(bparams, pos).language()->lang();
        char_type uc = c;
 
-       // 1. In the following languages, parentheses need to be reversed.
-       //    Also with polyglossia/luabidi
+       // 1. With polyglossia/luabidi all delimiters need to be mirrored,
+       //    regardless of the languge, or script.
+       // 2. In the following languages, parentheses need to be mirrored.
        bool const reverseparens = (lang == "hebrew" || rp.use_polyglossia);
 
-       // 2. In the following languages, brackets don't need to be reversed.
-       bool const reversebrackets = lang != "arabic_arabtex"
+       // 3. In the following languages, brackets don't need to be mirrored.
+       bool const reversebrackets = (lang != "arabic_arabtex"
                        && lang != "arabic_arabi"
-                       && lang != "farsi";
+                       && lang != "farsi") || rp.use_polyglossia;
 
        // Now swap delimiters if needed.
        switch (c) {