5 #include "math_spaceinset.h"
8 #include "support/LOstream.h"
11 MathSpaceInset::MathSpaceInset(int sp)
16 MathInset * MathSpaceInset::clone() const
18 return new MathSpaceInset(*this);
22 void MathSpaceInset::draw(Painter & pain, int x, int y)
25 // XPoint p[4] = {{++x, y-3}, {x, y}, {x+width-2, y}, {x+width-2, y-3}};
27 // Sadly, HP-UX CC can't handle that kind of initialization.
32 xp[0] = ++x; yp[0] = y - 3;
34 xp[2] = x + width_ - 2; yp[2] = y;
35 xp[3] = x + width_ - 2; yp[3] = y - 3;
37 pain.lines(xp, yp, 4, space_ ? LColor::latex : LColor::math);
41 void MathSpaceInset::write(std::ostream & os, bool /* fragile */) const
43 if (space_ >= 0 && space_ < 6)
44 os << '\\' << latex_mathspace[space_] << ' ';
48 void MathSpaceInset::writeNormal(std::ostream & os) const
50 os << "[space " << space_ << "] ";
54 void MathSpaceInset::metrics(MathStyles st)
57 width_ = space_ ? space_ * 2 : 2;
68 void MathSpaceInset::incSpace()
70 space_ = (space_ + 1) % 6;