7 #include "math_charinset.h"
10 #include "support/LOstream.h"
11 #include "mathed/support.h"
12 #include "math_parser.h"
16 MathCharInset::MathCharInset(char c)
17 : char_(c), code_(nativeCode(c))
24 MathCharInset::MathCharInset(char c, MathTextCodes t)
25 : char_(c), code_((t == LM_TC_MIN) ? nativeCode(c) : t)
29 MathTextCodes MathCharInset::nativeCode(char c) const
37 MathInset * MathCharInset::clone() const
39 return new MathCharInset(*this);
43 int MathCharInset::ascent() const
45 return mathed_char_ascent(code_, size(), char_);
49 int MathCharInset::descent() const
51 return mathed_char_descent(code_, size(), char_);
55 int MathCharInset::width() const
57 return mathed_char_width(code_, size(), char_);
61 void MathCharInset::metrics(MathStyles st) const
67 void MathCharInset::draw(Painter & pain, int x, int y) const
71 drawChar(pain, code_, size_, x, y, char_);
75 void MathCharInset::writeHeader(std::ostream & os) const
77 if (code_ >= LM_TC_RM && code_ <= LM_TC_TEXTRM)
78 os << '\\' << math_font_name[code_ - LM_TC_RM] << '{';
82 void MathCharInset::writeTrailer(std::ostream & os) const
84 if (code_ >= LM_TC_RM && code_ <= LM_TC_TEXTRM)
89 void MathCharInset::writeRaw(std::ostream & os) const
95 void MathCharInset::write(std::ostream & os, bool) const
103 void MathCharInset::writeNormal(std::ostream & os) const
109 bool MathCharInset::isRelOp() const
111 return char_ == '=' || char_ == '<' || char_ == '>';
115 void MathCharInset::handleFont(MathTextCodes t)
117 code_ = (code_ == t) ? LM_TC_VAR : t;