]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathSpecialChar.cpp
Merge branch 'master' into biblatex2
[lyx.git] / src / mathed / InsetMathSpecialChar.cpp
index 2c600d0c2b38791bf7c0852c368fb06630a5a38a..4525ff530933a06af4de75106eb41eb3f34389dc 100644 (file)
@@ -40,7 +40,7 @@ InsetMathSpecialChar::InsetMathSpecialChar(docstring const & name)
                else if (name == "textbackslash")
                        char_ = '\\';
                else
-                       LASSERT(false, /**/);
+                       LASSERT(false, char_ = '?');
        } else
                char_ = name.at(0);
 }
@@ -55,12 +55,8 @@ Inset * InsetMathSpecialChar::clone() const
 
 void InsetMathSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       if (char_ == ' ') {
-               dim.asc = 4;
-               dim.des = 0;
-               dim.wid = 10;
-       } else if (mi.base.fontname == "mathnormal") {
-               ShapeChanger dummy(mi.base.font, UP_SHAPE);
+       if (mi.base.fontname == "mathnormal") {
+               Changer dummy = mi.base.font.changeShape(UP_SHAPE);;
                dim = theFontMetrics(mi.base.font).dimension(char_);
        } else {
                frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
@@ -72,19 +68,8 @@ void InsetMathSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetMathSpecialChar::draw(PainterInfo & pi, int x, int y) const
 {
-       if (char_ == ' ') {
-               int xp[4];
-               int yp[4];
-               int w = 10;
-
-               xp[0] = ++x;        yp[0] = y - 3;
-               xp[1] = x;          yp[1] = y;
-               xp[2] = x + w - 2;  yp[2] = y;
-               xp[3] = x + w - 2;  yp[3] = y - 3;
-
-               pi.pain.lines(xp, yp, 4, Color_special);
-       } else if (pi.base.fontname == "mathnormal") {
-               ShapeChanger dummy(pi.base.font, UP_SHAPE);
+       if (pi.base.fontname == "mathnormal") {
+               Changer dummy = pi.base.font.changeShape(UP_SHAPE);
                pi.draw(x, y, char_);
        } else {
                pi.draw(x, y, char_);
@@ -160,4 +145,17 @@ void InsetMathSpecialChar::mathmlize(MathStream & ms) const
 }
 
 
+void InsetMathSpecialChar::htmlize(HtmlStream & ms) const
+{
+       switch (char_) {
+       case '&':
+               ms << "&amp;";
+               break;
+       default:
+               ms.os().put(char_);
+               break;
+       }
+}
+
+
 } // namespace lyx