]> git.lyx.org Git - lyx.git/blob - src/mathed/math_fontinset.C
small up/down tweaking
[lyx.git] / src / mathed / math_fontinset.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "math_fontinset.h"
8 #include "math_mathmlstream.h"
9 #include "math_streamstr.h"
10 #include "math_support.h"
11 #include "math_parser.h"
12 #include "LaTeXFeatures.h"
13 #include "support/LOstream.h"
14 #include "textpainter.h"
15
16
17
18 MathFontInset::MathFontInset(latexkeys const * key)
19         : MathNestInset(1), key_(key)
20 {}
21
22
23 MathInset * MathFontInset::clone() const
24 {
25         return new MathFontInset(*this);
26 }
27
28
29 MathInset::mode_type MathFontInset::currentMode() const
30 {
31         if (key_->extra == "mathmode")
32                 return MATH_MODE;
33         if (key_->extra == "textmode")
34                 return TEXT_MODE;
35         return UNDECIDED_MODE;
36 }
37
38
39 void MathFontInset::metrics(MathMetricsInfo & mi) const
40 {
41         MathFontSetChanger dummy(mi.base, key_->name.c_str());
42         dim_ = cell(0).metrics(mi);
43         metricsMarkers();
44 }
45
46
47 void MathFontInset::draw(MathPainterInfo & pi, int x, int y) const
48 {
49         MathFontSetChanger dummy(pi.base, key_->name.c_str());
50         cell(0).draw(pi, x + 1, y);
51         drawMarkers(pi, x, y);
52 }
53
54
55 void MathFontInset::metricsT(TextMetricsInfo const & mi) const
56 {
57         dim_ = cell(0).metricsT(mi);
58 }
59
60
61 void MathFontInset::drawT(TextPainter & pain, int x, int y) const
62 {
63         cell(0).drawT(pain, x, y);
64 }
65
66
67 string MathFontInset::name() const
68 {
69         return key_->name;
70 }
71
72
73 void MathFontInset::validate(LaTeXFeatures & features) const
74 {
75         MathNestInset::validate(features);
76         // Make sure amssymb is put in preamble if Blackboard Bold or
77         // Fraktur used:
78         if (key_->name == "mathfrak" || key_->name == "mathbb")
79                 features.require("amssymb");
80 }
81
82
83 void MathFontInset::infoize(std::ostream & os) const
84 {
85         os << "Font: " << key_->name;
86 }