From 17af3ea8f418d290c16165234250dec15507385b Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Mon, 26 Apr 2010 20:20:49 +0000 Subject: [PATCH] Change only the shape and not the whole font, otherwise constructs such as \mathbf{\hat{a}} would not be correctly rendered on screen. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34297 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/InsetMathDecoration.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mathed/InsetMathDecoration.cpp b/src/mathed/InsetMathDecoration.cpp index d47c1a9c57..a717484c05 100644 --- a/src/mathed/InsetMathDecoration.cpp +++ b/src/mathed/InsetMathDecoration.cpp @@ -104,8 +104,10 @@ InsetMath::mode_type InsetMathDecoration::currentMode() const void InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const { - FontSetChanger dummy(mi.base, currentMode() == TEXT_MODE ? - "textnormal" : "mathnormal"); + bool const upshape = currentMode() == TEXT_MODE + && mi.base.font.color() == Color_math; + ShapeChanger dummy(mi.base.font, upshape ? + UP_SHAPE : mi.base.font.shape()); cell(0).metrics(mi, dim); @@ -126,8 +128,10 @@ void InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathDecoration::draw(PainterInfo & pi, int x, int y) const { - FontSetChanger dummy(pi.base, currentMode() == TEXT_MODE ? - "textnormal" : "mathnormal"); + bool const upshape = currentMode() == TEXT_MODE + && pi.base.font.color() == Color_math; + ShapeChanger dummy(pi.base.font, upshape ? + UP_SHAPE : pi.base.font.shape()); cell(0).draw(pi, x + 1, y); Dimension const & dim0 = cell(0).dimension(*pi.base.bv); -- 2.39.2