X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathEnsureMath.cpp;h=1897781aa6707a64c4152e49323b1e0c26f089ea;hb=ecbd047cffa1c4af95cf4ab91a7d2fded4a5584c;hp=3fdb3fbba9beeff3cacae91ca710a0b9d05c284a;hpb=d9bcbe5de63365c73126e335e702e375d1571f8f;p=lyx.git diff --git a/src/mathed/InsetMathEnsureMath.cpp b/src/mathed/InsetMathEnsureMath.cpp index 3fdb3fbba9..1897781aa6 100644 --- a/src/mathed/InsetMathEnsureMath.cpp +++ b/src/mathed/InsetMathEnsureMath.cpp @@ -17,6 +17,9 @@ #include "MathStream.h" #include "MathSupport.h" +#include "LaTeXFeatures.h" +#include "MetricsInfo.h" + #include @@ -35,17 +38,15 @@ Inset * InsetMathEnsureMath::clone() const void InsetMathEnsureMath::metrics(MetricsInfo & mi, Dimension & dim) const { - bool really_change_font = isTextFont(from_ascii(mi.base.fontname)); - FontSetChanger dummy(mi.base, "mathnormal", really_change_font); + Changer dummy = mi.base.changeEnsureMath(); cell(0).metrics(mi, dim); - metricsMarkers(dim); + metricsMarkers(mi, dim); } void InsetMathEnsureMath::draw(PainterInfo & pi, int x, int y) const { - bool really_change_font = isTextFont(from_ascii(pi.base.fontname)); - FontSetChanger dummy(pi.base, "mathnormal", really_change_font); + Changer dummy = pi.base.changeEnsureMath(); cell(0).draw(pi, x, y); drawMarkers(pi, x, y); } @@ -72,7 +73,19 @@ void InsetMathEnsureMath::write(WriteStream & os) const void InsetMathEnsureMath::mathmlize(MathStream & os) const { - os << cell(0); + 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"); } @@ -82,4 +95,17 @@ void InsetMathEnsureMath::infoize(odocstream & os) const } +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