]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathBox.cpp
* zh_TW.po: Update from Mingyi Wu
[lyx.git] / src / mathed / InsetMathBox.cpp
index 90a0749ca7c75c6f6d62a9ddf68ea03127167eca..8b3cb2b427b1c1938cf980bae60959072eebe8a9 100644 (file)
@@ -54,7 +54,8 @@ void InsetMathBox::normalize(NormalStream & os) const
 
 void InsetMathBox::mathmlize(MathStream & ms) const
 {
-       // FIXME Need to do something special for tags here.
+       // FIXME XHTML
+       // Need to do something special for tags here.
        // Probably will have to involve deferring them, which
        // means returning something from this routine.
        SetMode textmode(ms, true);
@@ -101,13 +102,9 @@ void InsetMathBox::validate(LaTeXFeatures & features) const
        // It'd be better to be able to get this from an InsetLayout, but at present
        // InsetLayouts do not seem really to work for things that aren't InsetTexts.
        if (features.runparams().math_flavor == OutputParams::MathAsMathML)
-               features.addPreambleSnippet("<style type=\"text/css\">\n"
-                       "mstyle.mathbox { font-style: normal; }\n"
-                       "</style>");
+               features.addCSSSnippet("mstyle.mathbox { font-style: normal; }");
        else if (features.runparams().math_flavor == OutputParams::MathAsHTML)
-               features.addPreambleSnippet("<style type=\"text/css\">\n"
-                       "span.mathbox { font-style: normal; }\n"
-                       "</style>");
+               features.addCSSSnippet("span.mathbox { font-style: normal; }");
 
        if (name_ == "tag" || name_ == "tag*")
                features.require("amsmath");
@@ -191,13 +188,11 @@ void InsetMathFBox::validate(LaTeXFeatures & features) const
        // It'd be better to be able to get this from an InsetLayout, but at present
        // InsetLayouts do not seem really to work for things that aren't InsetTexts.
        if (features.runparams().math_flavor == OutputParams::MathAsMathML)
-               features.addPreambleSnippet("<style type=\"text/css\">\n"
-                       "mstyle.fbox { border: 1px solid black; font-style: normal; padding: 0.5ex; }\n"
-                       "</style>");
+               features.addCSSSnippet(
+                       "mstyle.fbox { border: 1px solid black; font-style: normal; padding: 0.5ex; }");
        else if (features.runparams().math_flavor == OutputParams::MathAsHTML)
-               features.addPreambleSnippet("<style type=\"text/css\">\n"
-                       "span.fbox { border: 1px solid black; font-style: normal; padding: 0.5ex; }\n"
-                       "</style>");
+               features.addCSSSnippet(
+                       "span.fbox { border: 1px solid black; font-style: normal; padding: 0.5ex; }");
 
        cell(0).validate(features);
        InsetMathNest::validate(features);
@@ -223,7 +218,7 @@ void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const
        
        Dimension wdim;
        static docstring bracket = from_ascii("[");
-       mathed_string_dim(mi.base.font, bracket, wdim);
+       metricsStrRedBlack(mi, wdim, bracket);
        int w = wdim.wid;
        
        Dimension dim0;
@@ -287,9 +282,9 @@ void InsetMathMakebox::write(WriteStream & os) const
 {
        ModeSpecifier specifier(os, TEXT_MODE);
        os << (framebox_ ? "\\framebox" : "\\makebox");
-       if (cell(0).size() || !os.latex()) {
+       if (!cell(0).empty() || !os.latex()) {
                os << '[' << cell(0) << ']';
-               if (cell(1).size() || !os.latex())
+               if (!cell(1).empty() || !os.latex())
                        os << '[' << cell(1) << ']';
        }
        os << '{' << cell(2) << '}';
@@ -339,13 +334,9 @@ void InsetMathMakebox::validate(LaTeXFeatures & features) const
        // It'd be better to be able to get this from an InsetLayout, but at present
        // InsetLayouts do not seem really to work for things that aren't InsetTexts.
        if (features.runparams().math_flavor == OutputParams::MathAsMathML)
-               features.addPreambleSnippet("<style type=\"text/css\">\n"
-                       "mstyle.framebox { border: 1px solid black; }\n"
-                       "</style>");
+               features.addCSSSnippet("mstyle.framebox { border: 1px solid black; }");
        else if (features.runparams().math_flavor == OutputParams::MathAsHTML)
-               features.addPreambleSnippet("<style type=\"text/css\">\n"
-                       "span.framebox { border: 1px solid black; }\n"
-                       "</style>");
+               features.addCSSSnippet("span.framebox { border: 1px solid black; }");
        InsetMathNest::validate(features);
 }
 
@@ -421,13 +412,9 @@ void InsetMathBoxed::validate(LaTeXFeatures & features) const
        // It'd be better to be able to get this from an InsetLayout, but at present
        // InsetLayouts do not seem really to work for things that aren't InsetTexts.
        if (features.runparams().math_flavor == OutputParams::MathAsMathML)
-               features.addPreambleSnippet("<style type=\"text/css\">\n"
-                       "mstyle.boxed { border: 1px solid black; }\n"
-                       "</style>");
+               features.addCSSSnippet("mstyle.boxed { border: 1px solid black; }");
        else if (features.runparams().math_flavor == OutputParams::MathAsHTML)
-               features.addPreambleSnippet("<style type=\"text/css\">\n"
-                       "span.boxed { border: 1px solid black; }\n"
-                       "</style>");
+               features.addCSSSnippet("span.boxed { border: 1px solid black; }");
        
        InsetMathNest::validate(features);
 }