Cursor intersects with \cap
Enrico Forestieri
forenr at lyx.org
Tue Sep 8 11:33:09 UTC 2020
On Tue, Sep 08, 2020 at 01:09:28PM +0200, Enrico Forestieri wrote:
> On Tue, Sep 08, 2020 at 01:00:15PM +0200, Jean-Marc Lasgouttes wrote:
> > Le 08/09/2020 à 12:22, Enrico Forestieri a écrit :
> > > On Tue, Sep 08, 2020 at 10:41:43AM +0200, Jean-Marc Lasgouttes wrote:
> > > > Le 08/09/2020 à 00:11, Enrico Forestieri a écrit :
> > > > > Likely. Possibly the culprit is 79998fdc. However, after that commit,
> > > > > the "2" in \int_0^2 does not clash with the integral anymore.
> > > > > It seems that you can't have your cake and eat it, too.
> > > >
> > > > Something is a bit fishy in terms of metrics though. Look at this example
> > > > here where the \times and the \bigr| are spearated in low zoom level, but
> > > > begin to verlap whan zooming. Weird.
> > >
> > > The width of the other characters increases with zoom, but not the
> > > width of \bigr|, which seems to be home made. Possibly, also the
> > > metrics are not updated when the zoom changes.
> >
> > Yes, \bigr| is ugly, but its position is what LyX computes.
>
> So, it fails to compute it correctly when the zoom changes.
Anyway, the attached patch seems to do the trick.
--
Enrico
-------------- next part --------------
diff --git a/src/frontends/qt/GuiFontMetrics.cpp b/src/frontends/qt/GuiFontMetrics.cpp
index 361125056e..c6371043c6 100644
--- a/src/frontends/qt/GuiFontMetrics.cpp
+++ b/src/frontends/qt/GuiFontMetrics.cpp
@@ -247,8 +247,10 @@ int GuiFontMetrics::width(docstring const & s) const
#endif
if (math_char) {
// keep value 0 for math chars with width 0
- if (metrics_.width(toqstr(s)) != 0)
- w = metrics_.boundingRect(toqstr(s)).width();
+ QString const qs = toqstr(s);
+ int s_width = metrics_.width(qs);
+ if (s_width != 0)
+ w = max(metrics_.boundingRect(qs).width(), s_width);
} else {
QTextLayout tl;
tl.setText(toqstr(s));
More information about the lyx-devel
mailing list