From f0f4b98c6e00f6a07ca60814c9faa6acfb192961 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Thu, 11 Jul 2019 08:25:18 +0200 Subject: [PATCH] Brackets reversion differs in luabidi (LuaTeX) from bidi (XeTeX) This amends [195f62ac93/lyxgit] (cherry picked from commit d3aa1022603b94f101c3fc42a8d9a37cb6dc4432) --- src/Paragraph.cpp | 18 ++++++++++++++++-- status.23x | 2 ++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 7d484078c6..d95c531387 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1920,11 +1920,12 @@ char_type Paragraph::getUChar(BufferParams const & bparams, // Most likely, we should simply rely on Qt's unicode handling here. string const & lang = getFontSettings(bparams, pos).language()->lang(); - // With polyglossia, brackets and stuff need not be reversed in RTL scripts + // With polyglossia and XeTeX (bidi), brackets and stuff need not be + // reversed in RTL scripts // FIXME: The special casing for Hebrew parens is due to the special // handling on input (for Hebrew in e5f42f67d/lyxgit); see #8251. char_type uc = c; - if (rp.use_polyglossia) { + if (rp.use_polyglossia && rp.flavor == OutputParams::XETEX) { switch (c) { case '(': if (lang == "hebrew") @@ -1937,6 +1938,19 @@ char_type Paragraph::getUChar(BufferParams const & bparams, } return uc; } + // LuaTeX (luabidi) is different + if (rp.use_polyglossia && rp.flavor != OutputParams::XETEX) { + switch (c) { + case '(': + if (lang != "hebrew") + uc = ')'; + break; + case ')': + if (lang != "hebrew") + uc = '('; + break; + } + } // In the following languages, brackets don't need to be reversed. // Furthermore, in arabic_arabi, they are transformed to Arabic diff --git a/status.23x b/status.23x index 53d3f96d8f..a6750ea456 100644 --- a/status.23x +++ b/status.23x @@ -74,6 +74,8 @@ What's new - Fix paragraph alignment with RTL documents and LuaTeX (part of bug 11399). +- Fix direction of brackets with RTL documents and LuaTeX (part of bug 11187). + * USER INTERFACE -- 2.39.5