From: Jean-Marc Lasgouttes Date: Thu, 18 Sep 2008 13:59:35 +0000 (+0000) Subject: use Length::inPixel and not Length::inBP to get screen lengths X-Git-Tag: 1.6.10~3422 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b23bdfa00b03e96224db70d81d525d19b2522ed4;p=features.git use Length::inPixel and not Length::inBP to get screen lengths git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26441 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/Length.h b/src/Length.h index bf377d2a83..67073a2bf1 100644 --- a/src/Length.h +++ b/src/Length.h @@ -89,7 +89,7 @@ public: std::string const asLatexString() const; /// return the on-screen size of this length int inPixels(int text_width, int em_width = 0) const; - /// return the on-screen size of this length of an image + /// return the value in Big Postscript points. int inBP() const; friend bool isValidLength(std::string const & data, Length * result); diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index ade0f4d48d..e303e6e270 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -25,6 +25,7 @@ #include "FuncRequest.h" #include "frontends/Clipboard.h" +#include "frontends/FontMetrics.h" #include "frontends/Painter.h" #include "support/debug.h" @@ -80,9 +81,11 @@ InsetMathGrid::RowInfo::RowInfo() -int InsetMathGrid::RowInfo::skipPixels() const +int InsetMathGrid::RowInfo::skipPixels(MetricsInfo const & mi) const { - return crskip_.inBP(); + frontend::FontMetrics const & fm = theFontMetrics(mi.base.font); + return crskip_.inPixels(mi.base.textwidth, + fm.width(char_type('M'))); } @@ -367,7 +370,7 @@ void InsetMathGrid::metrics(MetricsInfo & mi, Dimension & dim) const rowinfo_[row].offset_ = rowinfo_[row - 1].offset_ + rowinfo_[row - 1].descent_ + - rowinfo_[row - 1].skipPixels() + + rowinfo_[row - 1].skipPixels(mi) + rowsep() + rowinfo_[row].lines_ * hlinesep() + rowinfo_[row].ascent_; @@ -550,7 +553,7 @@ void InsetMathGrid::metricsT(TextMetricsInfo const & mi, Dimension & dim) const rowinfo_[row].offset_ = rowinfo_[row - 1].offset_ + rowinfo_[row - 1].descent_ + - //rowinfo_[row - 1].skipPixels() + + //rowinfo_[row - 1].skipPixels(mi) + 1 + //rowsep() + //rowinfo_[row].lines_ * hlinesep() + rowinfo_[row].ascent_; diff --git a/src/mathed/InsetMathGrid.h b/src/mathed/InsetMathGrid.h index 15aa437d8a..91abcae608 100644 --- a/src/mathed/InsetMathGrid.h +++ b/src/mathed/InsetMathGrid.h @@ -49,7 +49,7 @@ public: /// RowInfo(); /// - int skipPixels() const; + int skipPixels(MetricsInfo const & mi) const; /// cached descent mutable int descent_; /// cached ascent