mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
using std::endl; and forbidden small stuff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3784 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
16a46b3fc0
commit
724cbeaa42
@ -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);
|
||||
|
@ -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_);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user