#include "lyxfont.h"
#include "FontLoader.h"
#include "font.h"
+#include "math_cursor.h"
#include "math_defs.h"
#include "math_inset.h"
#include "math_parser.h"
#include "Painter.h"
#include "debug.h"
+#include "commandtags.h"
using std::map;
using std::endl;
void mathed_init_fonts()
{
- MathFonts = new LyXFont[FONT_NUM]; //DEC cxx cannot initialize all fonts
- //at once (JMarc) rc
-
- for (int i = 0 ; i < FONT_NUM ; ++i) {
- MathFonts[i] = LyXFont(LyXFont::ALL_SANE);
- }
+ MathFonts = new LyXFont[FONT_NUM];
MathFonts[FONT_IT].setShape(LyXFont::ITALIC_SHAPE);
case LM_TC_TT:
return MathFonts[FONT_TT];
+ case LM_TC_BOX:
case LM_TC_TEXTRM:
case LM_TC_CONST:
case LM_TC_TEX:
return MathFonts[1];
}
+
LyXFont const & whichFontBase(MathTextCodes type)
{
if (!MathFonts)
break;
}
- if (type != LM_TC_TEXTRM)
+ if (type != LM_TC_TEXTRM && type != LM_TC_BOX)
f.setColor(LColor::math);
if (type == LM_TC_TEX)
if (!font_available_initialized[type]) {
font_available_initialized[type] = true;
font_available[type] = fontloader.available(whichFontBaseIntern(type));
+ if (!font_available[type])
+ lyxerr[Debug::FONT] << "Math font " << type << " not available.\n";
}
return font_available[type];
}
};
-double const hline2[] = {
- 1, 0.1, 0.5, 0.3, 0.5,
- 1, 0.7, 0.5, 0.9, 0.5,
+double const ddot[] = {
+ 1, 0.2, 0.5, 0.3, 0.5,
+ 1, 0.7, 0.5, 0.8, 0.5,
+ 0
+};
+
+
+double const dddot[] = {
+ 1, 0.1, 0.5, 0.2, 0.5,
+ 1, 0.45, 0.5, 0.55, 0.5,
+ 1, 0.8, 0.5, 0.9, 0.5,
0
};
// Decorations
{"widehat", angle, 3 },
{"widetilde", tilde, 0 },
+ {"underbar", hline, 0 },
{"underline", hline, 0 },
{"overline", hline, 0 },
{"underbrace", brace, 1 },
{"overbrace", brace, 3 },
{"overleftarrow", arrow, 1 },
{"overrightarrow", arrow, 3 },
-
+ {"xleftarrow", arrow, 1 },
+ {"xrightarrow", arrow, 3 },
+ {"underleftarrow", arrow, 1 },
+ {"underrightarrow", arrow, 3 },
+
// Delimiters
{"(", parenth, 0 },
{")", parenth, 2 },
{"Updownarrow", Udarrow, 0 },
// Accents
- {"ddot", hline2, 0 },
+ {"ddot", ddot, 0 },
+ {"dddot", dddot, 0 },
{"hat", angle, 3 },
{"grave", slash, 1 },
{"acute", slash, 0 },
}
+void mathed_draw_framebox(Painter & pain, int x, int y, MathInset const * p)
+{
+ if (mathcursor && mathcursor->isInside(p))
+ pain.rectangle(x, y - p->ascent(), p->width(), p->height(),
+ LColor::mathframe);
+}
+
+
// In the future maybe we use a better fonts renderer
void drawStr(Painter & pain, MathTextCodes type, MathMetricsInfo const & siz,
int x, int y, string const & s)
};
+
char const * math_font_name(MathTextCodes code)
{
static char const * theFontNames[] = {
return theFontNames[code - LM_TC_RM];
return 0;
}
+
+string convertDelimToLatexName(string const & name)
+{
+ if (name == "(")
+ return name;
+ if (name == "[")
+ return name;
+ if (name == ".")
+ return name;
+ if (name == ")")
+ return name;
+ if (name == "]")
+ return name;
+ if (name == "/")
+ return name;
+ if (name == "|")
+ return name;
+ return "\\" + name + " ";
+}
+
+