#include "InsetMathSize.h"
+#include "LaTeXFeatures.h"
#include "MathData.h"
#include "MathParser.h"
#include "MathStream.h"
#include "output_xhtml.h"
#include "support/convert.h"
+#include "support/gettext.h"
+#include "support/lstrings.h"
#include <string>
#include <ostream>
+using namespace lyx::support;
using namespace std;
namespace lyx {
void InsetMathSize::metrics(MetricsInfo & mi, Dimension & dim) const
{
- StyleChanger dummy(mi.base, style_);
+ Changer dummy = mi.base.changeStyle(style_);
cell(0).metrics(mi, dim);
metricsMarkers(dim);
}
void InsetMathSize::draw(PainterInfo & pi, int x, int y) const
{
- StyleChanger dummy(pi.base, style_);
+ Changer dummy = pi.base.changeStyle(style_);
cell(0).draw(pi, x + 1, y);
drawMarkers(pi, x, y);
}
stringstream attrs;
attrs << "displaystyle='" << (dispstyle ? "true" : "false")
<< "' scriptlevel='" << scriptlevel << "'";
- ms << "<mstyle " << from_ascii(attrs.str()) << ">"
- << cell(0) << "</mstyle>";
+ ms << MTag("mstyle", attrs.str()) << cell(0) << ETag("mstyle");
+}
+
+
+void InsetMathSize::htmlize(HtmlStream & os) const
+{
+ string const & name = to_utf8(key_->name);
+ os << MTag("span", "class='" + name + "'")
+ << cell(0) << ETag("span");
}
void InsetMathSize::infoize(odocstream & os) const
{
- os << "Size: " << key_->name;
+ os << bformat(_("Size: %1$s"), key_->name);
}
+void InsetMathSize::validate(LaTeXFeatures & features) const
+{
+ if (features.runparams().math_flavor == OutputParams::MathAsHTML)
+ features.addCSSSnippet(
+ "span.displaystyle, span.textstyle{font-size: normal;}\n"
+ "span.scriptstyle {font-size: small;}\n"
+ "span.scriptscriptstyle {font-size: x-small;}");
+ InsetMathNest::validate(features);
+}
+
} // namespace lyx