]> git.lyx.org Git - features.git/commitdiff
Fix height of cursor inside insets
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 4 Nov 2016 11:01:43 +0000 (12:01 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 4 Nov 2016 16:58:32 +0000 (17:58 +0100)
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
src/Cursor.cpp
src/frontends/qt4/GuiWorkArea.cpp
status.22x

index d90da848aecdca7105da2e792face9724eeeddb8..efe7e540da18bb238b9b5edf1f04ab1bbe7bc647 100644 (file)
@@ -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();
index 8cc62634a9a04912ed1d51069e371ec878ffffad..38559f9646122a14b45fd2861747e42766ea9b6b 100644 (file)
@@ -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...
 
index 828671d13cbee5ff1c16d3b0fa060789f0be9e8e..f46e400189aad354521dd6d78bc83cdc4f9d6585 100644 (file)
@@ -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();
index 2719c6a1269ae8394df9242dbb35e56e6e5afa1d..fd469dfbcc5cec1fb5f3ea0e7307404c98a3ff80 100644 (file)
@@ -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