7 #include "math_fontinset.h"
9 #include "math_mathmlstream.h"
10 #include "math_streamstr.h"
11 #include "math_support.h"
12 #include "LaTeXFeatures.h"
13 #include "textpainter.h"
14 #include "frontends/Painter.h"
18 MathFontInset::MathFontInset(string const & name)
19 : MathNestInset(1), name_(name)
25 MathInset * MathFontInset::clone() const
27 return new MathFontInset(*this);
31 void MathFontInset::metrics(MathMetricsInfo & mi) const
33 MathFontSetChanger dummy(mi.base, name_.c_str());
34 dim_ = xcell(0).metrics(mi);
39 void MathFontInset::draw(MathPainterInfo & pi, int x, int y) const
41 //lyxerr << "MathFontInset::draw\n";
42 //MathNestInset::draw(pi, x, y);
43 MathFontSetChanger dummy(pi.base, name_.c_str());
44 xcell(0).draw(pi, x + 1, y);
45 drawMarkers(pi, x, y);
49 void MathFontInset::metricsT(TextMetricsInfo const & mi) const
51 dim_ = xcell(0).metricsT(mi);
55 void MathFontInset::drawT(TextPainter & pain, int x, int y) const
57 //lyxerr << "drawing font code: " << code_ << '\n';
58 xcell(0).drawT(pain, x, y);
62 void MathFontInset::write(WriteStream & os) const
64 os << '\\' << name_ << '{' << cell(0) << '}';
68 void MathFontInset::normalize(NormalStream & os) const
70 os << "[font_ " << name_ << " " << cell(0) << "]";
74 void MathFontInset::validate(LaTeXFeatures & features) const
76 // Make sure amssymb is put in preamble if Blackboard Bold or
78 if (name_ == "mathfrak" || name_ == "mathbb")
79 features.require("amssymb");
83 void MathFontInset::infoize(std::ostream & os) const
85 os << "Font: " << name_;