]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathSupport.cpp
Improve appearance of dots at higher zoom levels
[lyx.git] / src / mathed / MathSupport.cpp
index 732c5ac2475e584f05bf0f81580a297fa946de14..cc8927fe7afd304f061f3364d02ebb689f681690 100644 (file)
@@ -32,7 +32,6 @@
 #include "support/docstream.h"
 #include "support/lassert.h"
 #include "support/Length.h"
-#include "support/lyxlib.h"
 
 #include <map>
 #include <algorithm>
@@ -299,31 +298,31 @@ double const dot[] = {
 //     1, 0.5, 0.2, 0.5, 0.2,
 //     1, 0.4, 0.4, 0.6, 0.4,
 //     1, 0.5, 0.5, 0.5, 0.5,
-       5, 0.4, 0.4, 0.6, 0.4,
+       5, 0.4, 0.6, 0.6, 0.6,
        0
 };
 
 
 double const ddot[] = {
-       5, 0.0, 0.4, 0.3, 0.4,
-       5, 0.6, 0.4, 1.0, 0.4,
+       5, 0.1, 0.6, 0.3, 0.6,
+       5, 0.6, 0.6, 0.8, 0.6,
        0
 };
 
 
 double const dddot[] = {
-       1, 0.1,  0.5, 0.2,  0.5,
-       1, 0.45, 0.5, 0.55, 0.5,
-       1, 0.8,  0.5, 0.9,  0.5,
+       5, -0.2, 0.6, 0.0, 0.6,
+       5,  0.3, 0.6, 0.5, 0.6,
+       5,  0.8, 0.6, 1.0, 0.6,
        0
 };
 
 
 double const ddddot[] = {
-       1, 0.1,  0.5, 0.2,  0.5,
-       1, 0.45, 0.5, 0.55, 0.5,
-       1, 0.8,  0.5, 0.9,  0.5,
-       1, 1.15, 0.5, 1.25, 0.5,
+       5, -0.4, 0.6, -0.2, 0.6,
+       5,  0.1, 0.6,  0.3, 0.6,
+       5,  0.6, 0.6,  0.8, 0.6,
+       5,  1.1, 0.6,  1.3, 0.6,
        0
 };
 
@@ -345,8 +344,10 @@ double const dline3[] = {
 
 
 double const ring[] = {
-       2, 5,
-       0.5, 0.8,  0.8, 0.5,  0.5, 0.2,  0.2, 0.5,  0.5, 0.8,
+       2, 9,
+       0.5, 0.8,  0.7, 0.7,  0.8, 0.4,
+       0.7, 0.1,  0.5, 0.0,  0.3, 0.1,
+       0.2, 0.4,  0.3, 0.7,  0.5, 0.8,
        0
 };
 
@@ -365,8 +366,8 @@ double const  Vert[] = {
 
 
 double const tilde[] = {
-       2, 4,
-       0.00, 0.8,  0.25, 0.2,  0.75, 0.8,  1.00, 0.2,
+       2, 6,
+       0.0, 0.8,  0.15, 0.2,  0.35, 0.2,  0.65, 0.8,  0.85, 0.8,  1.0, 0.2,
        0
 };
 
@@ -595,9 +596,11 @@ int mathed_string_width(FontInfo const & font, docstring const & s)
 void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h,
        docstring const & name)
 {
+       int const lw = pi.base.solidLineThickness();
+
        if (name == ".") {
                pi.pain.line(x + w/2, y, x + w/2, y + h,
-                         Color_cursor, Painter::line_onoffdash);
+                         Color_cursor, Painter::line_onoffdash, lw);
                return;
        }
 
@@ -639,16 +642,50 @@ void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h,
                        pi.pain.line(
                                int(x + xx + 0.5), int(y + yy + 0.5),
                                int(x + x2 + 0.5), int(y + y2 + 0.5),
-                               pi.base.font.color());
+                               pi.base.font.color(), Painter::line_solid, lw);
                        if (code == 5) {  // thicker, but rounded
-                               pi.pain.line(
-                                       int(x + xx + 0.5+1), int(y + yy + 0.5-1),
-                                       int(x + x2 + 0.5-1), int(y + y2 + 0.5-1),
-                               pi.base.font.color());
-                               pi.pain.line(
-                                       int(x + xx + 0.5+1), int(y + yy + 0.5+1),
-                                       int(x + x2 + 0.5-1), int(y + y2 + 0.5+1),
-                               pi.base.font.color());
+                               double const xa = x + xx + 0.5;
+                               double const xb = x + x2 + 0.5;
+                               double const ya = y + yy + 0.5;
+                               double const yb = y + y2 + 0.5;
+                               pi.pain.line(int(xa + 1), int(ya - 1),
+                                            int(xb - 1), int(yb - 1),
+                                            pi.base.font.color(),
+                                            Painter::line_solid, lw);
+                               pi.pain.line(int(xa + 1), int(ya + 1),
+                                            int(xb - 1), int(yb + 1),
+                                            pi.base.font.color(),
+                                            Painter::line_solid, lw);
+                               if (xa + 2 <= xb - 2) {
+                                       pi.pain.line(int(xa + 2), int(ya - 2),
+                                                    int(xb - 2), int(yb - 2),
+                                                    pi.base.font.color(),
+                                                    Painter::line_solid, lw);
+                                       pi.pain.line(int(xa + 2), int(ya + 2),
+                                                    int(xb - 2), int(yb + 2),
+                                                    pi.base.font.color(),
+                                                    Painter::line_solid, lw);
+                               }
+                               if (xa + 3 <= xb - 3) {
+                                       pi.pain.line(int(xa + 3), int(ya - 3),
+                                                    int(xb - 3), int(yb - 3),
+                                                    pi.base.font.color(),
+                                                    Painter::line_solid, lw);
+                                       pi.pain.line(int(xa + 3), int(ya + 3),
+                                                    int(xb - 3), int(yb + 3),
+                                                    pi.base.font.color(),
+                                                    Painter::line_solid, lw);
+                               }
+                               if (xa + 4 <= xb - 4) {
+                                       pi.pain.line(int(xa + 4), int(ya - 4),
+                                                    int(xb - 4), int(yb - 4),
+                                                    pi.base.font.color(),
+                                                    Painter::line_solid, lw);
+                                       pi.pain.line(int(xa + 4), int(ya + 4),
+                                                    int(xb - 4), int(yb + 4),
+                                                    pi.base.font.color(),
+                                                    Painter::line_solid, lw);
+                               }
                        }
                } else {
                        int xp[32];
@@ -666,7 +703,8 @@ void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h,
                                yp[j] = int(y + yy + 0.5);
                                //  lyxerr << "P[" << j ' ' << xx << ' ' << yy << ' ' << x << ' ' << y << ']';
                        }
-                       pi.pain.lines(xp, yp, n2, pi.base.font.color());
+                       pi.pain.lines(xp, yp, n2, pi.base.font.color(),
+                               Painter::fill_none, Painter::line_solid, lw);
                }
        }
 }
@@ -993,7 +1031,7 @@ docstring asString(MathData const & ar)
 {
        odocstringstream os;
        otexrowstream ots(os);
-       WriteStream ws(ots);
+       TeXMathStream ws(ots);
        ws << ar;
        return os.str();
 }
@@ -1016,7 +1054,7 @@ docstring asString(InsetMath const & inset)
 {
        odocstringstream os;
        otexrowstream ots(os);
-       WriteStream ws(ots);
+       TeXMathStream ws(ots);
        inset.write(ws);
        return os.str();
 }
@@ -1026,7 +1064,7 @@ docstring asString(MathAtom const & at)
 {
        odocstringstream os;
        otexrowstream ots(os);
-       WriteStream ws(ots);
+       TeXMathStream ws(ots);
        at->write(ws);
        return os.str();
 }