From 5679dc5c6ff6e806163c7214be3903b5bbe23780 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Thu, 11 Jul 2019 09:54:28 +0200 Subject: [PATCH] Proper number ordering with luabidi As opposed to bidi (XeTeX), luabidi (LuaTeX) does no automatic reordering, so we need to use \\LR{} (cherry picked from commit 1d0929b5d9975923f3cbbe7f84e93f3b694a1ccb) --- src/Font.cpp | 28 ++++++++++++++++++++-------- status.23x | 2 ++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/Font.cpp b/src/Font.cpp index 79f0e2ed2d..ee05efabbe 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -398,17 +398,23 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams, */ // If the current language is Hebrew, Arabic, or Farsi // the numbers are written Left-to-Right. ArabTeX package - // and bidi (polyglossia) reorder the number automatically + // and bidi (polyglossia with XeTeX) reorder the number automatically // but the packages used for Hebrew and Farsi (Arabi) do not. - if (!runparams.use_polyglossia + if (!(runparams.use_polyglossia && runparams.flavor == OutputParams::XETEX) && !runparams.pass_thru && bits_.number() == FONT_ON && prev.fontInfo().number() != FONT_ON && (language()->lang() == "hebrew" || language()->lang() == "farsi" || language()->lang() == "arabic_arabi")) { - os << "{\\beginL "; - count += 9; + if (runparams.use_polyglossia) { + // LuaTeX/luabidi + os << "\\LR{"; + count += 5; + } else { + os << "{\\beginL "; + count += 9; + } } if (f.emph() == FONT_ON) { os << "\\emph{"; @@ -559,17 +565,23 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams, // If the current language is Hebrew, Arabic, or Farsi // the numbers are written Left-to-Right. ArabTeX package - // and bidi (polyglossia) reorder the number automatically + // and bidi (polyglossia with XeTeX) reorder the number automatically // but the packages used for Hebrew and Farsi (Arabi) do not. - if (!runparams.use_polyglossia + if (!(runparams.use_polyglossia && runparams.flavor == OutputParams::XETEX) && !runparams.pass_thru && bits_.number() == FONT_ON && next.fontInfo().number() != FONT_ON && (language()->lang() == "hebrew" || language()->lang() == "farsi" || language()->lang() == "arabic_arabi")) { - os << "\\endL}"; - count += 6; + if (runparams.use_polyglossia) { + // LuaTeX/luabidi + os << "}"; + count += 1; + } else { + os << "\\endL}"; + count += 6; + } } if (open_encoding_) { diff --git a/status.23x b/status.23x index a6750ea456..b3c918724f 100644 --- a/status.23x +++ b/status.23x @@ -76,6 +76,8 @@ What's new - Fix direction of brackets with RTL documents and LuaTeX (part of bug 11187). +- Fix direction of roman numbers with RTL documents and LuaTeX. + * USER INTERFACE -- 2.39.5