A bit more re-organization.
[lyx.git] / src / mathed / InsetMathKern.cpp
blob7f990f996842ff99068b19794feb5d72186a6695
1 /**
2 * \file InsetMathKern.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author André Pönitz
8 * Full author contact details are available in file CREDITS.
9 */
11 #include <config.h>
13 #include "InsetMathKern.h"
14 #include "MathStream.h"
15 #include "MathStream.h"
16 #include "MathSupport.h"
17 #include "Dimension.h"
19 #include "support/docstring.h"
21 namespace lyx {
23 InsetMathKern::InsetMathKern()
28 InsetMathKern::InsetMathKern(Length const & w)
29 : wid_(w)
34 InsetMathKern::InsetMathKern(docstring const & s)
35 : wid_(to_utf8(s))
40 Inset * InsetMathKern::clone() const
42 return new InsetMathKern(*this);
46 void InsetMathKern::metrics(MetricsInfo & mi, Dimension & dim) const
48 dim.asc = 0;
49 dim.des = 0;
50 dim.wid = wid_.inPixels(0, mathed_char_width(mi.base.font, 'M'));
54 void InsetMathKern::draw(PainterInfo &, int, int) const
58 void InsetMathKern::write(WriteStream & os) const
60 if (wid_.empty())
61 os << "\\kern" << ' ';
62 else
63 os << "\\kern" << from_utf8(wid_.asLatexString()) << ' ';
67 void InsetMathKern::normalize(NormalStream & os) const
69 if (wid_.empty())
70 os << "[kern]";
71 else
72 os << "[kern " << from_utf8(wid_.asLatexString()) << ']';
76 } // namespace lyx