]> git.lyx.org Git - lyx.git/blob - src/mathed/math_kerninset.C
try to fix rounding errors
[lyx.git] / src / mathed / math_kerninset.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "math_kerninset.h"
8 #include "math_extern.h"
9 #include "math_mathmlstream.h"
10 #include "math_streamstr.h"
11 #include "math_support.h"
12 #include "lyxrc.h"
13
14
15 MathKernInset::MathKernInset()
16 {}
17
18
19 MathKernInset::MathKernInset(LyXLength const & w)
20         : wid_(w)
21 {}
22
23
24 MathKernInset::MathKernInset(string const & s)
25         : wid_(s)
26 {}
27
28
29 MathInset * MathKernInset::clone() const
30 {
31         return new MathKernInset(*this);
32 }
33
34
35 void MathKernInset::metrics(MathMetricsInfo & /*mi*/) const
36 {
37 #ifdef WITH_WARNINGS
38 #warning fix this once the interface to LyXLength has improved
39 #endif
40         // this uses the numerical valu in pixels, even if the unit is cm or ex!
41         width_   = static_cast<int>(wid_.value());
42         width_   = (width_*static_cast<int>(lyxrc.zoom))/150;
43         ascent_  = 0;
44         descent_ = 0;
45         //cerr << "handling kern of width " << wid_.value() << "\n";
46 }
47
48
49 void MathKernInset::draw(MathPainterInfo &, int, int) const
50 {}
51
52
53 void MathKernInset::write(WriteStream & os) const
54 {
55         os << "\\kern" << wid_.asLatexString() << " ";
56 }
57
58
59 void MathKernInset::normalize(NormalStream & os) const
60 {
61         os << "[kern " << wid_.asLatexString() << "]";
62 }