]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathFont.cpp
Do some caching of window title and related UI
[lyx.git] / src / mathed / InsetMathFont.cpp
index efd43ced126e886b57636932ef7a7c769e97307a..a017dd810c4ac3e08af92ff71325f05f4511ebb9 100644 (file)
 #include "MathParser.h"
 #include "MetricsInfo.h"
 
+#include "support/gettext.h"
+#include "support/lstrings.h"
+
 #include <ostream>
 
+using namespace lyx::support;
 
 namespace lyx {
 
@@ -62,7 +66,7 @@ void InsetMathFont::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetMathFont::draw(PainterInfo & pi, int x, int y) const
 {
-       FontSetChanger dummy(pi.base, key_->name.c_str());
+       FontSetChanger dummy(pi.base, key_->name);
        cell(0).draw(pi, x + 1, y);
        drawMarkers(pi, x, y);
        setPosCache(pi, x, y);
@@ -101,13 +105,13 @@ void InsetMathFont::validate(LaTeXFeatures & features) const
                                || (key_->name.length() == 6 && key_->name.substr(0, 4) == "text"))
                        features.require("amstext");
                if (key_->name == "mathscr")
-                       features.require("mathrsfs"); 
+                       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"
@@ -115,8 +119,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;}");
        }
 }
 
@@ -140,7 +143,7 @@ void InsetMathFont::htmlize(HtmlStream & os) const
                 || tag == "textbf")
                variant = "bold";
        else if (tag == "mathcal")
-               variant == "script";
+               variant = "script";
        else if (tag == "mathit" || tag == "textsl"
                 || tag == "emph" || tag == "textit")
                variant = "italic";
@@ -150,7 +153,7 @@ void InsetMathFont::htmlize(HtmlStream & os) const
                variant = "monospace";
        else if (tag == "textipa" || tag == "textsc" || tag == "noun")
                variant = "noun";
-       
+
        docstring const beg = (tag.size() < 4) ? from_ascii("") : tag.substr(0, 4);
        if (!variant.empty()) {
                os << MTag("span", "class='" + variant + "'")
@@ -180,7 +183,7 @@ void InsetMathFont::mathmlize(MathStream & os) const
                 || tag == "textbf")
                variant = "bold";
        else if (tag == "mathcal")
-               variant == "script";
+               variant = "script";
        else if (tag == "mathit" || tag == "textsl"
                 || tag == "emph" || tag == "textit")
                variant = "italic";
@@ -189,11 +192,17 @@ void InsetMathFont::mathmlize(MathStream & os) const
        else if (tag == "mathtt" || tag == "texttt")
                variant = "monospace";
        // no support at present for textipa, textsc, noun
-       
+
        if (!variant.empty()) {
-               os << MTag("mstyle", "mathvariant='" + variant + "'")
-                  << cell(0)
-                  << ETag("mstyle");
+               if (tag == "mathbb") {
+                       os << MTag("mstyle", "class='mathbb' mathvariant='" + variant + "'")
+                          << cell(0)
+                          << ETag("mstyle");
+               } else {
+                       os << MTag("mstyle", "mathvariant='" + variant + "'")
+                                << cell(0)
+                                << ETag("mstyle");
+               }
        } else
                os << cell(0);
 }
@@ -201,7 +210,7 @@ void InsetMathFont::mathmlize(MathStream & os) const
 
 void InsetMathFont::infoize(odocstream & os) const
 {
-       os << "Font: " << key_->name;
+       os << bformat(_("Font: %1$s"), key_->name);
 }