X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmathed%2FInsetMathSpecialChar.cpp;h=701bcc86862d37d1406ae7958dbcbb51f4fcd3d2;hb=f9835d054d7aac5830ec6bb5a3537c2b4fa2d269;hp=b32c2e2302785ef4933ea05869292970d8e1e3bc;hpb=8a0134cc8ce7de41d6d6911a1c4219ca958f2b71;p=lyx.git diff --git a/src/mathed/InsetMathSpecialChar.cpp b/src/mathed/InsetMathSpecialChar.cpp index b32c2e2302..701bcc8686 100644 --- a/src/mathed/InsetMathSpecialChar.cpp +++ b/src/mathed/InsetMathSpecialChar.cpp @@ -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,36 +55,21 @@ 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); dim = fm.dimension(char_); - kerning_ = fm.rbearing(char_) - dim.wid; + kerning_ = mathed_char_kerning(mi.base.font, char_); } } 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_); @@ -147,7 +132,20 @@ void InsetMathSpecialChar::octave(OctaveStream & os) const } -docstring InsetMathSpecialChar::mathmlize(MathStream & ms) const +void InsetMathSpecialChar::mathmlize(MathStream & ms) const +{ + switch (char_) { + case '&': + ms << "&"; + break; + default: + ms.os().put(char_); + break; + } +} + + +void InsetMathSpecialChar::htmlize(HtmlStream & ms) const { switch (char_) { case '&': @@ -157,7 +155,6 @@ docstring InsetMathSpecialChar::mathmlize(MathStream & ms) const ms.os().put(char_); break; } - return docstring(); }