]> git.lyx.org Git - features.git/commitdiff
properly validate unicode-math
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 24 Sep 2012 11:56:37 +0000 (13:56 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 24 Sep 2012 11:56:37 +0000 (13:56 +0200)
src/BufferParams.cpp
src/Encoding.cpp

index c99b467282afb770bf410eb3efa5aa4bf3a5b79d..e3dcb879860ac9edd878c370977e8f44e9cdbcf2 100644 (file)
@@ -1259,6 +1259,9 @@ void BufferParams::validate(LaTeXFeatures & features) const
                || useNonTeXFonts))
                features.require("polyglossia");
 
+       if (useNonTeXFonts && fonts_math != "auto")
+               features.require("unicode-math");
+
        if (!language->requires().empty())
                features.require(language->requires());
 }
@@ -1421,10 +1424,9 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
 
        if (useNonTeXFonts) {
                os << "\\usepackage{fontspec}\n";
-               if (fonts_math != "auto" && features.isAvailable("unicode-math")) {
-                       features.require("unicode-math");
+               if (features.mustProvide("unicode-math")
+                   && features.isAvailable("unicode-math"))
                        os << "\\usepackage{unicode-math}\n";
-               }
        }
 
        // font selection must be done before loading fontenc.sty
index 6447e33eecad05daa7d380b3a59c50229a3bd7cb..3325301a7c579082ca3844c087f536cf6802749d 100644 (file)
@@ -697,9 +697,11 @@ void Encodings::validate(char_type c, LaTeXFeatures & features, bool for_mathed)
                bool const use_text = (for_mathed && isTextCmd(c)) ||
                                      (!for_mathed && !it->second.textcommand.empty());
                bool const plain_utf8 = (features.runparams().encoding->name() == "utf8-plain");
+               bool const unicode_math = (features.isRequired("unicode-math")
+                       && features.isAvailable("unicode-math"));
                // with utf8-plain, we only load packages when in mathed (see #7766)
                // and if we do not use unicode-math
-               if ((math_mode && !features.isRequired("unicode-math"))
+               if ((math_mode && !unicode_math)
                     || (use_math && !plain_utf8)) {
                        if (!it->second.mathpreamble.empty()) {
                                if (it->second.mathfeature()) {