fix static array

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1158 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-10-26 00:03:21 +00:00
parent f826e64de1
commit d597ece5e7

View File

@ -191,21 +191,18 @@ LyXFont mathed_get_font(short type, int size)
int mathed_string_width(short type, int size, byte const * s, int ls) int mathed_string_width(short type, int size, byte const * s, int ls)
{ {
LyXFont f = WhichFont(type, size); string st;
if (MathIsBinary(type))
for (int i = 0; i < ls; ++i) {
st += ' ';
st += s[i];
st += ' ';
}
else
st = string(reinterpret_cast<char const *>(s), ls);
byte sx[80]; LyXFont const f = WhichFont(type, size);
if (MathIsBinary(type)) { return lyxfont::width(st, f);
byte * ps = &sx[0];
for (int i = 0; i < ls && i < 75; ++i) {
*(ps++) = ' ';
*(ps++) = s[i];
*(ps++) = ' ';
}
*(ps++) = '\0';
ls *= 3;
s = &sx[0];
}
return lyxfont::width(reinterpret_cast<char const *>(s), ls, f);
} }
int mathed_string_width(short type, int size, string const & str) int mathed_string_width(short type, int size, string const & str)
@ -258,13 +255,15 @@ void MathedInset::drawStr(Painter & pain, short type, int siz,
int x, int y, byte const * s, int ls) int x, int y, byte const * s, int ls)
{ {
string st; string st;
if (MathIsBinary(type)) { if (MathIsBinary(type))
for (int i = 0; i < ls; ++i) { for (int i = 0; i < ls; ++i) {
st += string(" ") + char(s[i]) + ' '; st += ' ';
st += char(s[i]);
st += ' ';
} }
} else { else
st = string(reinterpret_cast<char const *>(s), ls); st = string(reinterpret_cast<char const *>(s), ls);
}
LyXFont const mf = mathed_get_font(type, siz); LyXFont const mf = mathed_get_font(type, siz);
pain.text(x, y, st, mf); pain.text(x, y, st, mf);
} }