bool slanted(char c)
{
//if (strchr("0123456789;:!|[]().,?+/-*<>=", c)
- return isalpha(c);
+ return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
}
}
void MathCharInset::metrics(MathMetricsInfo & mi) const
{
#if 1
- if (slanted(char_) && !mi.base.fontinset) {
+ if (slanted(char_) && mi.base.fontname == "mathnormal") {
MathShapeChanger dummy(mi.base.font, LyXFont::ITALIC_SHAPE);
mathed_char_dim(mi.base.font, char_, ascent_, descent_, width_);
} else {
void MathCharInset::draw(MathPainterInfo & pi, int x, int y) const
{
- //lyxerr << "drawing '" << char_ << "' code: " << pi.code << endl;
+ //lyxerr << "drawing '" << char_ << "' font: " << pi.base.fontname << endl;
if (isBinaryOp(char_))
x += font_metrics::width(' ', pi.base.font);
#if 1
- if (slanted(char_) && !pi.base.fontinset) {
+ if (slanted(char_) && pi.base.fontname == "mathnormal") {
MathShapeChanger dummy(pi.base.font, LyXFont::ITALIC_SHAPE);
pi.draw(x, y, char_);
} else {
MathMetricsBase::MathMetricsBase()
- : font(), style(LM_ST_TEXT), fontinset(false)
+ : font(), style(LM_ST_TEXT), fontname("mathnormal")
{}
-MathFontSetChanger::MathFontSetChanger(MathMetricsBase & mb, char const * cmd)
+MathFontSetChanger::MathFontSetChanger(MathMetricsBase & mb, char const * name)
: MathChanger<MathMetricsBase>(mb)
{
save_ = mb;
- mb.fontinset = true;
- augmentFont(mb.font, cmd);
+ mb.fontname = name;
+ augmentFont(mb.font, name);
}
MathFontSetChanger::~MathFontSetChanger()
#include "lyxfont.h"
#include "math_defs.h"
+#include "LString.h"
class BufferView;
class Painter;
///
MathStyles style;
///
- bool fontinset;
+ string fontname;
};
// cat codes
//
if (t.cat() == catMath) {
- dump();
if (flags & FLAG_TEXTMODE) {
// we are inside some text mode thingy, so opening new math is allowed
MathAtom at(new MathHullInset(LM_OT_SIMPLE));
parse_into2(at, FLAG_SIMPLE, false);
cell->push_back(at);
} else {
+ dump();
lyxerr << "something strange in the parser\n";
break;
}
else if (t.cat() == catAlign) {
++cellcol;
- lyxerr << " column now " << cellcol << " max: " << grid.ncols() << "\n";
+ //lyxerr << " column now " << cellcol << " max: " << grid.ncols() << "\n";
if (cellcol == grid.ncols()) {
lyxerr << "adding column " << cellcol << "\n";
grid.addCol(cellcol - 1);
}
#endif
-#if 0
- else if (t.cs() == "mbox" || t.cs() == "text") {
- //array.push_back(createMathInset(t.cs()));
- array.push_back(MathAtom(new MathBoxInset(t.cs())));
- // slurp in the argument of mbox
-
- MathBoxInset * p = cell->back()->asBoxInset();
- //lyx::assert(p);
- }
-#endif
-
-
else if (t.cs().size()) {
latexkeys const * l = in_word_set(t.cs());
if (l) {
{"eufrak", LyXFont::EUFRAK_FAMILY, def_series, def_shape, LColor::math},
{"mathbf", def_family, LyXFont::BOLD_SERIES, def_shape, LColor::math},
{"mathcal",LyXFont::CMSY_FAMILY, def_series, def_shape, LColor::math},
- {"mathnormal", def_family,def_series, LyXFont::ITALIC_SHAPE, LColor::math},
+ {"mathnormal", def_family,def_series, LyXFont::UP_SHAPE, LColor::math},
{"mathrm", LyXFont::ROMAN_FAMILY, def_series, def_shape, LColor::math},
{"mathsf", LyXFont::SANS_FAMILY, def_series, def_shape, LColor::math},
{"msa", LyXFont::MSA_FAMILY, def_series, def_shape, LColor::math},