2 * \file InsetMathBoldSymbol.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 "InsetMathBoldSymbol.h"
15 #include "MathStream.h"
17 #include "MetricsInfo.h"
18 #include "LaTeXFeatures.h"
25 InsetMathBoldSymbol::InsetMathBoldSymbol(Buffer * buf, Kind kind)
26 : InsetMathNest(buf, 1), kind_(kind)
30 Inset * InsetMathBoldSymbol::clone() const
32 return new InsetMathBoldSymbol(*this);
36 docstring InsetMathBoldSymbol::name() const
40 return from_ascii("boldsymbol");
42 return from_ascii("bm");
44 return from_ascii("hm");
46 // avoid compiler warning
51 void InsetMathBoldSymbol::metrics(MetricsInfo & mi, Dimension & dim) const
53 Changer dummy = mi.base.changeEnsureMath();
54 //Changer dummy = mi.base.changeFontSet("mathbf");
55 cell(0).metrics(mi, dim);
56 ++dim.wid; // for 'double stroke'
60 void InsetMathBoldSymbol::draw(PainterInfo & pi, int x, int y) const
62 Changer dummy = pi.base.changeEnsureMath();
63 //Changer dummy = pi.base.changeFontSet("mathbf");
64 cell(0).draw(pi, x, y);
65 cell(0).draw(pi, x + 1, y);
69 void InsetMathBoldSymbol::metricsT(TextMetricsInfo const & mi, Dimension & /*dim*/) const
73 cell(0).metricsT(mi, dim);
77 void InsetMathBoldSymbol::drawT(TextPainter & pain, int x, int y) const
79 cell(0).drawT(pain, x, y);
83 void InsetMathBoldSymbol::validate(LaTeXFeatures & features) const
85 InsetMathNest::validate(features);
86 if (kind_ == AMS_BOLD)
87 features.require("amsbsy");
89 features.require("bm");
93 void InsetMathBoldSymbol::write(TeXMathStream & os) const
95 MathEnsurer ensurer(os);
98 os << "\\boldsymbol{" << cell(0) << "}";
101 os << "\\bm{" << cell(0) << "}";
104 os << "\\hm{" << cell(0) << "}";
110 void InsetMathBoldSymbol::mathmlize(MathMLStream & ms) const
112 ms << MTagInline("mstyle", "mathvariant='bold'")
114 << ETagInline("mstyle");
118 void InsetMathBoldSymbol::htmlize(HtmlStream & os) const
120 os << MTag("b") << cell(0) << ETag("b");
124 void InsetMathBoldSymbol::infoize(odocstream & os) const
131 os << "Boldsymbol (bm)";
134 os << "Heavysymbol (bm)";