From: André Pönitz Date: Tue, 26 Aug 2003 11:06:04 +0000 (+0000) Subject: fix drawing of displayed formula X-Git-Tag: 1.6.10~16229 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f23775f346cf99e9643c37cc070c0d82a466a750;p=features.git fix drawing of displayed formula git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7606 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/formula.C b/src/mathed/formula.C index b7f3f9be18..a2bd901a52 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -234,7 +234,7 @@ void InsetFormula::draw(PainterInfo & pi, int x, int y) const //p.pain.rectangle(x, y - a, w, h, LColor::mathframe); } - par_->draw(p, x, y); + par_->draw(p, x + offset_, y); } xo_ = x; @@ -287,6 +287,14 @@ void InsetFormula::metrics(MetricsInfo & m, Dimension & dim) const dim.asc += 1; dim.des += 1; } + + if (display()) { + offset_ = (m.base.textwidth - dim.wid) / 2; + dim.wid = m.base.textwidth; + } else { + offset_ = 0; + } + dim_ = dim; } diff --git a/src/mathed/formula.h b/src/mathed/formula.h index a0d7abc44f..415eba86b3 100644 --- a/src/mathed/formula.h +++ b/src/mathed/formula.h @@ -78,6 +78,8 @@ private: /// contents MathAtom par_; + /// x offset for drawing displayed formula + mutable int offset_; /// Use the Pimpl idiom to hide the internals of the previewer. class PreviewImpl;