From f23775f346cf99e9643c37cc070c0d82a466a750 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 26 Aug 2003 11:06:04 +0000 Subject: [PATCH] fix drawing of displayed formula git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7606 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/formula.C | 10 +++++++++- src/mathed/formula.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) 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; -- 2.39.2