]> git.lyx.org Git - features.git/commitdiff
small font stuff
authorAndré Pönitz <poenitz@gmx.net>
Wed, 5 Jun 2002 07:12:05 +0000 (07:12 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 5 Jun 2002 07:12:05 +0000 (07:12 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4335 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_charinset.C
src/mathed/math_metricsinfo.C
src/mathed/math_metricsinfo.h
src/mathed/math_parser.C
src/mathed/math_support.C

index 2d6ea5e72636af30901b93be6e6f2aeda196772e..8e74c6bc655d6e8ab0cf4dd2d55d0c8a3888de9b 100644 (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 {
index 81d5dbd75ebfc3274f104978e5946ef9405b30d8..f0938619ff15993620301f04414a5f9f8a238772 100644 (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()
index d607cc43393f43c9660380ed9c6ca2d0da6edc39..fbb4f02050ad8b10844123de5ed11b4d690c36d9 100644 (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;
 };
 
 
index 70d99383f9e39068b78d377c5778460fcc0e53ba..1f417f7529ef1700360a041038157dfa3a19251a 100644 (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) {
index 5d2df15c7815512a4647353abb9bb1fa80398363..fce3be0cf0df6fca6a54ce036e56a46e4eee4450 100644 (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},