7 #include "math_fontinset.h"
9 #include "math_mathmlstream.h"
10 #include "math_streamstr.h"
11 #include "math_support.h"
12 #include "math_parser.h"
13 #include "LaTeXFeatures.h"
14 #include "textpainter.h"
15 #include "frontends/Painter.h"
19 MathFontInset::MathFontInset(latexkeys const * key)
20 : MathNestInset(1), key_(key)
26 MathInset * MathFontInset::clone() const
28 return new MathFontInset(*this);
32 void MathFontInset::metrics(MathMetricsInfo & mi) const
34 MathFontSetChanger dummy(mi.base, key_->name.c_str());
35 dim_ = xcell(0).metrics(mi);
40 void MathFontInset::draw(MathPainterInfo & pi, int x, int y) const
42 //lyxerr << "MathFontInset::draw\n";
43 //MathNestInset::draw(pi, x, y);
44 MathFontSetChanger dummy(pi.base, key_->name.c_str());
45 xcell(0).draw(pi, x + 1, y);
46 drawMarkers(pi, x, y);
50 void MathFontInset::metricsT(TextMetricsInfo const & mi) const
52 dim_ = xcell(0).metricsT(mi);
56 void MathFontInset::drawT(TextPainter & pain, int x, int y) const
58 //lyxerr << "drawing font code: " << code_ << '\n';
59 xcell(0).drawT(pain, x, y);
63 void MathFontInset::write(WriteStream & os) const
65 os << '\\' << key_->name << '{' << cell(0) << '}';
69 void MathFontInset::normalize(NormalStream & os) const
71 os << "[font " << key_->name << " " << cell(0) << "]";
75 void MathFontInset::validate(LaTeXFeatures & features) const
77 // Make sure amssymb is put in preamble if Blackboard Bold or
79 if (key_->name == "mathfrak" || key_->name == "mathbb")
80 features.require("amssymb");
84 void MathFontInset::infoize(std::ostream & os) const
86 os << "Font: " << key_->name;