]> git.lyx.org Git - lyx.git/blobdiff - src/Font.cpp
Fix functions that used functions but did not defined it
[lyx.git] / src / Font.cpp
index e072bca5b5f6db4c1d51d157ab5105102df5f436..748a8df92cf01e9e6ab4316f2185732c763bc539 100644 (file)
@@ -21,7 +21,6 @@
 #include "Encoding.h"
 #include "Language.h"
 #include "LaTeXFeatures.h"
-#include "Lexer.h"
 #include "LyXRC.h"
 #include "output_latex.h"
 #include "OutputParams.h"
@@ -31,6 +30,7 @@
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/gettext.h"
+#include "support/Lexer.h"
 #include "support/lstrings.h"
 
 #include <cstring>
@@ -426,7 +426,7 @@ int Font::latexWriteStartChanges(otexstream & os, BufferParams const & bparams,
        // 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.useBidiPackage()
+       if (!bparams.useBidiPackage(runparams)
            && !runparams.pass_thru
            && bits_.number() == FONT_ON
            && prev.fontInfo().number() != FONT_ON
@@ -439,7 +439,8 @@ int Font::latexWriteStartChanges(otexstream & os, BufferParams const & bparams,
                        // (possibly a LuaTeX bug)
                        os << "{\\LR{";
                        count += 6;
-               } else {
+               } else if (!runparams.isFullUnicode()) {
+                       // not needed with babel/lua|xetex
                        os << "{\\beginL ";
                        count += 9;
                }
@@ -504,8 +505,8 @@ int Font::latexWriteStartChanges(otexstream & os, BufferParams const & bparams,
                if (runparams.inulemcmd) {
                        // needed with nested uwave in xout
                        // see https://tex.stackexchange.com/a/263042
-                       os << "\\ULdepth=1000pt";
-                       count += 15;
+                       os << "\\ULdepth=\\maxdimen";
+                       count += 18;
                }
                if (needs_cprotection) {
                        os << "\\cprotect";
@@ -603,7 +604,7 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams,
        // 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.useBidiPackage()
+       if (!bparams.useBidiPackage(runparams)
            && !runparams.pass_thru
            && bits_.number() == FONT_ON
            && next.fontInfo().number() != FONT_ON
@@ -616,7 +617,8 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams,
                        // (possibly a LuaTeX bug)
                        os << "}}";
                        count += 2;
-               } else {
+               } else if (!runparams.isFullUnicode()) {
+                       // not needed with babel/lua|xetex
                        os << "\\endL}";
                        count += 6;
                }
@@ -693,18 +695,26 @@ bool Font::fromString(string const & data, bool & toggle)
 
                if (token == "family") {
                        int const next = lex.getInteger();
+                       if (next == -1)
+                               return false;
                        bits_.setFamily(FontFamily(next));
 
                } else if (token == "series") {
                        int const next = lex.getInteger();
+                       if (next == -1)
+                               return false;
                        bits_.setSeries(FontSeries(next));
 
                } else if (token == "shape") {
                        int const next = lex.getInteger();
+                       if (next == -1)
+                               return false;
                        bits_.setShape(FontShape(next));
 
                } else if (token == "size") {
                        int const next = lex.getInteger();
+                       if (next == -1)
+                               return false;
                        bits_.setSize(FontSize(next));
                // FIXME: shall style be handled there? Probably not.
                } else if (token == "emph" || token == "underbar"
@@ -714,6 +724,8 @@ bool Font::fromString(string const & data, bool & toggle)
                        || token == "nospellcheck") {
 
                        int const next = lex.getInteger();
+                       if (next == -1)
+                               return false;
                        FontState const misc = FontState(next);
 
                        if (token == "emph")
@@ -737,6 +749,8 @@ bool Font::fromString(string const & data, bool & toggle)
 
                } else if (token == "color") {
                        int const next = lex.getInteger();
+                       if (next == -1)
+                               return false;
                        bits_.setColor(ColorCode(next));
 
                /**