Le 20/03/2018 à 16:23, Jean-Marc Lasgouttes a écrit :
I have the same issue with the cursor. The problem I have for fixing this is that the font is not known outside of the metrics or draw calls. It could be possible to set Cursor::real_current_font inside some metrics call, though. I'll think about it.
What about this? The cursor is still a bit bigger than the inset, since math insets are tight in terms of ascent/descent. Would you prefer a tighter cursor?
JMarc
From 869b923a5df2cf6b73122f11df54b2e764c3505f Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes <lasgout...@lyx.org> Date: Tue, 20 Mar 2018 16:41:59 +0100 Subject: [PATCH] Set current cursor font in MathData::metrics() This makes size of the cursor closer to current font in mathed. --- src/mathed/MathData.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp index d242a86..b7a106e 100644 --- a/src/mathed/MathData.cpp +++ b/src/mathed/MathData.cpp @@ -261,6 +261,12 @@ bool isInside(DocIterator const & it, MathData const & ar, void MathData::metrics(MetricsInfo & mi, Dimension & dim) const { + Cursor & cur = mi.base.bv->cursor(); + if (cur.inMathed() && &cur.cell() == this) { + cur.current_font.fontInfo() = mi.base.font; + cur.real_current_font.fontInfo() = mi.base.font; + } + frontend::FontMetrics const & fm = theFontMetrics(mi.base.font); dim = fm.dimension('I'); int xascent = fm.dimension('x').ascent(); -- 2.7.4