commit 98e9e53882da33a5a1fb4343e58be46f7921530a
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Sun Feb 25 17:19:42 2018 +0100

    Take actual font height (ascent, descent) into account when drawing 
placeholder box for graphics
    
    Fixes: #11048
    (cherry picked from commit 5ddd377a0ae6c8c18f566463988e3e3f596e57bb)
---
 src/insets/RenderGraphic.cpp |    5 +++++
 status.23x                   |    3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/insets/RenderGraphic.cpp b/src/insets/RenderGraphic.cpp
index 52e9803..e01bcd3 100644
--- a/src/insets/RenderGraphic.cpp
+++ b/src/insets/RenderGraphic.cpp
@@ -157,6 +157,7 @@ void RenderGraphic::metrics(MetricsInfo & mi, Dimension & 
dim) const
        dim.des = 0;
 
        int font_width = 0;
+       int font_height = 0;
 
        FontInfo msgFont(mi.base.font);
        msgFont.setFamily(SANS_FAMILY);
@@ -166,6 +167,7 @@ void RenderGraphic::metrics(MetricsInfo & mi, Dimension & 
dim) const
        if (!justname.empty()) {
                msgFont.setSize(FONT_SIZE_FOOTNOTE);
                font_width = theFontMetrics(msgFont).width(justname);
+               font_height = theFontMetrics(msgFont).maxHeight();
        }
 
        docstring const msg = statusMessage(params_, loader_.status());
@@ -173,9 +175,12 @@ void RenderGraphic::metrics(MetricsInfo & mi, Dimension & 
dim) const
                msgFont.setSize(FONT_SIZE_TINY);
                font_width = max(font_width,
                        theFontMetrics(msgFont).width(msg));
+               font_height += theFontMetrics(msgFont).maxAscent();
+               dim.des = theFontMetrics(msgFont).maxDescent();
        }
 
        dim.wid = max(50, font_width + 15);
+       dim.asc = max(50, font_height + 15);
 
        dim_ = dim;
 }
diff --git a/status.23x b/status.23x
index 19a25ef..1a7312f 100644
--- a/status.23x
+++ b/status.23x
@@ -77,6 +77,9 @@ What's new
 
 - Only show header for bibliography in outliner (bug 11045).
 
+- Take actual font height into account when drawing placeholder box
+  for graphics (bug 11048).
+
 
 * INTERNALS
 

Reply via email to