]> git.lyx.org Git - lyx.git/blobdiff - src/Font.cpp
Remove hardcoded values
[lyx.git] / src / Font.cpp
index 70bc25578baa03a558026a6d7603038c24894a34..9124f0ab05c94f3e848c898966379939594bd87a 100644 (file)
@@ -25,6 +25,7 @@
 #include "LyXRC.h"
 #include "output_latex.h"
 #include "OutputParams.h"
+#include "texstream.h"
 
 #include "support/lassert.h"
 #include "support/convert.h"
@@ -286,6 +287,7 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
                        tmp += "{";
                        os << from_ascii(tmp);
                        count += tmp.length();
+                       pushPolyglossiaLang(language()->polyglossia(), true);
                } else if (language()->encoding()->package() != Encoding::CJK) {
                        os << '{';
                        count += 1;
@@ -327,7 +329,6 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
                }
        }
 
-       // FIXME: skip this for XeTeX/LuaTeX? With nonTeXfonts or always?
        if (language()->encoding()->package() == Encoding::CJK) {
                pair<bool, int> const c = switchEncoding(os, bparams,
                                runparams, *(language()->encoding()));
@@ -342,10 +343,11 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
        // the numbers are written Left-to-Right. ArabTeX package
        // reorders the number automatically but the packages used
        // for Hebrew and Farsi (Arabi) do not.
-       if (bits_.number() == FONT_ON && prev.fontInfo().number() != FONT_ON
-               && (language()->lang() == "hebrew"
-                       || language()->lang() == "farsi" 
-                       || language()->lang() == "arabic_arabi")) {
+       if (!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;
        }
@@ -520,10 +522,11 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams,
        // the numbers are written Left-to-Right. ArabTeX package
        // reorders the number automatically but the packages used
        // for Hebrew and Farsi (Arabi) do not.
-       if (bits_.number() == FONT_ON && next.fontInfo().number() != FONT_ON
-               && (language()->lang() == "hebrew"
-                       || language()->lang() == "farsi"
-                       || language()->lang() == "arabic_arabi")) {
+       if (!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;
        }
@@ -545,6 +548,8 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams,
            && language()->encoding()->package() != Encoding::CJK) {
                os << '}';
                ++count;
+               if (runparams.use_polyglossia)
+                       popPolyglossiaLang();
        }
 
        return count;