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, short st)
21 : MathedInset(nm, ot, st)
23 lims_ = (GetType() == LM_OT_FUNCLIM);
27 MathedInset * MathFuncInset::Clone()
29 return new MathFuncInset(name, GetType(), GetStyle());
34 MathFuncInset::draw(Painter & pain, int x, int y)
36 if (!name.empty() && name[0] > ' ') {
37 LyXFont font = WhichFont(LM_TC_TEXTRM, size());
38 font.setLatex(LyXFont::ON);
39 x += (lyxfont::width('I', font) + 3) / 4;
40 pain.text(x, y, name, font);
45 void MathFuncInset::Write(std::ostream & os, bool /* fragile */)
47 os << "\\" << name << ' ';
51 void MathFuncInset::Metrics()
53 LyXFont font = WhichFont(LM_TC_TEXTRM, size());
54 font.setLatex(LyXFont::ON);
60 width = lyxfont::width(name, font)
61 + lyxfont::width('I', font) / 2;
62 mathed_string_height(LM_TC_TEXTRM, size(),
63 name, ascent, descent);
68 bool MathFuncInset::GetLimits() const
70 return bool(lims_ && (GetStyle() == LM_ST_DISPLAY));