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_streamstr.h"
16 #include "math_support.h"
17 #include "math_parser.h"
18 #include "LaTeXFeatures.h"
19 #include "support/LOstream.h"
20 #include "textpainter.h"
25 MathFontInset::MathFontInset(latexkeys const * key)
26 : MathNestInset(1), key_(key)
30 auto_ptr<InsetBase> MathFontInset::clone() const
32 return auto_ptr<InsetBase>(new MathFontInset(*this));
36 MathInset::mode_type MathFontInset::currentMode() const
38 if (key_->extra == "mathmode")
40 if (key_->extra == "textmode")
42 return UNDECIDED_MODE;
46 void MathFontInset::metrics(MetricsInfo & mi, Dimension & dim) const
48 FontSetChanger dummy(mi.base, key_->name.c_str());
49 cell(0).metrics(mi, dim_);
55 void MathFontInset::draw(PainterInfo & pi, int x, int y) const
57 FontSetChanger dummy(pi.base, key_->name.c_str());
58 cell(0).draw(pi, x + 1, y);
59 drawMarkers(pi, x, y);
63 void MathFontInset::metricsT(TextMetricsInfo const & mi, Dimension & /*dim*/) const
65 cell(0).metricsT(mi, dim_);
69 void MathFontInset::drawT(TextPainter & pain, int x, int y) const
71 cell(0).drawT(pain, x, y);
75 string MathFontInset::name() const
81 void MathFontInset::validate(LaTeXFeatures & features) const
83 MathNestInset::validate(features);
84 // Make sure amssymb is put in preamble if Blackboard Bold or
86 if (key_->name == "mathfrak" || key_->name == "mathbb")
87 features.require("amssymb");
91 void MathFontInset::infoize(std::ostream & os) const
93 os << "Font: " << key_->name;