7 #include "math_funcinset.h"
11 #include "mathed/support.h"
12 #include "support/LOstream.h"
17 extern LyXFont WhichFont(short type, int size);
20 MathFuncInset::MathFuncInset(string const & nm, short ot)
23 lims_ = (GetType() == LM_OT_FUNCLIM);
27 MathInset * MathFuncInset::Clone() const
29 return new MathFuncInset(*this);
33 void MathFuncInset::draw(Painter & pain, int x, int y)
35 if (!name_.empty() && name_[0] > ' ') {
36 LyXFont font = WhichFont(LM_TC_TEXTRM, size());
37 font.setLatex(LyXFont::ON);
38 x += (lyxfont::width('I', font) + 3) / 4;
39 pain.text(x, y, name_, font);
44 void MathFuncInset::Write(std::ostream & os, bool /* fragile */) const
46 os << "\\" << name_ << ' ';
50 void MathFuncInset::WriteNormal(std::ostream & os) const
52 os << "[" << name_ << "] ";
56 void MathFuncInset::Metrics(MathStyles st)
58 LyXFont font = WhichFont(LM_TC_TEXTRM, size());
59 font.setLatex(LyXFont::ON);
62 width_ = lyxfont::width('M', font);
63 ascent_ = lyxfont::ascent('M', font);
66 width_ = lyxfont::width(name_, font) + lyxfont::width('I', font) / 2;
67 mathed_string_height(LM_TC_TEXTRM, size_, name_, ascent_, descent_);
72 bool MathFuncInset::GetLimits() const
74 return lims_ && (size() == LM_ST_DISPLAY);