From: André Pönitz Date: Wed, 20 Mar 2002 07:30:32 +0000 (+0000) Subject: using std::endl; and forbidden small stuff X-Git-Tag: 1.6.10~19617 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=724cbeaa42d61b60fadcc30a8c852269d4e7b1ad;p=features.git using std::endl; and forbidden small stuff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3784 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/math_biginset.C b/src/mathed/math_biginset.C index 5c7f061f04..fb9ec3e9f7 100644 --- a/src/mathed/math_biginset.C +++ b/src/mathed/math_biginset.C @@ -44,7 +44,7 @@ void MathBigInset::metrics(MathMetricsInfo const & mi) const { LyXFont font; whichFont(font, LM_TC_VAR, mi); - double h = mathed_char_height(font, 'I', ascent_, descent_); + double h = mathed_char_ascent(font, 'I'); double f = increase(); width_ = 6; ascent_ = int(h + f * h); diff --git a/src/mathed/math_charinset.C b/src/mathed/math_charinset.C index d2702ba5d2..d44809c735 100644 --- a/src/mathed/math_charinset.C +++ b/src/mathed/math_charinset.C @@ -10,15 +10,22 @@ #include "LColor.h" #include "Painter.h" #include "support/LOstream.h" -#include "math_support.h" -#include "math_parser.h" +#include "font.h" #include "debug.h" +#include "math_support.h" #include "math_mathmlstream.h" #include "LaTeXFeatures.h" #include "textpainter.h" using std::ostream; +using std::endl; + + +bool isBinaryOp(char c, MathTextCodes type) +{ + return type < LM_TC_SYMB && strchr("+-<>=/*", c); +} MathCharInset::MathCharInset(char c) @@ -54,12 +61,16 @@ void MathCharInset::metrics(MathMetricsInfo const & mi) const { whichFont(font_, code_, mi); mathed_char_dim(font_, char_, ascent_, descent_, width_); + if (isBinaryOp(char_, code_)) + width_ += 2 * lyxfont::width(' ', font_); } void MathCharInset::draw(Painter & pain, int x, int y) const { //lyxerr << "drawing '" << char_ << "' code: " << code_ << endl; + if (isBinaryOp(char_, code_)) + x += lyxfont::width(' ', font_); drawChar(pain, font_, x, y, char_); } @@ -74,7 +85,7 @@ void MathCharInset::metrics(TextMetricsInfo const &) const void MathCharInset::draw(TextPainter & pain, int x, int y) const { - lyxerr << "drawing text '" << char_ << "' code: " << code_ << endl; + //lyxerr << "drawing text '" << char_ << "' code: " << code_ << endl; pain.draw(x, y, char_); } diff --git a/src/mathed/math_support.C b/src/mathed/math_support.C index 0d9a11276f..edb659011a 100644 --- a/src/mathed/math_support.C +++ b/src/mathed/math_support.C @@ -19,12 +19,6 @@ using std::endl; using std::max; -bool isBinaryOp(char c, MathTextCodes type) -{ - return type < LM_TC_SYMB && strchr("+-<>=/*", c); -} - - /// class Matrix { public: @@ -562,23 +556,6 @@ void mathed_char_dim(LyXFont const & font, } -int mathed_char_height(LyXFont const & font, - unsigned char c, int & asc, int & des) -{ - des = lyxfont::descent(c, font); - asc = lyxfont::ascent(c, font); - return asc + des; -} - - -int mathed_char_height(LyXFont const & font, unsigned char c) -{ - int asc; - int des; - return mathed_char_height(font, c, asc, des); -} - - int mathed_char_ascent(LyXFont const & font, unsigned char c) { return lyxfont::ascent(c, font); @@ -591,32 +568,21 @@ int mathed_char_descent(LyXFont const & font, unsigned char c) } -int mathed_char_width(LyXFont const & font, - unsigned char c) +int mathed_char_width(LyXFont const & font, unsigned char c) { - //if (isBinaryOp(c, type)) - // return lyxfont::width(c, font) + 2 * lyxfont::width(' ', font); return lyxfont::width(c, font); } void mathed_string_dim(LyXFont const & font, string const & s, int & asc, int & des, int & wid) -{ - mathed_string_height(font, s, asc, des); - wid = mathed_string_width(font, s); -} - - -int mathed_string_height(LyXFont const & font, - string const & s, int & asc, int & des) { asc = des = 0; for (string::const_iterator it = s.begin(); it != s.end(); ++it) { des = max(des, lyxfont::descent(*it, font)); asc = max(asc, lyxfont::ascent(*it, font)); } - return asc + des; + wid = lyxfont::width(s, font); } @@ -731,8 +697,6 @@ void drawStr(Painter & pain, LyXFont const & font, void drawChar(Painter & pain, LyXFont const & font, int x, int y, char c) { - //if (isBinaryOp(c, type)) - // x += lyxfont::width(' ', font); pain.text(x, y, c, font); } diff --git a/src/mathed/math_support.h b/src/mathed/math_support.h index 64b4b394a3..7538175671 100644 --- a/src/mathed/math_support.h +++ b/src/mathed/math_support.h @@ -17,7 +17,6 @@ extern char const * latex_mathspace[]; void mathed_char_dim(LyXFont const &, unsigned char c, int & asc, int & des, int & wid); -int mathed_char_height(LyXFont const &, unsigned char c, int & asc, int & des); int mathed_char_width(LyXFont const &, unsigned char c); int mathed_char_ascent(LyXFont const &, unsigned char c); int mathed_char_descent(LyXFont const &, unsigned char c); @@ -29,8 +28,6 @@ void mathed_draw_framebox(Painter & pain, int x, int y, MathInset const *); void mathed_string_dim(LyXFont const &, string const & s, int & asc, int & des, int & wid); -int mathed_string_height(LyXFont const &, - string const & s, int & asc, int & des); int mathed_string_width(LyXFont const &, string const & s); int mathed_string_ascent(LyXFont const &, string const & s);