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);
-
- byte sx[80];
- if (MathIsBinary(type)) {
- 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);
+ 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);
+
+ LyXFont const f = WhichFont(type, size);
+ return lyxfont::width(st, f);
}
int mathed_string_width(short type, int size, string const & str)
}
int mathed_string_width(short type, int size, string const & str)
int x, int y, byte const * s, int ls)
{
string st;
int x, int y, byte const * s, int ls)
{
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 += ' ';
st = string(reinterpret_cast<char const *>(s), ls);
st = string(reinterpret_cast<char const *>(s), ls);
LyXFont const mf = mathed_get_font(type, siz);
pain.text(x, y, st, mf);
}
LyXFont const mf = mathed_get_font(type, siz);
pain.text(x, y, st, mf);
}