small font stuff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4335 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-06-05 07:12:05 +00:00
parent 03a07edafc
commit 12130ed9b1
5 changed files with 13 additions and 24 deletions

View File

@ -39,7 +39,7 @@ namespace {
bool slanted(char c)
{
//if (strchr("0123456789;:!|[]().,?+/-*<>=", c)
return isalpha(c);
return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
}
}
@ -60,7 +60,7 @@ MathInset * MathCharInset::clone() const
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 {
@ -79,11 +79,11 @@ void MathCharInset::metrics(MathMetricsInfo & mi) const
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 {

View File

@ -8,7 +8,7 @@
MathMetricsBase::MathMetricsBase()
: font(), style(LM_ST_TEXT), fontinset(false)
: font(), style(LM_ST_TEXT), fontname("mathnormal")
{}
@ -134,12 +134,12 @@ MathStyleChanger::~MathStyleChanger()
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()

View File

@ -3,6 +3,7 @@
#include "lyxfont.h"
#include "math_defs.h"
#include "LString.h"
class BufferView;
class Painter;
@ -31,7 +32,7 @@ struct MathMetricsBase {
///
MathStyles style;
///
bool fontinset;
string fontname;
};

View File

@ -775,13 +775,13 @@ void Parser::parse_into1(MathGridInset & grid, unsigned flags, bool numbered)
// 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;
}
@ -834,7 +834,7 @@ void Parser::parse_into1(MathGridInset & grid, unsigned flags, bool numbered)
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);
@ -1032,18 +1032,6 @@ void Parser::parse_into1(MathGridInset & grid, unsigned flags, bool numbered)
}
#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) {

View File

@ -570,7 +570,7 @@ fontinfo fontinfos[] = {
{"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},