2 * \file InsetMathFont.cpp
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 "InsetMathFont.h"
15 #include "MathStream.h"
16 #include "MathParser.h"
17 #include "LaTeXFeatures.h"
18 #include "support/std_ostream.h"
23 InsetMathFont::InsetMathFont(latexkeys const * key)
24 : InsetMathNest(1), key_(key)
28 Inset * InsetMathFont::clone() const
30 return new InsetMathFont(*this);
34 InsetMath::mode_type InsetMathFont::currentMode() const
36 if (key_->extra == "mathmode")
38 if (key_->extra == "textmode")
40 return UNDECIDED_MODE;
44 void InsetMathFont::metrics(MetricsInfo & mi, Dimension & dim) const
46 FontSetChanger dummy(mi.base, key_->name);
47 cell(0).metrics(mi, dim);
53 void InsetMathFont::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);
58 setPosCache(pi, x, y);
62 void InsetMathFont::metricsT(TextMetricsInfo const & mi, Dimension &) const
64 cell(0).metricsT(mi, dim_);
68 void InsetMathFont::drawT(TextPainter & pain, int x, int y) const
70 cell(0).drawT(pain, x, y);
74 docstring InsetMathFont::name() const
80 void InsetMathFont::validate(LaTeXFeatures & features) const
82 InsetMathNest::validate(features);
83 // Make sure amssymb is put in preamble if Blackboard Bold or
85 if (key_->name == "mathfrak" || key_->name == "mathbb")
86 features.require("amssymb");
87 if (key_->name == "text")
88 features.require("amsmath");
89 if (key_->name == "textipa")
90 features.require("tipa");
94 void InsetMathFont::infoize(odocstream & os) const
96 os << "Font: " << key_->name;