#include "InsetMathEnsureMath.h"
-#include "MathStream.h"
#include "MathData.h"
+#include "MathStream.h"
+#include "MathSupport.h"
+
+#include "LaTeXFeatures.h"
+#include "MetricsInfo.h"
#include <ostream>
void InsetMathEnsureMath::metrics(MetricsInfo & mi, Dimension & dim) const
{
- FontSetChanger dummy(mi.base, "mathnormal");
+ bool really_change_font = isTextFont(mi.base.fontname);
+ Changer dummy = mi.base.changeFontSet("mathnormal", really_change_font);
cell(0).metrics(mi, dim);
metricsMarkers(dim);
}
void InsetMathEnsureMath::draw(PainterInfo & pi, int x, int y) const
{
- FontSetChanger dummy(pi.base, "mathnormal");
+ bool really_change_font = isTextFont(pi.base.fontname);
+ Changer dummy = pi.base.changeFontSet("mathnormal", really_change_font);
cell(0).draw(pi, x, y);
drawMarkers(pi, x, y);
}
}
+void InsetMathEnsureMath::mathmlize(MathStream & os) const
+{
+ SetMode mathmode(os, false);
+ os << MTag("mstyle", "class='math'")
+ << cell(0)
+ << ETag("mstyle");
+}
+
+
+void InsetMathEnsureMath::htmlize(HtmlStream & os) const
+{
+ SetHTMLMode mathmode(os, false);
+ os << MTag("span", "class='math'")
+ << cell(0)
+ << ETag("span");
+}
+
+
void InsetMathEnsureMath::infoize(odocstream & os) const
{
os << "EnsureMath";
}
+void InsetMathEnsureMath::validate(LaTeXFeatures & features) const
+{
+ // FIXME XHTML
+ // 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.addCSSSnippet("mstyle.math { font-style: italic; }");
+ else if (features.runparams().math_flavor == OutputParams::MathAsHTML)
+ features.addCSSSnippet("span.mathbox { font-style: italic; }");
+
+ InsetMathNest::validate(features);
+}
+
} // namespace lyx