3 #include "math_accentinset.h"
4 #include "mathed/support.h"
5 #include "math_parser.h"
6 #include "support/LOstream.h"
10 MathAccentInset::MathAccentInset(byte cx, MathedTextCodes f, int cd, short st)
11 : MathedInset("", LM_OT_ACCENT, st), c(cx), fn(f), code(cd)
17 MathAccentInset::MathAccentInset(MathedInset *ins, int cd, short st)
18 : MathedInset("", LM_OT_ACCENT, st),
19 c(0), fn(LM_TC_MIN), code(cd), inset(ins) {}
22 MathAccentInset::~MathAccentInset()
28 MathedInset * MathAccentInset::Clone()
33 p = new MathAccentInset(inset->Clone(), code, GetStyle());
35 p = new MathAccentInset(c, fn, code, GetStyle());
42 MathAccentInset::draw(Painter & pain, int x, int y)
47 inset->draw(pain, x, y);
51 drawStr(pain, fn, size, x, y, s);
53 x += (code == LM_not) ? (width-dw) / 2 : 2;
54 mathed_draw_deco(pain, x, y - dy, dw, dh, code);
59 MathAccentInset::Metrics()
63 ascent = inset->Ascent();
64 descent = inset->Descent();
65 width = inset->Width();
68 mathed_char_height(fn, size, c, ascent, descent);
69 width = mathed_char_width(fn, size, c);
80 // if (MathIsBinary(fn))
81 // width += 2*mathed_char_width(fn, size, ' ');
85 void MathAccentInset::Write(ostream & os, bool fragile)
87 latexkeys * l = lm_get_key_by_id(code, LM_TK_ACCENT);
88 os << '\\' << l->name;
95 inset->Write(os, fragile);
97 if (fn>= LM_TC_RM && fn <= LM_TC_TEXTRM) {
99 << math_font_name[fn - LM_TC_RM]
102 if (MathIsSymbol(fn)) {
103 latexkeys * l = lm_get_key_by_id(c, LM_TK_SYM);
105 os << '\\' << l->name << ' ';
110 if (fn>= LM_TC_RM && fn<= LM_TC_TEXTRM)