]> git.lyx.org Git - lyx.git/blobdiff - src/Font.cpp
More requires --> required, for C++2a.
[lyx.git] / src / Font.cpp
index 17160ebd7df6d881435c091d0291bb3dbef71600..476ce372753bac4b2d15a2b97bfaafbb3dc1f288 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{";
@@ -361,7 +367,7 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
                count += 6;
                env = true; //We have opened a new environment
        }
-       if (f.size() != FONT_SIZE_INHERIT) {
+       if (f.size() != INHERIT_SIZE) {
                // If we didn't open an environment above, we open one here
                if (!env) {
                        os << '{';
@@ -459,7 +465,7 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams,
                ++count;
                env = true; // Size change need not bother about closing env.
        }
-       if (f.size() != FONT_SIZE_INHERIT) {
+       if (f.size() != INHERIT_SIZE) {
                // We only have to close if only size changed
                if (!env) {
                        if (needPar && !closeLanguage) {
@@ -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,7 +538,7 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams,
 
        if (closeLanguage
            && language() != base.language() && language() != next.language()
-           && language()->encoding()->package() != Encoding::CJK) {
+           && (language()->encoding()->package() != Encoding::CJK)) {
                os << '}';
                ++count;
                bool const using_begin_end =