]> git.lyx.org Git - lyx.git/blobdiff - src/Font.cpp
Remove undisclosed imports (from xxx import *)
[lyx.git] / src / Font.cpp
index 7e0798d8ac59b123182b0b609b351d561c5f6db5..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>
@@ -695,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"
@@ -716,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")
@@ -739,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));
 
                /**