]> git.lyx.org Git - features.git/commitdiff
Fix text direction problem with polyglossia
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 24 Aug 2018 13:02:26 +0000 (15:02 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Wed, 26 Sep 2018 14:58:21 +0000 (16:58 +0200)
If an RTL language is set via environment in polyglossia, only a nested
\\text<lang> command will reset the direction for LTR languages

Fixes rest of # 10111.

(cherry picked from commit 2d4ac90fd20eac5a32b2d71e7de1d2c92ee2429e)

src/output_latex.cpp

index 03b4b44e552213c07a708ff8912fccfe5b58f125..dbddb6c01b673d5a1cc3bc82ca1b3cf28cf28d61 100644 (file)
@@ -831,9 +831,13 @@ void TeXOnePar(Buffer const & buf,
                os << '{';
        }
 
-       // In some insets (such as Arguments), we cannot use \selectlanguage
+       // In some insets (such as Arguments), we cannot use \selectlanguage.
+       // Also, if an RTL language is set via environment in polyglossia,
+       // only a nested \\text<lang> command will reset the direction for LTR
+       // languages (see # 10111).
        bool const localswitch = text.inset().forceLocalFontSwitch()
-                       || (using_begin_end && text.inset().forcePlainLayout());
+                       || (using_begin_end && text.inset().forcePlainLayout())
+                       || (use_polyglossia && outer_language->rightToLeft() && !par_language->rightToLeft());
        if (localswitch) {
                lang_begin_command = use_polyglossia ?
                            "\\text$$lang$$opts{" : lyxrc.language_command_local;