From fe57b192942e9528a480015b247d75bde2ea468c Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Fri, 18 Aug 2023 09:20:26 +0200 Subject: [PATCH] Mirror all delimiters in RTL context with luabidi, regardless of the language or script (#12881) Patch by Udi Fogiel --- src/Paragraph.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 641f8b1e03..0ff0e157a2 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -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) { -- 2.39.5