]> git.lyx.org Git - features.git/commitdiff
Set a minimal height for math rows
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 9 Apr 2018 10:18:24 +0000 (12:18 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 10 May 2018 10:47:57 +0000 (12:47 +0200)
The value used here is the x height. It would be nice to see what the
TeXbook really says.

This makes a big difference with \tilde{.}, for example.

(cherry picked from commit 6df8c42e59f7dbe00d585525d1ce7e91a42411ca)

src/mathed/MathRow.cpp

index 345962096f121aff04bd1e5748ebc992e4127e08..561081556e342ef182f6d902251916663fd64909 100644 (file)
@@ -236,7 +236,10 @@ int MathRow::after(int i) const
 
 void MathRow::metrics(MetricsInfo & mi, Dimension & dim)
 {
-       dim.asc = 0;
+       frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
+       // FIXME: this is the minimal ascent seen empirically, check
+       // what the TeXbook says.
+       dim.asc = fm.ascent('x');
        dim.wid = 0;
        // In order to compute the dimension of macros and their
        // arguments, it is necessary to keep track of them.
@@ -284,7 +287,7 @@ void MathRow::metrics(MetricsInfo & mi, Dimension & dim)
                        }
                        break;
                case BOX:
-                       d = theFontMetrics(mi.base.font).dimension('I');
+                       d = fm.dimension('I');
                        if (e.color != Color_none) {
                                // allow for one pixel before/after the box.
                                d.wid += e.before + e.after + 2;