]> 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 11:01:43 +0000 (12:01 +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.

src/BufferView.cpp
src/Cursor.cpp
src/frontends/qt4/GuiWorkArea.cpp

index a9ce9a1092270f41e802100bb3d620ddad898b10..463d0f24b8bd0864be6241217b6e0077c157059c 100644 (file)
@@ -2891,7 +2891,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 6f393e3799b7242f0b8c41e48195dc4ec639e80e..43984de9c80c78b01f2adceacbed16b06d8870fd 100644 (file)
@@ -2121,6 +2121,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 6b2a10b1a873292abdc920bf77a169f0612ea346..aa5e285da733a6e6bdb76727f5a08368e6b44d57 100644 (file)
@@ -1264,6 +1264,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();