On Tue, Sep 11, 2007 at 05:37:32PM +0200, Andre Poenitz wrote: > On Tue, Sep 11, 2007 at 10:50:56AM +0300, Martin Vermeer wrote: > > Here's a better one. > > Not really ;-) > > > Index: src/mathed/InsetMathFrac.cpp > > =================================================================== > > --- src/mathed/InsetMathFrac.cpp (revision 20193) > > +++ src/mathed/InsetMathFrac.cpp (working copy) > > @@ -48,9 +48,11 @@ > > bool InsetMathFrac::metrics(MetricsInfo & mi, Dimension & dim) const > > { > > FracChanger dummy(mi.base); > > + if (kind_ == UNITFRAC) > > + ShapeChanger dummy2(mi.base.font, Font::UP_SHAPE); > > cell(0).metrics(mi); > > cell(1).metrics(mi); > > The ShapeChanger changes the Shape back to the original state when it is > destructed, i.e. the end of its scope. In this particular piece of code > the scope of 'dummy2' is the 'if' branch, i.e. the shape will already be > restored before cell(0).metrics() is called. > > I am not sure that changing the shape is needed at all. Is the resulting > metrics visually different?
Perhaps not, but would it be wise to count on that? > If so, something like > > bool InsetMathFrac::metrics(MetricsInfo & mi, Dimension & dim) const > { > FracChanger dummy(mi.base); > std::auto_ptr<ShapeChanger> dummy2; > if (kind_ == UNITFRAC) > dummy2.reset(new ShapeChanger(mi.base.font, Font::UP_SHAPE)); > cell(0).metrics(mi); > cell(1).metrics(mi); > > might help. I this case the ShapeChanger will be destroyed at the > end of the function body. I was looking for something like this, but decided for another approach. > Andre' - Martin