]> git.lyx.org Git - lyx.git/blobdiff - src/Font.cpp
fix MSVC warning.
[lyx.git] / src / Font.cpp
index f4e9bd053bf35362bf2064901361f10cb47d41e9..5826b34fb15413020615167b0b251cc267e8575e 100644 (file)
 #include "Font.h"
 
 #include "BufferParams.h" // stateText
+#include "Color.h"
 #include "debug.h"
 #include "Encoding.h"
 #include "gettext.h"
 #include "Language.h"
-#include "Color.h"
+#include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "LyXRC.h"
 #include "output_latex.h"
@@ -1070,6 +1071,47 @@ bool Font::fromString(string const & data, bool & toggle)
 }
 
 
+void Font::validate(LaTeXFeatures & features) const
+{
+       BufferParams const & bparams = features.bufferParams();
+       Language const * doc_language = bparams.language;
+
+       if (noun() == Font::ON) {
+               LYXERR(Debug::LATEX) << "font.noun: "
+                       << noun()
+                       << endl;
+               features.require("noun");
+               LYXERR(Debug::LATEX) << "Noun enabled. Font: "
+                       << to_utf8(stateText(0))
+                       << endl;
+       }
+       switch (color()) {
+               case Color::none:
+               case Color::inherit:
+               case Color::ignore:
+                       // probably we should put here all interface colors used for
+                       // font displaying! For now I just add this ones I know of (Jug)
+               case Color::latex:
+               case Color::note:
+                       break;
+               default:
+                       features.require("color");
+                       LYXERR(Debug::LATEX) << "Color enabled. Font: "
+                               << to_utf8(stateText(0))
+                               << endl;
+       }
+
+       if (lang->babel() != doc_language->babel() &&
+               lang != ignore_language &&
+               lang != latex_language)
+       {
+               features.useLanguage(lang);
+               LYXERR(Debug::LATEX) << "Found language "
+                       << lang->lang() << endl;
+       }
+}
+
+
 ostream & operator<<(ostream & os, Font::FONT_MISC_STATE fms)
 {
        return os << int(fms);