]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathSupport.cpp
Another assertion that got transformed in 1b1f8dd2
[lyx.git] / src / mathed / MathSupport.cpp
index 59b236333fd6be6fdc4a66d6fbfd944e0e6b44da..6a815ed8985e6b81605b4f201c6ecfffb865fab0 100644 (file)
@@ -13,7 +13,8 @@
 
 #include "MathSupport.h"
 
-#include "InsetMath.h"
+#include "InsetMathFont.h"
+#include "InsetMathSymbol.h"
 #include "MathData.h"
 #include "MathParser.h"
 #include "MathStream.h"
@@ -160,6 +161,15 @@ double const brack[] = {
 };
 
 
+double const dbrack[] = {
+       2, 4,
+       0.95, 0.05,  0.05, 0.05,  0.05, 0.95,  0.95, 0.95,
+       2, 2,
+       0.50, 0.05,  0.50, 0.95,
+       0
+};
+
+
 double const corner[] = {
        2, 3,
        0.95, 0.05,  0.05, 0.05,  0.05, 0.95,
@@ -187,25 +197,25 @@ double const hline[] = {
 
 
 double const ddot[] = {
-       1, 0.2, 0.5,  0.3, 0.5,
-       1, 0.7, 0.5,  0.8, 0.5,
+       1, 0.2, 0.5, 0.3, 0.5,
+       1, 0.7, 0.5, 0.8, 0.5,
        0
 };
 
 
 double const dddot[] = {
-       1, 0.1, 0.5,  0.2, 0.5,
+       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, 0.8,  0.5, 0.9,  0.5,
        0
 };
 
 
 double const ddddot[] = {
-       1, 0.0, 0.5,  0.1, 0.5,
-       1, 0.3, 0.5,  0.4, 0.5,
-       1, 0.6, 0.5,  0.7, 0.5,
-       1, 0.9, 0.5,  1.0, 0.5,
+       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,
        0
 };
 
@@ -287,6 +297,8 @@ named_deco_struct deco_table[] = {
        {"underleftarrow",      arrow,    1 },
        {"underrightarrow",     arrow,    3 },
        {"underleftrightarrow", udarrow,  1 },
+       {"undertilde",          tilde,    0 },
+       {"utilde",              tilde,    0 },
 
        // Delimiters
        {"(",              parenth,    0 },
@@ -297,6 +309,8 @@ named_deco_struct deco_table[] = {
        {"rbrace",         brace,      2 },
        {"[",              brack,      0 },
        {"]",              brack,      2 },
+       {"llbracket",      dbrack,     0 },
+       {"rrbracket",      dbrack,     2 },
        {"|",              vert,       0 },
        {"/",              slash,      0 },
        {"slash",          slash,      0 },
@@ -486,9 +500,18 @@ void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h,
 }
 
 
+void metricsStrRedBlack(MetricsInfo & mi, Dimension & dim, docstring const & str)
+{
+       FontInfo font = mi.base.font;
+       augmentFont(font, from_ascii("mathnormal"));
+       mathed_string_dim(font, str, dim);
+}
+
+
 void drawStrRed(PainterInfo & pi, int x, int y, docstring const & str)
 {
        FontInfo f = pi.base.font;
+       augmentFont(f, from_ascii("mathnormal"));
        f.setColor(Color_latex);
        pi.pain.text(x, y, str, f);
 }
@@ -497,6 +520,7 @@ void drawStrRed(PainterInfo & pi, int x, int y, docstring const & str)
 void drawStrBlack(PainterInfo & pi, int x, int y, docstring const & str)
 {
        FontInfo f = pi.base.font;
+       augmentFont(f, from_ascii("mathnormal"));
        f.setColor(Color_foreground);
        pi.pain.text(x, y, str, f);
 }
@@ -562,6 +586,8 @@ fontinfo fontinfos[] = {
                          inh_shape, Color_math},
        {"msb",           MSB_FAMILY, inh_series,
                          inh_shape, Color_math},
+       {"stmry",         STMARY_FAMILY, inh_series,
+                         inh_shape, Color_math},
        {"wasy",          WASY_FAMILY, inh_series,
                          inh_shape, Color_math},
        {"esint",         ESINT_FAMILY, inh_series,
@@ -711,6 +737,27 @@ void augmentFont(FontInfo & font, docstring const & name)
 }
 
 
+bool isAlphaSymbol(MathAtom const & at)
+{
+       if (at->asCharInset() ||
+           (at->asSymbolInset() &&
+            at->asSymbolInset()->isOrdAlpha()))
+               return true;
+
+       if (at->asFontInset()) {
+               MathData const & ar = at->asFontInset()->cell(0);
+               for (size_t i = 0; i < ar.size(); ++i) {
+                       if (!(ar[i]->asCharInset() ||
+                             (ar[i]->asSymbolInset() &&
+                              ar[i]->asSymbolInset()->isOrdAlpha())))
+                               return false;
+               }
+               return true;
+       }
+       return false;
+}
+
+
 docstring asString(MathData const & ar)
 {
        odocstringstream os;