]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathKern.cpp
811a0da3f9e9686fdcb61276873528420ed91b21
[lyx.git] / src / mathed / InsetMathKern.cpp
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.
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 InsetMathKern::InsetMathKern()
23 {
24 }
25
26
27 InsetMathKern::InsetMathKern(Length const & w)
28         : wid_(w)
29 {
30 }
31
32
33 InsetMathKern::InsetMathKern(docstring const & s)
34         : wid_(to_utf8(s))
35 {
36 }
37
38
39 Inset * InsetMathKern::clone() const
40 {
41         return new InsetMathKern(*this);
42 }
43
44
45 bool InsetMathKern::metrics(MetricsInfo & mi, Dimension & dim) const
46 {
47         dim.asc = 0;
48         dim.des = 0;
49         dim.wid = wid_.inPixels(0, mathed_char_width(mi.base.font, 'M'));
50         if (dim == dim_)
51                 return false;
52         dim_ = dim;
53         return true;
54 }
55
56
57 void InsetMathKern::draw(PainterInfo &, int, int) const
58 {}
59
60
61 void InsetMathKern::write(WriteStream & os) const
62 {
63         os << "\\kern" << from_utf8(wid_.asLatexString()) << ' ';
64 }
65
66
67 void InsetMathKern::normalize(NormalStream & os) const
68 {
69         os << "[kern " << from_utf8(wid_.asLatexString()) << ']';
70 }
71
72
73 } // namespace lyx