]> git.lyx.org Git - features.git/commitdiff
use Length::inPixel and not Length::inBP to get screen lengths
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Sep 2008 13:59:35 +0000 (13:59 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Sep 2008 13:59:35 +0000 (13:59 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26441 a592a061-630c-0410-9148-cb99ea01b6c8

src/Length.h
src/mathed/InsetMathGrid.cpp
src/mathed/InsetMathGrid.h

index bf377d2a834e22f463521cdb2c9452c6ade2c585..67073a2bf1d05ee1ab21b9f4b781fbca7442cb7f 100644 (file)
@@ -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);
index ade0f4d48d37e030269c962ff5cc0b20bd08a1c3..e303e6e27007366f7001952b2ec4256faa165c88 100644 (file)
@@ -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_;
index 15aa437d8a9fd409f5dd1f2a41efc52a0eb1c438..91abcae608a5ff60bdf7915c5d31c85a76ecdb34 100644 (file)
@@ -49,7 +49,7 @@ public:
                ///
                RowInfo();
                ///
-               int skipPixels() const;
+               int skipPixels(MetricsInfo const & mi) const;
                /// cached descent
                mutable int descent_;
                /// cached ascent