5 #include "math_funcinset.h"
8 #include "mathed/support.h"
9 #include "support/LOstream.h"
14 extern LyXFont WhichFont(short type, int size);
17 MathFuncInset::MathFuncInset(string const & nm, MathInsetTypes ot)
18 : MathInset(0, nm, ot)
20 lims_ = (GetType() == LM_OT_FUNCLIM);
24 MathInset * MathFuncInset::clone() const
26 return new MathFuncInset(*this);
30 void MathFuncInset::draw(Painter & pain, int x, int y)
32 if (!name_.empty() && name_[0] > ' ') {
33 LyXFont font = WhichFont(LM_TC_TEXTRM, size());
35 font.setLatex(LyXFont::ON);
37 x += (lyxfont::width('I', font) + 3) / 4;
38 pain.text(x, y, name_, font);
43 void MathFuncInset::Write(std::ostream & os, bool /* fragile */) const
45 os << "\\" << name_ << ' ';
49 void MathFuncInset::WriteNormal(std::ostream & os) const
51 os << "[" << name_ << "] ";
55 void MathFuncInset::Metrics(MathStyles st, int, int)
57 LyXFont font = WhichFont(LM_TC_TEXTRM, size());
59 font.setLatex(LyXFont::ON);
63 width_ = lyxfont::width('M', font);
64 ascent_ = lyxfont::ascent('M', font);
67 width_ = lyxfont::width(name_, font) + lyxfont::width('I', font) / 2;
68 mathed_string_height(LM_TC_TEXTRM, size_, name_, ascent_, descent_);