5 #include "math_spaceinset.h"
9 #include "support/LOstream.h"
13 MathSpaceInset::MathSpaceInset(int sp)
18 MathInset * MathSpaceInset::clone() const
20 return new MathSpaceInset(*this);
24 void MathSpaceInset::draw(Painter & pain, int x, int y) const
27 // XPoint p[4] = {{++x, y-3}, {x, y}, {x+width-2, y}, {x+width-2, y-3}};
29 // Sadly, HP-UX CC can't handle that kind of initialization.
34 xp[0] = ++x; yp[0] = y - 3;
36 xp[2] = x + width_ - 2; yp[2] = y;
37 xp[3] = x + width_ - 2; yp[3] = y - 3;
39 pain.lines(xp, yp, 4, space_ ? LColor::latex : LColor::math);
43 void MathSpaceInset::write(std::ostream & os, bool /* fragile */) const
45 if (space_ >= 0 && space_ < 6)
46 os << '\\' << latex_mathspace[space_] << ' ';
50 void MathSpaceInset::writeNormal(std::ostream & os) const
52 os << "[space " << space_ << "] ";
56 void MathSpaceInset::metrics(MathStyles st) const
59 width_ = space_ ? space_ * 2 : 2;
70 void MathSpaceInset::incSpace()
72 space_ = (space_ + 1) % 6;