From 12130ed9b1e8dec72920dfc854dce271a82979b3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Wed, 5 Jun 2002 07:12:05 +0000 Subject: [PATCH] small font stuff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4335 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_charinset.C | 8 ++++---- src/mathed/math_metricsinfo.C | 8 ++++---- src/mathed/math_metricsinfo.h | 3 ++- src/mathed/math_parser.C | 16 ++-------------- src/mathed/math_support.C | 2 +- 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/mathed/math_charinset.C b/src/mathed/math_charinset.C index 2d6ea5e726..8e74c6bc65 100644 --- a/src/mathed/math_charinset.C +++ b/src/mathed/math_charinset.C @@ -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 { diff --git a/src/mathed/math_metricsinfo.C b/src/mathed/math_metricsinfo.C index 81d5dbd75e..f0938619ff 100644 --- a/src/mathed/math_metricsinfo.C +++ b/src/mathed/math_metricsinfo.C @@ -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(mb) { save_ = mb; - mb.fontinset = true; - augmentFont(mb.font, cmd); + mb.fontname = name; + augmentFont(mb.font, name); } MathFontSetChanger::~MathFontSetChanger() diff --git a/src/mathed/math_metricsinfo.h b/src/mathed/math_metricsinfo.h index d607cc4339..fbb4f02050 100644 --- a/src/mathed/math_metricsinfo.h +++ b/src/mathed/math_metricsinfo.h @@ -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; }; diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 70d99383f9..1f417f7529 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -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) { diff --git a/src/mathed/math_support.C b/src/mathed/math_support.C index 5d2df15c78..fce3be0cf0 100644 --- a/src/mathed/math_support.C +++ b/src/mathed/math_support.C @@ -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}, -- 2.39.2