]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathKern.C
Support lgathered and rgathered math environments
[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 "MathMLStream.h"
15 #include "MathStream.h"
16 #include "MathSupport.h"
17 #include "dimension.h"
18
19 using std::string;
20 using std::auto_ptr;
21
22
23 InsetMathKern::InsetMathKern()
24 {}
25
26
27 InsetMathKern::InsetMathKern(LyXLength const & w)
28         : wid_(w)
29 {}
30
31
32 InsetMathKern::InsetMathKern(string const & s)
33         : wid_(s)
34 {}
35
36
37 auto_ptr<InsetBase> InsetMathKern::doClone() const
38 {
39         return auto_ptr<InsetBase>(new InsetMathKern(*this));
40 }
41
42
43 void InsetMathKern::metrics(MetricsInfo & mi, Dimension & dim) const
44 {
45         wid_pix_ = wid_.inPixels(0, mathed_char_width(mi.base.font, 'M'));
46         dim.wid = wid_pix_;
47         dim.asc = 0;
48         dim.des = 0;
49 }
50
51
52 int InsetMathKern::width() const
53 {
54         return wid_pix_;
55 }
56
57
58 void InsetMathKern::draw(PainterInfo &, int, int) const
59 {}
60
61
62 void InsetMathKern::write(WriteStream & os) const
63 {
64         os << "\\kern" << wid_.asLatexString() << ' ';
65 }
66
67
68 void InsetMathKern::normalize(NormalStream & os) const
69 {
70         os << "[kern " << wid_.asLatexString() << ']';
71 }