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