5 #include "math_stackrelinset.h"
6 #include "math_mathmlstream.h"
7 #include "math_support.h"
13 MathStackrelInset::MathStackrelInset()
17 MathInset * MathStackrelInset::clone() const
19 return new MathStackrelInset(*this);
23 void MathStackrelInset::metrics(MathMetricsInfo & mi) const
26 MathFracChanger dummy(mi.base);
28 dim_.w = max(xcell(0).width(), xcell(1).width()) + 4;
29 dim_.a = xcell(1).ascent() + xcell(0).height() + 4;
30 dim_.d = xcell(1).descent();
34 void MathStackrelInset::draw(MathPainterInfo & pi, int x, int y) const
36 int m = x + width() / 2;
37 int yo = y - xcell(1).ascent() - xcell(0).descent() - 1;
38 xcell(1).draw(pi, m - xcell(1).width() / 2, y);
39 MathFracChanger dummy(pi.base);
40 xcell(0).draw(pi, m - xcell(0).width() / 2, yo);
44 void MathStackrelInset::write(WriteStream & os) const
46 os << "\\stackrel{" << cell(0) << "}{" << cell(1) << '}';
50 void MathStackrelInset::normalize(NormalStream & os) const
52 os << "[stackrel " << cell(0) << ' ' << cell(1) << ']';