7 #include "math_sqrtinset.h"
11 #include "support/LOstream.h"
14 MathSqrtInset::MathSqrtInset()
15 : MathInset("sqrt", LM_OT_SQRT, 1)
19 MathInset * MathSqrtInset::clone() const
21 return new MathSqrtInset(*this);
25 void MathSqrtInset::Metrics(MathStyles st)
29 ascent_ = xcell(0).ascent() + 4;
30 descent_ = xcell(0).descent() + 2;
31 width_ = xcell(0).width() + 12;
35 void MathSqrtInset::draw(Painter & pain, int x, int y)
39 xcell(0).draw(pain, x + 10, y);
40 int const a = ascent_;
41 int const d = descent_;
44 xp[0] = x + width_; yp[0] = y - a + 1;
45 xp[1] = x + 8; yp[1] = y - a + 1;
46 xp[2] = x + 5; yp[2] = y + d - 1;
47 xp[3] = x; yp[3] = y + (d - a)/2;
48 pain.lines(xp, yp, 4, LColor::mathline);
52 void MathSqrtInset::Write(std::ostream & os, bool fragile) const
54 os << '\\' << name_ << '{';
55 cell(0).Write(os, fragile);
60 void MathSqrtInset::WriteNormal(std::ostream & os) const
63 cell(0).WriteNormal(os);