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 "LaTeXFeatures.h"
17 #include "MathStream.h"
18 #include "MathParser.h"
19 #include "MetricsInfo.h"
26 InsetMathFont::InsetMathFont(latexkeys const * key)
27 : InsetMathNest(1), key_(key)
31 Inset * InsetMathFont::clone() const
33 return new InsetMathFont(*this);
37 InsetMath::mode_type InsetMathFont::currentMode() const
39 if (key_->extra == "mathmode")
41 if (key_->extra == "textmode")
43 return UNDECIDED_MODE;
47 void InsetMathFont::metrics(MetricsInfo & mi, Dimension & dim) const
49 FontSetChanger dummy(mi.base, key_->name);
50 cell(0).metrics(mi, dim);
52 // Cache the inset dimension.
57 void InsetMathFont::draw(PainterInfo & pi, int x, int y) const
59 FontSetChanger dummy(pi.base, key_->name.c_str());
60 cell(0).draw(pi, x + 1, y);
61 drawMarkers(pi, x, y);
62 setPosCache(pi, x, y);
66 void InsetMathFont::metricsT(TextMetricsInfo const & mi, Dimension &) const
70 cell(0).metricsT(mi, dim);
74 void InsetMathFont::drawT(TextPainter & pain, int x, int y) const
76 cell(0).drawT(pain, x, y);
80 docstring InsetMathFont::name() const
86 void InsetMathFont::validate(LaTeXFeatures & features) const
88 InsetMathNest::validate(features);
89 // Make sure amssymb is put in preamble if Blackboard Bold or
91 if (key_->name == "mathfrak" || key_->name == "mathbb")
92 features.require("amssymb");
93 if (key_->name == "text")
94 features.require("amsmath");
95 if (key_->name == "textipa")
96 features.require("tipa");
100 void InsetMathFont::infoize(odocstream & os) const
102 os << "Font: " << key_->name;