]> git.lyx.org Git - features.git/commitdiff
Change only the shape and not the whole font, otherwise constructs
authorEnrico Forestieri <forenr@lyx.org>
Mon, 26 Apr 2010 20:20:49 +0000 (20:20 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Mon, 26 Apr 2010 20:20:49 +0000 (20:20 +0000)
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

index d47c1a9c57786d0af753df1cc771b24e2d4f8b5f..a717484c055d2a248e339ebe4e8361d1fa585288 100644 (file)
@@ -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);