[LyX/master] Take the height of label into account when painting rows

Jean-Marc Lasgouttes lasgouttes at lyx.org
Tue Jul 14 18:29:09 UTC 2020


commit bce21e8975eee553b914f52253568e8d40410401
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Tue Jul 14 20:51:05 2020 +0200

    Take the height of label into account when painting rows
    
    Handle the case where, in beamer's Frame, for example, where the label
    string uses a taller font then the paragraph itself.
    
    Fixes bug #11890.
---
 src/TextMetrics.cpp |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 87f0d33..88ea655 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -1145,6 +1145,14 @@ void TextMetrics::setRowHeight(Row & row) const
 	int maxasc = int(fm.maxAscent() * spacing_val);
 	int maxdes = int(fm.maxDescent() * spacing_val);
 
+	// Take label string into account (useful if labelfont is large)
+	if (row.pos() == 0 && layout.labelIsInline()) {
+		FontInfo const labelfont = text_->labelFont(par);
+		FontMetrics const & lfm = theFontMetrics(labelfont);
+		maxasc = max(maxasc, int(lfm.maxAscent() * spacing_val));
+		maxdes = max(maxdes, int(lfm.maxDescent() * spacing_val));
+	}
+
 	// Find the ascent/descent of the row contents
 	for (Row::Element const & e : row) {
 		if (e.inset) {


More information about the lyx-cvs mailing list