]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathKern.C
Almost fix 'make check'. The only remaining problem is an undefined
[lyx.git] / src / mathed / InsetMathKern.C
1 /**
2  * \file InsetMathKern.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "InsetMathKern.h"
14 #include "MathStream.h"
15 #include "MathStream.h"
16 #include "MathSupport.h"
17 #include "dimension.h"
18
19
20 namespace lyx {
21
22 using std::string;
23 using std::auto_ptr;
24
25
26 InsetMathKern::InsetMathKern()
27 {}
28
29
30 InsetMathKern::InsetMathKern(LyXLength const & w)
31         : wid_(w)
32 {}
33
34
35 InsetMathKern::InsetMathKern(docstring const & s)
36         : wid_(to_utf8(s))
37 {}
38
39
40 auto_ptr<InsetBase> InsetMathKern::doClone() const
41 {
42         return auto_ptr<InsetBase>(new InsetMathKern(*this));
43 }
44
45
46 bool InsetMathKern::metrics(MetricsInfo & mi, Dimension & dim) const
47 {
48         wid_pix_ = wid_.inPixels(0, mathed_char_width(mi.base.font, 'M'));
49         dim.wid = wid_pix_;
50         dim.asc = 0;
51         dim.des = 0;
52         if (dim_ == dim)
53                 return false;
54         dim_ = dim;
55         return true;
56 }
57
58
59 int InsetMathKern::width() const
60 {
61         return wid_pix_;
62 }
63
64
65 void InsetMathKern::draw(PainterInfo &, int, int) const
66 {}
67
68
69 void InsetMathKern::write(WriteStream & os) const
70 {
71         os << "\\kern" << from_utf8(wid_.asLatexString()) << ' ';
72 }
73
74
75 void InsetMathKern::normalize(NormalStream & os) const
76 {
77         os << "[kern " << from_utf8(wid_.asLatexString()) << ']';
78 }
79
80
81 } // namespace lyx