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 "LaTeXFeatures.h"
24 InsetMathBoldSymbol::InsetMathBoldSymbol(Buffer
* buf
, Kind kind
)
25 : InsetMathNest(buf
, 1), kind_(kind
)
29 Inset
* InsetMathBoldSymbol::clone() const
31 return new InsetMathBoldSymbol(*this);
35 docstring
InsetMathBoldSymbol::name() const
39 return from_ascii("boldsymbol");
41 return from_ascii("bm");
43 return from_ascii("hm");
45 // avoid compiler warning
50 void InsetMathBoldSymbol::metrics(MetricsInfo
& mi
, Dimension
& dim
) const
52 //FontSetChanger dummy(mi.base, "mathbf");
53 cell(0).metrics(mi
, dim
);
55 ++dim
.wid
; // for 'double stroke'
59 void InsetMathBoldSymbol::draw(PainterInfo
& pi
, int x
, int y
) const
61 //FontSetChanger dummy(pi.base, "mathbf");
62 cell(0).draw(pi
, x
+ 1, y
);
63 cell(0).draw(pi
, x
+ 2, y
);
64 drawMarkers(pi
, x
, y
);
68 void InsetMathBoldSymbol::metricsT(TextMetricsInfo
const & mi
, Dimension
& /*dim*/) const
72 cell(0).metricsT(mi
, dim
);
76 void InsetMathBoldSymbol::drawT(TextPainter
& pain
, int x
, int y
) const
78 cell(0).drawT(pain
, x
, y
);
82 void InsetMathBoldSymbol::validate(LaTeXFeatures
& features
) const
84 InsetMathNest::validate(features
);
85 if (kind_
== AMS_BOLD
)
86 features
.require("amsbsy");
88 features
.require("bm");
92 void InsetMathBoldSymbol::write(WriteStream
& os
) const
94 MathEnsurer
ensurer(os
);
97 os
<< "\\boldsymbol{" << cell(0) << "}";
100 os
<< "\\bm{" << cell(0) << "}";
103 os
<< "\\hm{" << cell(0) << "}";
109 void InsetMathBoldSymbol::infoize(odocstream
& os
) const
116 os
<< "Boldsymbol (bm)";
119 os
<< "Heavysymbol (bm)";