}
-LyXFont whichFont(MathTextCodes type, MathMetricsInfo const & size)
+void whichFont(LyXFont & f, MathTextCodes type, MathMetricsInfo const & size)
{
- LyXFont f = whichFontBase(type);
+ f = whichFontBase(type);
// use actual size
f.setSize(size.font.size());
if (type == LM_TC_TEX)
f.setColor(LColor::latex);
-
- return f;
}
} // namespace
};
-double const hline2[] = {
+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
+};
+
+
double const hline3[] = {
1, 0.1, 0, 0.15, 0,
1, 0.475, 0, 0.525, 0,
{"overbrace", brace, 3 },
{"overleftarrow", arrow, 1 },
{"overrightarrow", arrow, 3 },
+ {"overleftrightarrow", udarrow, 1 },
{"xleftarrow", arrow, 1 },
{"xrightarrow", arrow, 3 },
{"underleftarrow", arrow, 1 },
{"underrightarrow", arrow, 3 },
+ {"underleftrightarrow",udarrow, 1 },
// Delimiters
{"(", parenth, 0 },
{"Updownarrow", Udarrow, 0 },
// Accents
- {"ddot", hline2, 0 },
+ {"ddot", ddot, 0 },
+ {"dddot", dddot, 0 },
{"hat", angle, 3 },
{"grave", slash, 1 },
{"acute", slash, 0 },
void mathed_char_dim(MathTextCodes type, MathMetricsInfo const & size,
unsigned char c, int & asc, int & des, int & wid)
{
- LyXFont const font = whichFont(type, size);
+ LyXFont font;
+ whichFont(font, type, size);
des = lyxfont::descent(c, font);
asc = lyxfont::ascent(c, font);
wid = mathed_char_width(type, size, c);
int mathed_char_height(MathTextCodes type, MathMetricsInfo const & size,
unsigned char c, int & asc, int & des)
{
- LyXFont const font = whichFont(type, size);
+ LyXFont font;
+ whichFont(font, type, size);
des = lyxfont::descent(c, font);
asc = lyxfont::ascent(c, font);
return asc + des;
int mathed_char_ascent(MathTextCodes type, MathMetricsInfo const & size,
unsigned char c)
{
- LyXFont const font = whichFont(type, size);
+ LyXFont font;
+ whichFont(font, type, size);
return lyxfont::ascent(c, font);
}
int mathed_char_descent(MathTextCodes type, MathMetricsInfo const & size,
unsigned char c)
{
- LyXFont const font = whichFont(type, size);
+ LyXFont font;
+ whichFont(font, type, size);
return lyxfont::descent(c, font);
}
int mathed_char_width(MathTextCodes type, MathMetricsInfo const & size,
unsigned char c)
{
- LyXFont const font = whichFont(type, size);
+ LyXFont font;
+ whichFont(font, type, size);
if (isBinaryOp(c, type))
return lyxfont::width(c, font) + 2 * lyxfont::width(' ', font);
else
int mathed_string_height(MathTextCodes type, MathMetricsInfo const & size,
string const & s, int & asc, int & des)
{
- LyXFont const font = whichFont(type, size);
+ LyXFont font;
+ whichFont(font, type, size);
asc = des = 0;
for (string::const_iterator it = s.begin(); it != s.end(); ++it) {
des = max(des, lyxfont::descent(*it, font));
int mathed_string_width(MathTextCodes type, MathMetricsInfo const & size,
string const & s)
{
- return lyxfont::width(s, whichFont(type, size));
+ LyXFont font;
+ whichFont(font, type, size);
+ return lyxfont::width(s, font);
}
int mathed_string_ascent(MathTextCodes type, MathMetricsInfo const & size,
string const & s)
{
- LyXFont const font = whichFont(type, size);
+ LyXFont font;
+ whichFont(font, type, size);
int asc = 0;
for (string::const_iterator it = s.begin(); it != s.end(); ++it)
asc = max(asc, lyxfont::ascent(*it, font));
int mathed_string_descent(MathTextCodes type, MathMetricsInfo const & size,
string const & s)
{
- LyXFont const font = whichFont(type, size);
+ LyXFont font;
+ whichFont(font, type, size);
int des = 0;
for (string::const_iterator it = s.begin(); it != s.end(); ++it)
des = max(des, lyxfont::descent(*it, font));
// 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)
+void drawStr(Painter & pain, MathTextCodes type, MathMetricsInfo const & size,
+ int x, int y, string const & str)
{
- pain.text(x, y, s, whichFont(type, siz));
+ LyXFont font;
+ whichFont(font, type, size);
+ pain.text(x, y, str, font);
}
-void drawChar(Painter & pain, MathTextCodes type, MathMetricsInfo const & siz,
+void drawChar(Painter & pain, MathTextCodes type, MathMetricsInfo const & size,
int x, int y, char c)
{
string s;
s += c;
if (isBinaryOp(c, type))
s += ' ';
- drawStr(pain, type, siz, x, y, s);
+ drawStr(pain, type, size, x, y, s);
}
}
-void math_font_max_dim(MathTextCodes code, MathMetricsInfo const & siz,
+void math_font_max_dim(MathTextCodes code, MathMetricsInfo const & size,
int & asc, int & des)
{
- LyXFont font = whichFont(code, siz);
+ LyXFont font;
+ whichFont(font, code, size);
asc = lyxfont::maxAscent(font);
des = lyxfont::maxDescent(font);
}
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 + " ";
+}
+
+