From: Juergen Spitzmueller Date: Thu, 11 Jul 2019 07:54:28 +0000 (+0200) Subject: Proper number ordering with luabidi X-Git-Tag: lyx-2.4.0dev-acb2ca7b~1799 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1d0929b5d9975923f3cbbe7f84e93f3b694a1ccb;p=features.git Proper number ordering with luabidi As opposed to bidi (XeTeX), luabidi (LuaTeX) does no automatic reordering, so we need to use \\LR{} --- diff --git a/src/Font.cpp b/src/Font.cpp index a6e6c9190f..941f94a36c 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -338,17 +338,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{"; @@ -499,17 +505,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_) {