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"
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());
35 width_ = xcell(0).width();
36 ascent_ = xcell(0).ascent();
37 descent_ = xcell(0).descent();
41 void MathFontInset::draw(MathPainterInfo & pi, int x, int y) const
43 //lyxerr << "MathFontInset::draw\n";
44 MathNestInset::draw(pi, x, y);
45 MathFontSetChanger dummy(pi.base, name_.c_str());
46 xcell(0).draw(pi, x, y);
50 void MathFontInset::metricsT(TextMetricsInfo const & mi) const
52 xcell(0).metricsT(mi);
53 width_ = xcell(0).width();
54 ascent_ = xcell(0).ascent();
55 descent_ = xcell(0).descent();
59 void MathFontInset::drawT(TextPainter & pain, int x, int y) const
61 //lyxerr << "drawing font code: " << code_ << '\n';
62 xcell(0).drawT(pain, x, y);
66 void MathFontInset::write(WriteStream & os) const
68 os << '\\' << name_ << '{' << cell(0) << '}';
72 void MathFontInset::normalize(NormalStream & os) const
74 os << "[font_ " << name_ << " " << cell(0) << "]";
78 void MathFontInset::validate(LaTeXFeatures & features) const
80 // Make sure amssymb is put in preamble if Blackboard Bold or
82 if (name_ == "mathfrak" || name_ == "mathbb")
83 features.require("amssymb");
87 void MathFontInset::infoize(std::ostream & os) const
89 os << "Font: " << name_;