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, MathInsetTypes ot)
21 : MathInset(0, nm, 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());
38 font.setLatex(LyXFont::ON);
40 x += (lyxfont::width('I', font) + 3) / 4;
41 pain.text(x, y, name_, font);
46 void MathFuncInset::Write(std::ostream & os, bool /* fragile */) const
48 os << "\\" << name_ << ' ';
52 void MathFuncInset::WriteNormal(std::ostream & os) const
54 os << "[" << name_ << "] ";
58 void MathFuncInset::Metrics(MathStyles st)
60 LyXFont font = WhichFont(LM_TC_TEXTRM, size());
62 font.setLatex(LyXFont::ON);
66 width_ = lyxfont::width('M', font);
67 ascent_ = lyxfont::ascent('M', font);
70 width_ = lyxfont::width(name_, font) + lyxfont::width('I', font) / 2;
71 mathed_string_height(LM_TC_TEXTRM, size_, name_, ascent_, descent_);