]> git.lyx.org Git - features.git/commitdiff
using std::endl; and forbidden small stuff
authorAndré Pönitz <poenitz@gmx.net>
Wed, 20 Mar 2002 07:30:32 +0000 (07:30 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 20 Mar 2002 07:30:32 +0000 (07:30 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3784 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_biginset.C
src/mathed/math_charinset.C
src/mathed/math_support.C
src/mathed/math_support.h

index 5c7f061f04bca44adce1894d32428f8ab1bce307..fb9ec3e9f731990374a4e7ce639ff22b95c6031b 100644 (file)
@@ -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);
index d2702ba5d2e0598fc058d268276c769e986931ed..d44809c735a8a50879a21257ea36298e8df6d266 100644 (file)
 #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_);
 }
 
index 0d9a11276f965039417937872151c1c73ce7428f..edb659011a8220d4fcd58faa06c1de68db3b5a08 100644 (file)
@@ -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);
 }
 
index 64b4b394a316c461bd61a2fd1322d20beff01acc..7538175671a9f96a6a56ebe10a39a1c0b0590c09 100644 (file)
@@ -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);