]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathFont.cpp
Attempt to fix #8137 (arrived at r40862).
[lyx.git] / src / mathed / InsetMathFont.cpp
index 93a266553759d0b4530d893993e7028dacf761d0..26789e71e8016f351bf1123953b381275d8f8b0e 100644 (file)
@@ -100,12 +100,14 @@ void InsetMathFont::validate(LaTeXFeatures & features) const
                if (key_->name == "text" || key_->name == "textnormal"
                                || (key_->name.length() == 6 && key_->name.substr(0, 4) == "text"))
                        features.require("amstext");
+               if (key_->name == "mathscr")
+                       features.require("mathrsfs"); 
                if (key_->name == "textipa")
                        features.require("tipa");
                if (key_->name == "ce" || key_->name == "cf")
                        features.require("mhchem");
        } else if (features.runparams().math_flavor == OutputParams::MathAsHTML) {
-               features.addPreambleSnippet("<style type=\"text/css\">\n"
+               features.addCSSSnippet(
                        "span.normal{font: normal normal normal inherit serif;}\n"
                        "span.fraktur{font: normal normal normal inherit cursive;}\n"
                        "span.bold{font: normal normal bold inherit serif;}\n"
@@ -113,8 +115,7 @@ void InsetMathFont::validate(LaTeXFeatures & features) const
                        "span.italic{font: italic normal normal inherit serif;}\n"
                        "span.sans{font: normal normal normal inherit sans-serif;}\n"
                        "span.monospace{font: normal normal normal inherit monospace;}\n"
-                       "span.noun{font: normal small-caps normal inherit normal;}\n"
-                       "</style>");
+                       "span.noun{font: normal small-caps normal inherit normal;}");
        }
 }
 
@@ -150,10 +151,10 @@ void InsetMathFont::htmlize(HtmlStream & os) const
                variant = "noun";
        
        docstring const beg = (tag.size() < 4) ? from_ascii("") : tag.substr(0, 4);
-       bool const textmode = (beg == "text");
        if (!variant.empty()) {
-               SetHTMLMode sm(os, textmode, "class='" + variant + "'");
-               os << cell(0);
+               os << MTag("span", "class='" + variant + "'")
+                  << cell(0)
+                  << ETag("span");
        } else
                os << cell(0);
 }
@@ -188,12 +189,10 @@ void InsetMathFont::mathmlize(MathStream & os) const
                variant = "monospace";
        // no support at present for textipa, textsc, noun
        
-       docstring const beg = (tag.size() < 4) ? from_ascii("") : tag.substr(0, 4);
-       bool const textmode = (beg == "text");
        if (!variant.empty()) {
-               std::string const attrs = "mathvariant='" + variant + "'";
-               SetMode sm(os, textmode, attrs);
-               os << cell(0);
+               os << MTag("mstyle", "mathvariant='" + variant + "'")
+                  << cell(0)
+                  << ETag("mstyle");
        } else
                os << cell(0);
 }