2 #include "math_stackrelinset.h"
3 #include "math_mathmlstream.h"
4 #include "math_support.h"
10 MathStackrelInset::MathStackrelInset()
14 MathInset * MathStackrelInset::clone() const
16 return new MathStackrelInset(*this);
20 void MathStackrelInset::metrics(MetricsInfo & mi) const
23 FracChanger dummy(mi.base);
25 dim_.wid = max(cell(0).width(), cell(1).width()) + 4;
26 dim_.asc = cell(1).ascent() + cell(0).height() + 4;
27 dim_.des = cell(1).descent();
31 void MathStackrelInset::draw(PainterInfo & pi, int x, int y) const
33 int m = x + width() / 2;
34 int yo = y - cell(1).ascent() - cell(0).descent() - 1;
35 cell(1).draw(pi, m - cell(1).width() / 2, y);
36 FracChanger dummy(pi.base);
37 cell(0).draw(pi, m - cell(0).width() / 2, yo);
41 void MathStackrelInset::write(WriteStream & os) const
43 os << "\\stackrel{" << cell(0) << "}{" << cell(1) << '}';
47 void MathStackrelInset::normalize(NormalStream & os) const
49 os << "[stackrel " << cell(0) << ' ' << cell(1) << ']';