]> git.lyx.org Git - lyx.git/blobdiff - src/Font.cpp
Enable dissolve in undefined Flex inset context menu
[lyx.git] / src / Font.cpp
index e81e12449ba2c7b9e0325667670aec7e97d985ad..ee05efabbe045576788e18180556b59ecaf46c92 100644 (file)
@@ -347,21 +347,6 @@ 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
-       // but the packages used for Hebrew and Farsi (Arabi) do not.
-       if (!runparams.use_polyglossia
-           && !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;
-       }
-
        FontInfo f = bits_;
        f.reduce(base.bits_);
        FontInfo p = bits_;
@@ -411,6 +396,26 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
                env = true; //We have opened a new environment
        }
        */
+       // If the current language is Hebrew, Arabic, or Farsi
+       // the numbers are written Left-to-Right. ArabTeX package
+       // and bidi (polyglossia with XeTeX) reorder the number automatically
+       // but the packages used for Hebrew and Farsi (Arabi) do not.
+       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")) {
+               if (runparams.use_polyglossia) {
+                       // LuaTeX/luabidi
+                       os << "\\LR{";
+                       count += 5;
+               } else {
+                       os << "{\\beginL ";
+                       count += 9;
+               }
+       }
        if (f.emph() == FONT_ON) {
                os << "\\emph{";
                count += 6;
@@ -441,6 +446,11 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
                count += 10;
                ++runparams.inulemcmd;
        }
+       if (f.uuline() == FONT_ON) {
+               os << "\\uuline{";
+               count += 11;
+               ++runparams.inulemcmd;
+       }
        if (f.strikeout() == FONT_ON) {
                os << "\\sout{";
                count += 9;
@@ -451,12 +461,13 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
                count += 9;
                ++runparams.inulemcmd;
        }
-       if (f.uuline() == FONT_ON) {
-               os << "\\uuline{";
-               count += 11;
-               ++runparams.inulemcmd;
-       }
        if (f.uwave() == FONT_ON) {
+               if (runparams.inulemcmd) {
+                       // needed with nested uwave in xout
+                       // see https://tex.stackexchange.com/a/263042
+                       os << "\\ULdepth=1000pt";
+                       count += 15;
+               }
                os << "\\uwave{";
                count += 10;
                ++runparams.inulemcmd;
@@ -554,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_) {