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_data.h"
15 #include "math_mathmlstream.h"
16 #include "math_parser.h"
17 #include "LaTeXFeatures.h"
18 #include "support/std_ostream.h"
23 MathFontInset::MathFontInset(latexkeys const * key)
24 : MathNestInset(1), key_(key)
28 auto_ptr<InsetBase> MathFontInset::clone() const
30 return auto_ptr<InsetBase>(new MathFontInset(*this));
34 MathInset::mode_type MathFontInset::currentMode() const
36 if (key_->extra == "mathmode")
38 if (key_->extra == "textmode")
40 return UNDECIDED_MODE;
44 void MathFontInset::metrics(MetricsInfo & mi, Dimension & dim) const
46 FontSetChanger dummy(mi.base, key_->name.c_str());
47 cell(0).metrics(mi, dim_);
53 void MathFontInset::draw(PainterInfo & pi, int x, int y) const
55 FontSetChanger dummy(pi.base, key_->name.c_str());
56 cell(0).draw(pi, x + 1, y);
57 drawMarkers(pi, x, y);
61 void MathFontInset::metricsT(TextMetricsInfo const & mi, Dimension & /*dim*/) const
63 cell(0).metricsT(mi, dim_);
67 void MathFontInset::drawT(TextPainter & pain, int x, int y) const
69 cell(0).drawT(pain, x, y);
73 string MathFontInset::name() const
79 void MathFontInset::validate(LaTeXFeatures & features) const
81 MathNestInset::validate(features);
82 // Make sure amssymb is put in preamble if Blackboard Bold or
84 if (key_->name == "mathfrak" || key_->name == "mathbb")
85 features.require("amssymb");
89 void MathFontInset::infoize(std::ostream & os) const
91 os << "Font: " << key_->name;