#include <config.h>
#include "MathSupport.h"
-#include "MathArray.h"
+#include "MathData.h"
#include "InsetMath.h"
#include "MathStream.h"
#include "MathParser.h"
#include "debug.h"
-#include "LColor.h"
+#include "Color.h"
#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
} // namespace anon
-int mathed_char_width(LyXFont const & font, char_type c)
+int mathed_char_width(Font const & font, char_type c)
{
return theFontMetrics(font).width(c);
}
-int mathed_char_kerning(LyXFont const & font, char_type c)
+int mathed_char_kerning(Font const & font, char_type c)
{
frontend::FontMetrics const & fm = theFontMetrics(font);
return fm.rbearing(c) - fm.width(c);
}
-void mathed_string_dim(LyXFont const & font,
+void mathed_string_dim(Font const & font,
docstring const & s,
Dimension & dim)
{
}
-int mathed_string_width(LyXFont const & font, docstring const & s)
+int mathed_string_width(Font const & font, docstring const & s)
{
return theFontMetrics(font).width(s);
}
{
if (name == ".") {
pi.pain.line(x + w/2, y, x + w/2, y + h,
- LColor::cursor, Painter::line_onoffdash);
+ Color::cursor, Painter::line_onoffdash);
return;
}
pi.pain.line(
int(x + xx + 0.5), int(y + yy + 0.5),
int(x + x2 + 0.5), int(y + y2 + 0.5),
- LColor::math);
+ Color::math);
} else {
int xp[32];
int yp[32];
yp[j] = int(y + yy + 0.5);
// lyxerr << "P[" << j ' ' << xx << ' ' << yy << ' ' << x << ' ' << y << ']';
}
- pi.pain.lines(xp, yp, n, LColor::math);
+ pi.pain.lines(xp, yp, n, Color::math);
}
}
}
void drawStrRed(PainterInfo & pi, int x, int y, docstring const & str)
{
- LyXFont f = pi.base.font;
- f.setColor(LColor::latex);
+ Font f = pi.base.font;
+ f.setColor(Color::latex);
pi.pain.text(x, y, str, f);
}
void drawStrBlack(PainterInfo & pi, int x, int y, docstring const & str)
{
- LyXFont f = pi.base.font;
- f.setColor(LColor::foreground);
+ Font f = pi.base.font;
+ f.setColor(Color::foreground);
pi.pain.text(x, y, str, f);
}
-void math_font_max_dim(LyXFont const & font, int & asc, int & des)
+void math_font_max_dim(Font const & font, int & asc, int & des)
{
frontend::FontMetrics const & fm = theFontMetrics(font);
asc = fm.maxAscent();
struct fontinfo {
std::string cmd_;
- LyXFont::FONT_FAMILY family_;
- LyXFont::FONT_SERIES series_;
- LyXFont::FONT_SHAPE shape_;
- LColor::color color_;
+ Font::FONT_FAMILY family_;
+ Font::FONT_SERIES series_;
+ Font::FONT_SHAPE shape_;
+ Color::color color_;
};
-LyXFont::FONT_FAMILY const inh_family = LyXFont::INHERIT_FAMILY;
-LyXFont::FONT_SERIES const inh_series = LyXFont::INHERIT_SERIES;
-LyXFont::FONT_SHAPE const inh_shape = LyXFont::INHERIT_SHAPE;
+Font::FONT_FAMILY const inh_family = Font::INHERIT_FAMILY;
+Font::FONT_SERIES const inh_series = Font::INHERIT_SERIES;
+Font::FONT_SHAPE const inh_shape = Font::INHERIT_SHAPE;
// mathnormal should be the first, otherwise the fallback further down
// does not work
fontinfo fontinfos[] = {
// math fonts
- {"mathnormal", LyXFont::ROMAN_FAMILY, LyXFont::MEDIUM_SERIES,
- LyXFont::ITALIC_SHAPE, LColor::math},
- {"mathbf", inh_family, LyXFont::BOLD_SERIES,
- inh_shape, LColor::math},
- {"mathcal", LyXFont::CMSY_FAMILY, inh_series,
- inh_shape, LColor::math},
- {"mathfrak", LyXFont::EUFRAK_FAMILY, inh_series,
- inh_shape, LColor::math},
- {"mathrm", LyXFont::ROMAN_FAMILY, inh_series,
- LyXFont::UP_SHAPE, LColor::math},
- {"mathsf", LyXFont::SANS_FAMILY, inh_series,
- inh_shape, LColor::math},
- {"mathbb", LyXFont::MSB_FAMILY, inh_series,
- inh_shape, LColor::math},
- {"mathtt", LyXFont::TYPEWRITER_FAMILY, inh_series,
- inh_shape, LColor::math},
+ {"mathnormal", Font::ROMAN_FAMILY, Font::MEDIUM_SERIES,
+ Font::ITALIC_SHAPE, Color::math},
+ {"mathbf", inh_family, Font::BOLD_SERIES,
+ inh_shape, Color::math},
+ {"mathcal", Font::CMSY_FAMILY, inh_series,
+ inh_shape, Color::math},
+ {"mathfrak", Font::EUFRAK_FAMILY, inh_series,
+ inh_shape, Color::math},
+ {"mathrm", Font::ROMAN_FAMILY, inh_series,
+ Font::UP_SHAPE, Color::math},
+ {"mathsf", Font::SANS_FAMILY, inh_series,
+ inh_shape, Color::math},
+ {"mathbb", Font::MSB_FAMILY, inh_series,
+ inh_shape, Color::math},
+ {"mathtt", Font::TYPEWRITER_FAMILY, inh_series,
+ inh_shape, Color::math},
{"mathit", inh_family, inh_series,
- LyXFont::ITALIC_SHAPE, LColor::math},
- {"cmex", LyXFont::CMEX_FAMILY, inh_series,
- inh_shape, LColor::math},
- {"cmm", LyXFont::CMM_FAMILY, inh_series,
- inh_shape, LColor::math},
- {"cmr", LyXFont::CMR_FAMILY, inh_series,
- inh_shape, LColor::math},
- {"cmsy", LyXFont::CMSY_FAMILY, inh_series,
- inh_shape, LColor::math},
- {"eufrak", LyXFont::EUFRAK_FAMILY, inh_series,
- inh_shape, LColor::math},
- {"msa", LyXFont::MSA_FAMILY, inh_series,
- inh_shape, LColor::math},
- {"msb", LyXFont::MSB_FAMILY, inh_series,
- inh_shape, LColor::math},
- {"wasy", LyXFont::WASY_FAMILY, inh_series,
- inh_shape, LColor::none},
- {"esint", LyXFont::ESINT_FAMILY, inh_series,
- inh_shape, LColor::none},
+ Font::ITALIC_SHAPE, Color::math},
+ {"cmex", Font::CMEX_FAMILY, inh_series,
+ inh_shape, Color::math},
+ {"cmm", Font::CMM_FAMILY, inh_series,
+ inh_shape, Color::math},
+ {"cmr", Font::CMR_FAMILY, inh_series,
+ inh_shape, Color::math},
+ {"cmsy", Font::CMSY_FAMILY, inh_series,
+ inh_shape, Color::math},
+ {"eufrak", Font::EUFRAK_FAMILY, inh_series,
+ inh_shape, Color::math},
+ {"msa", Font::MSA_FAMILY, inh_series,
+ inh_shape, Color::math},
+ {"msb", Font::MSB_FAMILY, inh_series,
+ inh_shape, Color::math},
+ {"wasy", Font::WASY_FAMILY, inh_series,
+ inh_shape, Color::none},
+ {"esint", Font::ESINT_FAMILY, inh_series,
+ inh_shape, Color::none},
// Text fonts
{"text", inh_family, inh_series,
- inh_shape, LColor::foreground},
- {"textbf", inh_family, LyXFont::BOLD_SERIES,
- inh_shape, LColor::foreground},
+ inh_shape, Color::foreground},
+ {"textbf", inh_family, Font::BOLD_SERIES,
+ inh_shape, Color::foreground},
{"textit", inh_family, inh_series,
- LyXFont::ITALIC_SHAPE, LColor::foreground},
- {"textmd", inh_family, LyXFont::MEDIUM_SERIES,
- inh_shape, LColor::foreground},
+ Font::ITALIC_SHAPE, Color::foreground},
+ {"textmd", inh_family, Font::MEDIUM_SERIES,
+ inh_shape, Color::foreground},
{"textnormal", inh_family, inh_series,
- LyXFont::UP_SHAPE, LColor::foreground},
- {"textrm", LyXFont::ROMAN_FAMILY,
- inh_series, LyXFont::UP_SHAPE,LColor::foreground},
+ Font::UP_SHAPE, Color::foreground},
+ {"textrm", Font::ROMAN_FAMILY,
+ inh_series, Font::UP_SHAPE,Color::foreground},
{"textsc", inh_family, inh_series,
- LyXFont::SMALLCAPS_SHAPE, LColor::foreground},
- {"textsf", LyXFont::SANS_FAMILY, inh_series,
- inh_shape, LColor::foreground},
+ Font::SMALLCAPS_SHAPE, Color::foreground},
+ {"textsf", Font::SANS_FAMILY, inh_series,
+ inh_shape, Color::foreground},
{"textsl", inh_family, inh_series,
- LyXFont::SLANTED_SHAPE, LColor::foreground},
- {"texttt", LyXFont::TYPEWRITER_FAMILY, inh_series,
- inh_shape, LColor::foreground},
+ Font::SLANTED_SHAPE, Color::foreground},
+ {"texttt", Font::TYPEWRITER_FAMILY, inh_series,
+ inh_shape, Color::foreground},
{"textup", inh_family, inh_series,
- LyXFont::UP_SHAPE, LColor::foreground},
+ Font::UP_SHAPE, Color::foreground},
// TIPA support
{"textipa", inh_family, inh_series,
- inh_shape, LColor::foreground},
+ inh_shape, Color::foreground},
// LyX internal usage
{"lyxtex", inh_family, inh_series,
- LyXFont::UP_SHAPE, LColor::latex},
- {"lyxsymbol", LyXFont::SYMBOL_FAMILY, inh_series,
- inh_shape, LColor::math},
- {"lyxboldsymbol", LyXFont::SYMBOL_FAMILY, LyXFont::BOLD_SERIES,
- inh_shape, LColor::math},
- {"lyxblacktext", LyXFont::ROMAN_FAMILY, LyXFont::MEDIUM_SERIES,
- LyXFont::UP_SHAPE, LColor::foreground},
+ Font::UP_SHAPE, Color::latex},
+ {"lyxsymbol", Font::SYMBOL_FAMILY, inh_series,
+ inh_shape, Color::math},
+ {"lyxboldsymbol", Font::SYMBOL_FAMILY, Font::BOLD_SERIES,
+ inh_shape, Color::math},
+ {"lyxblacktext", Font::ROMAN_FAMILY, Font::MEDIUM_SERIES,
+ Font::UP_SHAPE, Color::foreground},
{"lyxnochange", inh_family, inh_series,
- inh_shape, LColor::foreground},
- {"lyxfakebb", LyXFont::TYPEWRITER_FAMILY, LyXFont::BOLD_SERIES,
- LyXFont::UP_SHAPE, LColor::math},
- {"lyxfakecal", LyXFont::SANS_FAMILY, LyXFont::MEDIUM_SERIES,
- LyXFont::ITALIC_SHAPE, LColor::math},
- {"lyxfakefrak", LyXFont::ROMAN_FAMILY, LyXFont::BOLD_SERIES,
- LyXFont::ITALIC_SHAPE, LColor::math}
+ inh_shape, Color::foreground},
+ {"lyxfakebb", Font::TYPEWRITER_FAMILY, Font::BOLD_SERIES,
+ Font::UP_SHAPE, Color::math},
+ {"lyxfakecal", Font::SANS_FAMILY, Font::MEDIUM_SERIES,
+ Font::ITALIC_SHAPE, Color::math},
+ {"lyxfakefrak", Font::ROMAN_FAMILY, Font::BOLD_SERIES,
+ Font::ITALIC_SHAPE, Color::math}
};
}
-LyXFont getFont(docstring const & name)
+Font getFont(docstring const & name)
{
- LyXFont font;
+ Font font;
augmentFont(font, name);
return font;
}
}
-void augmentFont(LyXFont & font, docstring const & name)
+void augmentFont(Font & font, docstring const & name)
{
static bool initialized = false;
if (!initialized) {
font.setSeries(info->series_);
if (info->shape_ != inh_shape)
font.setShape(info->shape_);
- if (info->color_ != LColor::none)
+ if (info->color_ != Color::none)
font.setColor(info->color_);
}
-docstring asString(MathArray const & ar)
+docstring asString(MathData const & ar)
{
odocstringstream os;
WriteStream ws(os);
}
-void asArray(docstring const & str, MathArray & ar)
+void asArray(docstring const & str, MathData & ar)
{
mathed_parse_cell(ar, str);
}