3 #include "math_accentinset.h"
5 #include "math_parser.h"
8 MathAccentInset::MathAccentInset(byte cx, MathedTextCodes f, int cd, short st)
9 : MathedInset("", LM_OT_ACCENT, st), c(cx), fn(f), code(cd)
15 MathAccentInset::MathAccentInset(MathedInset *ins, int cd, short st)
16 : MathedInset("", LM_OT_ACCENT, st),
17 c(0), fn(LM_TC_MIN), code(cd), inset(ins) {}
20 MathAccentInset::~MathAccentInset()
26 MathedInset * MathAccentInset::Clone()
31 p = new MathAccentInset(inset->Clone(), code, GetStyle());
33 p = new MathAccentInset(c, fn, code, GetStyle());
40 MathAccentInset::draw(Painter & pain, int x, int y)
45 inset->draw(pain, x, y);
49 drawStr(pain, fn, size, x, y, s);
51 x += (code == LM_not) ? (width-dw) / 2 : 2;
52 mathed_draw_deco(pain, x, y - dy, dw, dh, code);
57 MathAccentInset::Metrics()
61 ascent = inset->Ascent();
62 descent = inset->Descent();
63 width = inset->Width();
66 mathed_char_height(fn, size, c, ascent, descent);
67 width = mathed_char_width(fn, size, c);
78 // if (MathIsBinary(fn))
79 // width += 2*mathed_char_width(fn, size, ' ');
83 void MathAccentInset::Write(ostream & os, bool fragile)
85 latexkeys * l = lm_get_key_by_id(code, LM_TK_ACCENT);
86 os << '\\' << l->name;
93 inset->Write(os, fragile);
95 if (fn>= LM_TC_RM && fn <= LM_TC_TEXTRM) {
97 << math_font_name[fn - LM_TC_RM]
100 if (MathIsSymbol(fn)) {
101 latexkeys * l = lm_get_key_by_id(c, LM_TK_SYM);
103 os << '\\' << l->name << ' ';
108 if (fn>= LM_TC_RM && fn<= LM_TC_TEXTRM)