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
This commit is contained in:
Enrico Forestieri 2010-04-26 20:20:49 +00:00
parent 87623ff478
commit 17af3ea8f4

View 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);