X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathColor.cpp;h=be2c0f881aec07ebad4de0803d565dda71f4f502;hb=52ce0ff49a0f9a5c33459428b2fdffa24febafce;hp=13e6fa41e768b0a21450dad37d59ae9714990222;hpb=939dc4076fe577a40dea99ec668c92c7a6a1d711;p=features.git diff --git a/src/mathed/InsetMathColor.cpp b/src/mathed/InsetMathColor.cpp index 13e6fa41e7..be2c0f881a 100644 --- a/src/mathed/InsetMathColor.cpp +++ b/src/mathed/InsetMathColor.cpp @@ -36,7 +36,8 @@ InsetMathColor::InsetMathColor(Buffer * buf, bool oldstyle, ColorCode color) InsetMathColor::InsetMathColor(Buffer * buf, bool oldstyle, docstring const & color) - : InsetMathNest(buf, 1), oldstyle_(oldstyle), color_(color) + : InsetMathNest(buf, 1), oldstyle_(oldstyle), color_(color), + current_mode_(UNDECIDED_MODE) {} @@ -48,12 +49,18 @@ Inset * InsetMathColor::clone() const void InsetMathColor::metrics(MetricsInfo & mi, Dimension & dim) const { + current_mode_ = isTextFont(mi.base.fontname) ? TEXT_MODE : MATH_MODE; + Changer dummy = mi.base.changeEnsureMath(current_mode_); + cell(0).metrics(mi, dim); } void InsetMathColor::draw(PainterInfo & pi, int x, int y) const { + current_mode_ = isTextFont(pi.base.fontname) ? TEXT_MODE : MATH_MODE; + Changer dummy = pi.base.changeEnsureMath(current_mode_); + ColorCode origcol = pi.base.font.color(); pi.base.font.setColor(lcolor.getFromLaTeXName(to_utf8(color_))); cell(0).draw(pi, x, y);