X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2Fmath_charinset.C;h=8f2674bba30fc1e90ddb6f247783962f919b2afe;hb=701b99ecd70ac472aa53c8b2317af44def4f9670;hp=47e0d0292daba32d2ab16f63641cdfd132232904;hpb=236ea81bc5c0ce7101c9460d1ee97b8f3c9be9df;p=lyx.git diff --git a/src/mathed/math_charinset.C b/src/mathed/math_charinset.C index 47e0d0292d..8f2674bba3 100644 --- a/src/mathed/math_charinset.C +++ b/src/mathed/math_charinset.C @@ -12,36 +12,28 @@ #include #include "math_charinset.h" -#include "dimension.h" -#include "support/std_ostream.h" #include "math_support.h" #include "math_mathmlstream.h" -#include "textpainter.h" - +#include "debug.h" +#include "dimension.h" +#include "support/lstrings.h" +#include "textpainter.h" -using std::ostream; -using std::endl; using std::auto_ptr; -#ifndef CXX_GLOBAL_CSTD -using std::strchr; -using std::isalpha; -#endif - extern bool has_math_fonts; namespace { bool isBinaryOp(char c) { - return strchr("+-<>=/*", c); + return lyx::support::contains("+-<>=/*", c); } bool slanted(char c) { - //if (strchr("0123456789;:!|[]().,?+/-*<>=", c) return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'); } @@ -54,7 +46,7 @@ MathCharInset::MathCharInset(char c) -auto_ptr MathCharInset::clone() const +auto_ptr MathCharInset::doClone() const { return auto_ptr(new MathCharInset(*this)); } @@ -69,8 +61,8 @@ void MathCharInset::metrics(MetricsInfo & mi, Dimension & dim) const } else if ((char_ == '>' || char_ == '<') && has_math_fonts) { FontSetChanger dummy(mi.base, "cmm"); mathed_char_dim(mi.base.font, char_, dim); - } else if (slanted(char_) && mi.base.fontname == "mathnormal") { - ShapeChanger dummy(mi.base.font, LyXFont::ITALIC_SHAPE); + } else if (!slanted(char_) && mi.base.fontname == "mathnormal") { + ShapeChanger dummy(mi.base.font, LyXFont::UP_SHAPE); mathed_char_dim(mi.base.font, char_, dim); } else { mathed_char_dim(mi.base.font, char_, dim); @@ -87,6 +79,7 @@ void MathCharInset::metrics(MetricsInfo & mi, Dimension & dim) const width_ += 2 * font_metrics::width(' ', font_); lyxerr << "MathCharInset::metrics: " << dim << endl; #endif + width_ = dim.wid; } @@ -105,8 +98,8 @@ void MathCharInset::draw(PainterInfo & pi, int x, int y) const } else if ((char_ == '>' || char_ == '<') && has_math_fonts) { FontSetChanger dummy(pi.base, "cmm"); pi.draw(x, y, char_); - } else if (slanted(char_) && pi.base.fontname == "mathnormal") { - ShapeChanger dummy(pi.base.font, LyXFont::ITALIC_SHAPE); + } else if (!slanted(char_) && pi.base.fontname == "mathnormal") { + ShapeChanger dummy(pi.base.font, LyXFont::UP_SHAPE); pi.draw(x, y, char_); } else { pi.draw(x, y, char_); @@ -154,10 +147,3 @@ bool MathCharInset::isRelOp() const { return char_ == '=' || char_ == '<' || char_ == '>'; } - - -bool MathCharInset::match(MathInset const * p) const -{ - MathCharInset const * q = p->asCharInset(); - return q && char_ == q->char_; -}