]> git.lyx.org Git - lyx.git/commitdiff
fix static array
authorLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 26 Oct 2000 00:03:21 +0000 (00:03 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 26 Oct 2000 00:03:21 +0000 (00:03 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1158 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/formula.C

index c0bab611e3a36dcaeeba68ebdfb3311ac5e13341..5b10679fb142b219f6d7a2125bc00f4a90453ebd 100644 (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)
 {
-    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)
@@ -258,13 +255,15 @@ void MathedInset::drawStr(Painter & pain, short type, int siz,
                          int x, int y, byte const * s, int ls)
 {
        string st;
-       if (MathIsBinary(type)) {
+       if (MathIsBinary(type))
                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);
-       }
+
        LyXFont const mf = mathed_get_font(type, siz);
        pain.text(x, y, st, mf);
 }