diff --git a/src/mathed/InsetMathDecoration.cpp b/src/mathed/InsetMathDecoration.cpp index a717484c05..1cb3aebcc1 100644 --- a/src/mathed/InsetMathDecoration.cpp +++ b/src/mathed/InsetMathDecoration.cpp @@ -22,6 +22,7 @@ #include "LaTeXFeatures.h" #include "support/debug.h" +#include "support/docstring.h" #include "support/lassert.h" #include @@ -105,7 +106,7 @@ InsetMath::mode_type InsetMathDecoration::currentMode() const void InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const { bool const upshape = currentMode() == TEXT_MODE - && mi.base.font.color() == Color_math; + && isMathFont(from_ascii(mi.base.fontname)); ShapeChanger dummy(mi.base.font, upshape ? UP_SHAPE : mi.base.font.shape()); @@ -129,7 +130,7 @@ void InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathDecoration::draw(PainterInfo & pi, int x, int y) const { bool const upshape = currentMode() == TEXT_MODE - && pi.base.font.color() == Color_math; + && isMathFont(from_ascii(pi.base.fontname)); ShapeChanger dummy(pi.base.font, upshape ? UP_SHAPE : pi.base.font.shape()); diff --git a/src/mathed/MathSupport.cpp b/src/mathed/MathSupport.cpp index 99930ae4bd..7dc8bafa05 100644 --- a/src/mathed/MathSupport.cpp +++ b/src/mathed/MathSupport.cpp @@ -646,6 +646,13 @@ bool isFontName(docstring const & name) } +bool isMathFont(docstring const & name) +{ + fontinfo * f = lookupFont(name); + return f && f->color_ == Color_math; +} + + FontInfo getFont(docstring const & name) { FontInfo font; diff --git a/src/mathed/MathSupport.h b/src/mathed/MathSupport.h index a2279991af..42d0977be1 100644 --- a/src/mathed/MathSupport.h +++ b/src/mathed/MathSupport.h @@ -49,6 +49,8 @@ void augmentFont(FontInfo & f, docstring const & cmd); bool isFontName(docstring const & name); +bool isMathFont(docstring const & name); + // converts single cell to string docstring asString(MathData const & ar); // converts single inset to string