]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathKern.cpp
Fix functions that used functions but did not defined it
[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
15 #include "MathStream.h"
16 #include "MathSupport.h"
17
18 #include "Dimension.h"
19 #include "MetricsInfo.h"
20
21 #include "support/docstring.h"
22
23 namespace lyx {
24
25 InsetMathKern::InsetMathKern(Buffer * buf)
26         : InsetMath(buf)
27 {
28 }
29
30
31 InsetMathKern::InsetMathKern(Buffer * buf, Length const & w)
32         : InsetMath(buf), wid_(w)
33 {
34 }
35
36
37 InsetMathKern::InsetMathKern(Buffer * buf, docstring const & s)
38         : InsetMath(buf), wid_(to_utf8(s))
39 {
40 }
41
42
43 Inset * InsetMathKern::clone() const
44 {
45         return new InsetMathKern(*this);
46 }
47
48
49 void InsetMathKern::metrics(MetricsInfo & mi, Dimension & dim) const
50 {
51         dim.asc = 0;
52         dim.des = 0;
53         dim.wid = mi.base.inPixels(wid_);
54 }
55
56
57 void InsetMathKern::draw(PainterInfo &, int, int) const
58 {}
59
60
61 void InsetMathKern::write(TeXMathStream & os) const
62 {
63         if (wid_.empty())
64                 os << "\\kern" << ' ';
65         else if (wid_.unit() == Length::MU)
66                 os << "\\mkern" << from_utf8(wid_.asLatexString()) << ' ';
67         else
68                 os << "\\kern" << from_utf8(wid_.asLatexString()) << ' ';
69 }
70
71
72 void InsetMathKern::normalize(NormalStream & os) const
73 {
74         if (wid_.empty())
75                 os << "[kern]";
76         else
77                 os << "[kern " << from_utf8(wid_.asLatexString()) << ']';
78 }
79
80
81 void InsetMathKern::infoize2(odocstream & os) const
82 {
83         os << "Kern";
84         if (!wid_.empty())
85                 os << ": " << from_utf8(wid_.asLatexString());
86 }
87
88
89 } // namespace lyx