On Tue, Sep 11, 2007 at 05:58:56PM +0200, Jean-Marc Lasgouttes wrote:
> Andre Poenitz <[EMAIL PROTECTED]> writes:
> 
> > 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.
> 
> It would maybe be more useful to have a FontSaver, then, like:
> 
>    FontSaver dummy(mi.base.font);
>    if (whatever)
>       mi.base.font.setShape(Font::UP_SHAPE);
> 
> and mi.base.font would be restored on scope exit. Actually, a generic
> Saver class would be enough to solve all needs and seems much simpler
> to me than all the hand-made FooChanger classes.

It used to be shorter for common cases. Of course it is not forbidden to
copy the whole font.

Andre'

Reply via email to