X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathSpecialChar.cpp;h=32e4c2afbf85151df69c1249b93035a7deb44321;hb=30d3fcd640c180407a8a1db7679cca42eaa9e0c1;hp=926dde6e6901db807cf9d25e91250aed0a8f2bf3;hpb=cb2933147cef7912db65b74285fd20c9a728de1e;p=lyx.git diff --git a/src/mathed/InsetMathSpecialChar.cpp b/src/mathed/InsetMathSpecialChar.cpp index 926dde6e69..32e4c2afbf 100644 --- a/src/mathed/InsetMathSpecialChar.cpp +++ b/src/mathed/InsetMathSpecialChar.cpp @@ -29,7 +29,7 @@ namespace lyx { -InsetMathSpecialChar::InsetMathSpecialChar(docstring name) +InsetMathSpecialChar::InsetMathSpecialChar(docstring const & name) : name_(name), kerning_(0) { if (name.size() != 1) { @@ -40,7 +40,7 @@ InsetMathSpecialChar::InsetMathSpecialChar(docstring name) else if (name == "textbackslash") char_ = '\\'; else - LASSERT(false, /**/); + LASSERT(false, char_ = '?'); } else char_ = name.at(0); } @@ -55,11 +55,7 @@ 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") { + if (mi.base.fontname == "mathnormal") { ShapeChanger dummy(mi.base.font, UP_SHAPE); dim = theFontMetrics(mi.base.font).dimension(char_); } else { @@ -72,18 +68,7 @@ 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") { + if (pi.base.fontname == "mathnormal") { ShapeChanger dummy(pi.base.font, UP_SHAPE); pi.draw(x, y, char_); } else { @@ -160,4 +145,17 @@ void InsetMathSpecialChar::mathmlize(MathStream & ms) const } +void InsetMathSpecialChar::htmlize(HtmlStream & ms) const +{ + switch (char_) { + case '&': + ms << "&"; + break; + default: + ms.os().put(char_); + break; + } +} + + } // namespace lyx