7 #include "math_decorationinset.h"
8 #include "mathed/support.h"
9 #include "math_parser.h"
10 #include "support/LOstream.h"
11 #include "support/lstrings.h"
17 MathDecorationInset::MathDecorationInset(int d)
18 : MathInset(1), deco_(d)
20 upper_ = deco_ != LM_underline && deco_ != LM_underbrace;
24 MathInset * MathDecorationInset::clone() const
26 return new MathDecorationInset(*this);
31 void MathDecorationInset::Metrics(MathStyles st)
34 width_ = xcell(0).width();
35 ascent_ = xcell(0).ascent();
36 descent_ = xcell(0).descent();
38 dh_ = mathed_char_height(LM_TC_VAR, size(), 'I', ascent_, descent_);
49 void MathDecorationInset::draw(Painter & pain, int x, int y)
53 xcell(0).draw(pain, x, y);
54 mathed_draw_deco(pain, x, y + dy_, width_, dh_, deco_);
58 void MathDecorationInset::Write(ostream & os, bool fragile) const
60 latexkeys const * l = lm_get_key_by_id(deco_, LM_TK_WIDE);
62 (compare(l->name, "overbrace") == 0 ||
63 compare(l->name, "underbrace") == 0 ||
64 compare(l->name, "overleftarrow") == 0 ||
65 compare(l->name, "overrightarrow") == 0))
67 os << '\\' << l->name << '{';
68 cell(0).Write(os, fragile);