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"
24 InsetMathFont::InsetMathFont(latexkeys const * key)
25 : InsetMathNest(1), key_(key)
29 Inset * InsetMathFont::clone() const
31 return new InsetMathFont(*this);
35 InsetMath::mode_type InsetMathFont::currentMode() const
37 if (key_->extra == "mathmode")
39 if (key_->extra == "textmode")
41 return UNDECIDED_MODE;
45 void InsetMathFont::metrics(MetricsInfo & mi, Dimension & dim) const
47 FontSetChanger dummy(mi.base, key_->name);
48 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
66 cell(0).metricsT(mi, dim);
70 void InsetMathFont::drawT(TextPainter & pain, int x, int y) const
72 cell(0).drawT(pain, x, y);
76 docstring InsetMathFont::name() const
82 void InsetMathFont::validate(LaTeXFeatures & features) const
84 InsetMathNest::validate(features);
85 // Make sure amssymb is put in preamble if Blackboard Bold or
87 if (key_->name == "mathfrak" || key_->name == "mathbb")
88 features.require("amssymb");
89 if (key_->name == "text")
90 features.require("amsmath");
91 if (key_->name == "textipa")
92 features.require("tipa");
96 void InsetMathFont::infoize(odocstream & os) const
98 os << "Font: " << key_->name;