André,
why do we add 1 to ascent, descent and then remove them when calling the 
painter?

Similarly, why do we arbitrarily remove 2 from the width passed to the 
painter?

Angus

int InsetFormula::ascent(BufferView *, LyXFont const &) const
{
        return preview_->usePreview() ?
                1 + preview_->pimage_->ascent() : 1 + par_->ascent();
}


int InsetFormula::descent(BufferView *, LyXFont const &) const
{
        return preview_->usePreview() ?
                1 + preview_->pimage_->descent() : 1 + par_->descent();
}


void InsetFormula::draw(BufferView * bv, LyXFont const & font,
                        int y, float & xx, bool) const
{
        int const w = width(bv, font);
        int const d = descent(bv, font);
        int const a = ascent(bv, font);
        int const h = a + d;

        MathPainterInfo pi(bv->painter());

        if (use_preview) {
                pi.pain.image(x + 1, y - a + 1, w - 2, h - 2, 
                              *(preview_->pimage_->image(*this, *bv)));

Reply via email to