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 MathInset::mode_type MathFontInset::currentMode() const
34 if (key_->extra == "mathmode")
36 if (key_->extra == "textmode")
38 return UNDECIDED_MODE;
42 void MathFontInset::metrics(MathMetricsInfo & mi) const
44 MathFontSetChanger dummy(mi.base, key_->name.c_str());
45 dim_ = xcell(0).metrics(mi);
50 void MathFontInset::draw(MathPainterInfo & pi, int x, int y) const
52 //lyxerr << "MathFontInset::draw\n";
53 //MathNestInset::draw(pi, x, y);
54 MathFontSetChanger dummy(pi.base, key_->name.c_str());
55 xcell(0).draw(pi, x + 1, y);
56 drawMarkers(pi, x, y);
60 void MathFontInset::metricsT(TextMetricsInfo const & mi) const
62 dim_ = xcell(0).metricsT(mi);
66 void MathFontInset::drawT(TextPainter & pain, int x, int y) const
68 //lyxerr << "drawing font code: " << code_ << '\n';
69 xcell(0).drawT(pain, x, y);
73 void MathFontInset::write(WriteStream & os) const
75 os << '\\' << key_->name << '{' << cell(0) << '}';
79 void MathFontInset::normalize(NormalStream & os) const
81 os << "[font " << key_->name << " " << cell(0) << "]";
85 void MathFontInset::validate(LaTeXFeatures & features) const
87 // Make sure amssymb is put in preamble if Blackboard Bold or
89 if (key_->name == "mathfrak" || key_->name == "mathbb")
90 features.require("amssymb");
94 void MathFontInset::infoize(std::ostream & os) const
96 os << "Font: " << key_->name;