From a0b8ea2eee5f557c2e24196bcadde2515ff49968 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 4 Nov 2016 12:01:43 +0100 Subject: [PATCH] Fix height of cursor inside insets It turns out that Cursor::getFont() does not return a fully realized font in some cases. This patch uses real_current_font instead, which seems better anyway. I suspect that all uses of getFont() should be removed, but this is not code that I know well. Fixes bug #10478. (cherry picked from commit b099d9ae15c45a9c30727078d69c0c7bd8029c9a) --- src/BufferView.cpp | 2 +- src/Cursor.cpp | 1 + src/frontends/qt4/GuiWorkArea.cpp | 1 + status.22x | 5 ++++- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index d90da848ae..efe7e540da 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -2878,7 +2878,7 @@ bool BufferView::paragraphVisible(DocIterator const & dit) const void BufferView::cursorPosAndHeight(Point & p, int & h) const { Cursor const & cur = cursor(); - Font const font = cur.getFont(); + Font const font = cur.real_current_font; frontend::FontMetrics const & fm = theFontMetrics(font); int const asc = fm.maxAscent(); int const des = fm.maxDescent(); diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 8cc62634a9..38559f9646 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -2201,6 +2201,7 @@ Font Cursor::getFont() const // The logic here should more or less match to the // Cursor::setCurrentFont logic, i.e. the cursor height should // give a hint what will happen if a character is entered. + // FIXME: this is not the case, what about removing this method ? (see #10478). // HACK. far from being perfect... diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 828671d13c..f46e400189 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -1274,6 +1274,7 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e) GuiPainter pain(d->screen_, pixelRatio()); d->buffer_view_->updateMetrics(); d->buffer_view_->draw(pain); + // FIXME: shall we use real_current_font here? (see #10478) FontInfo font = d->buffer_view_->cursor().getFont().fontInfo(); FontMetrics const & fm = theFontMetrics(font); int height = fm.maxHeight(); diff --git a/status.22x b/status.22x index 2719c6a126..fd469dfbcc 100644 --- a/status.22x +++ b/status.22x @@ -123,7 +123,10 @@ What's new - Allow using colors supported by xcolor inside mathed (bug 10417). -- Change description of "frame of button" color to "button frame" (bug 10135). +- Change description of "frame of button" color to "button frame" (bug + 10135). + +- Fix height of cursor inside insets (bug 10478). * INTERNALS -- 2.39.5