]> git.lyx.org Git - lyx.git/blob - src/mathed/math_unknowninset.C
font_metrics part 1
[lyx.git] / src / mathed / math_unknowninset.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "math_unknowninset.h"
8 #include "frontends/Painter.h"
9 #include "math_support.h"
10 #include "math_mathmlstream.h"
11 #include "math_streamstr.h"
12
13
14 extern LyXFont WhichFont(short type, int size);
15
16
17 MathUnknownInset::MathUnknownInset(string const & nm)
18         : name_(nm)
19 {}
20
21
22 MathInset * MathUnknownInset::clone() const
23 {
24         return new MathUnknownInset(*this);
25 }
26
27
28 string const & MathUnknownInset::name() const
29 {
30         return name_;
31 }
32
33
34 void MathUnknownInset::setName(string const & n)
35 {
36         name_ = n;
37 }
38
39
40 bool MathUnknownInset::match(MathInset * p) const
41 {
42         MathUnknownInset const * q = p->asUnknownInset();
43         return q && name_ == q->name_;
44 }
45
46
47 void MathUnknownInset::write(WriteStream & os) const
48 {
49         os << "\\" << name_ << ' ';
50 }
51
52
53 void MathUnknownInset::normalize(NormalStream & os) const
54 {
55         os << "[unknown " << name_ << ']';
56 }
57
58
59 void MathUnknownInset::metrics(MathMetricsInfo const & mi) const
60 {
61         whichFont(font_, LM_TC_TEX, mi);
62         mathed_string_dim(font_, name_, ascent_, descent_, width_);
63 }
64
65
66 void MathUnknownInset::draw(Painter & pain, int x, int y) const
67 {
68         drawStr(pain, font_, x, y, name_);
69 }
70
71
72 void MathUnknownInset::maplize(MapleStream & os) const
73 {
74         os << name_;
75 }
76
77
78 void MathUnknownInset::mathmlize(MathMLStream & os) const
79 {
80         os << MTag("mi") << name_ << ETag("mi");
81 }
82
83
84 void MathUnknownInset::octavize(OctaveStream & os) const
85 {
86         os << name_;
87 }