]> git.lyx.org Git - lyx.git/blobdiff - src/Font.cpp
Remove obsolete (and false) comment.
[lyx.git] / src / Font.cpp
index a6e6c9190f364f5ec8811ec6bc178ed169274b1d..a6580fda216f3fd51ad175f6dd3061f4f60c7409 100644 (file)
@@ -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.useBidiPackage()
            && !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.useBidiPackage()
            && !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_) {
@@ -526,8 +538,7 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams,
 
        if (closeLanguage
            && language() != base.language() && language() != next.language()
-           && (language()->encoding()->package() != Encoding::CJK
-                       || bparams.useNonTeXFonts)) {
+           && (language()->encoding()->package() != Encoding::CJK)) {
                os << '}';
                ++count;
                bool const using_begin_end =
@@ -762,7 +773,7 @@ ostream & operator<<(ostream & os, FontInfo const & f)
 ostream & operator<<(ostream & os, Font const & font)
 {
        return os << font.bits_
-               << " lang: " << (font.lang_ ? font.lang_->lang() : 0);
+               << " lang: " << (font.lang_ ? font.lang_->lang() : nullptr);
 }