3 #include "math_funcinset.h"
7 #include "mathed/support.h"
8 #include "support/LOstream.h"
13 extern LyXFont WhichFont(short type, int size);
15 MathFuncInset::~MathFuncInset()
19 bool MathFuncInset::GetLimits() const
21 return bool(lims && (GetStyle() == LM_ST_DISPLAY));
25 void MathFuncInset::Write(std::ostream & os, bool /* fragile */)
27 os << "\\" << name << ' ';
31 MathFuncInset::MathFuncInset(string const & nm, short ot, short st)
32 : MathedInset("", ot, st)
35 lims = (GetType() == LM_OT_FUNCLIM);
36 if (GetType() == LM_OT_UNDEF) {
46 MathedInset * MathFuncInset::Clone()
48 return new MathFuncInset(name, GetType(), GetStyle());
54 MathFuncInset::draw(Painter & pain, int x, int y)
56 if (!name.empty() && name[0] > ' ') {
57 LyXFont font = WhichFont(LM_TC_TEXTRM, size());
58 font.setLatex(LyXFont::ON);
59 x += (lyxfont::width('I', font) + 3) / 4;
60 pain.text(x, y, name, font);
66 void MathFuncInset::Metrics()
68 //ln = (name) ? strlen(name): 0;
69 LyXFont font = WhichFont(LM_TC_TEXTRM, size());
70 font.setLatex(LyXFont::ON);
76 width = lyxfont::width(name, font)
77 + lyxfont::width('I', font) / 2;
78 mathed_string_height(LM_TC_TEXTRM, size(), name, ascent, descent);