2 * \file math_fontinset.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "math_fontinset.h"
14 #include "math_mathmlstream.h"
15 #include "math_parser.h"
16 #include "LaTeXFeatures.h"
17 #include "support/std_ostream.h"
22 MathFontInset::MathFontInset(latexkeys const * key)
23 : MathNestInset(1), key_(key)
27 auto_ptr<InsetBase> MathFontInset::clone() const
29 return auto_ptr<InsetBase>(new MathFontInset(*this));
33 MathInset::mode_type MathFontInset::currentMode() const
35 if (key_->extra == "mathmode")
37 if (key_->extra == "textmode")
39 return UNDECIDED_MODE;
43 void MathFontInset::metrics(MetricsInfo & mi, Dimension & dim) const
45 FontSetChanger dummy(mi.base, key_->name.c_str());
46 cell(0).metrics(mi, dim_);
52 void MathFontInset::draw(PainterInfo & pi, int x, int y) const
54 FontSetChanger dummy(pi.base, key_->name.c_str());
55 cell(0).draw(pi, x + 1, y);
56 drawMarkers(pi, x, y);
60 void MathFontInset::metricsT(TextMetricsInfo const & mi, Dimension & /*dim*/) const
62 cell(0).metricsT(mi, dim_);
66 void MathFontInset::drawT(TextPainter & pain, int x, int y) const
68 cell(0).drawT(pain, x, y);
72 string MathFontInset::name() const
78 void MathFontInset::validate(LaTeXFeatures & features) const
80 MathNestInset::validate(features);
81 // Make sure amssymb is put in preamble if Blackboard Bold or
83 if (key_->name == "mathfrak" || key_->name == "mathbb")
84 features.require("amssymb");
88 void MathFontInset::infoize(std::ostream & os) const
90 os << "Font: " << key_->name;