]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathKern.C
use more unicode in math
[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 void 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 }
53
54
55 int InsetMathKern::width() const
56 {
57         return wid_pix_;
58 }
59
60
61 void InsetMathKern::draw(PainterInfo &, int, int) const
62 {}
63
64
65 void InsetMathKern::write(WriteStream & os) const
66 {
67         os << "\\kern" << from_utf8(wid_.asLatexString()) << ' ';
68 }
69
70
71 void InsetMathKern::normalize(NormalStream & os) const
72 {
73         os << "[kern " << from_utf8(wid_.asLatexString()) << ']';
74 }
75
76
77 } // namespace lyx