Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2020-05-28 Thread Scott Kostyshak
On Thu, May 28, 2020 at 08:44:18PM +0200, Jean-Marc Lasgouttes wrote:
> Le 25/05/2020 à 16:37, Jean-Marc Lasgouttes a écrit :
> > Le 25/05/2020 à 16:23, Scott Kostyshak a écrit :
> > > > Rereading your mail ... if we use another character (e.g.
> > > > \alpha), the box is OK.
> > > > Checking all Greek chars, only epsilon box looks bad. (and
> > > > \omicron 'ο' is missing,
> > > > while \textomicron exists)
> > > 
> > > It also seems not to depend on the zoom level.
> > 
> > Sorry to be out of the loop. I read the mail, but have a lot of work
> > right now. The issue is probably that I replaced a fixed pixel value by
> > another one which depends on zoom. This part of the commit can be
> > reverted of improved, I do not know yet what is best.
> 
> I reverted this part at e06e2e24e.

Thanks,

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2020-05-28 Thread Jean-Marc Lasgouttes

Le 25/05/2020 à 16:37, Jean-Marc Lasgouttes a écrit :

Le 25/05/2020 à 16:23, Scott Kostyshak a écrit :
Rereading your mail ... if we use another character (e.g. \alpha), 
the box is OK.
Checking all Greek chars, only epsilon box looks bad. (and \omicron 
'ο' is missing,

while \textomicron exists)


It also seems not to depend on the zoom level.


Sorry to be out of the loop. I read the mail, but have a lot of work 
right now. The issue is probably that I replaced a fixed pixel value by 
another one which depends on zoom. This part of the commit can be 
reverted of improved, I do not know yet what is best.


I reverted this part at e06e2e24e.

JMarc
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2020-05-25 Thread Scott Kostyshak
On Mon, May 25, 2020 at 04:37:01PM +0200, Jean-Marc Lasgouttes wrote:
> Le 25/05/2020 à 16:23, Scott Kostyshak a écrit :
> > > Rereading your mail ... if we use another character (e.g. \alpha), the 
> > > box is OK.
> > > Checking all Greek chars, only epsilon box looks bad. (and \omicron 'ο' 
> > > is missing,
> > > while \textomicron exists)
> > 
> > It also seems not to depend on the zoom level.
> 
> Sorry to be out of the loop. I read the mail, but have a lot of work right
> now. The issue is probably that I replaced a fixed pixel value by another
> one which depends on zoom. This part of the commit can be reverted of
> improved, I do not know yet what is best.

Good luck with the work. I don't see an urgent need to revert, since
this shouldn't interfere with future bisects or other issues.

> The question is to know what the intent of this red marking is.

I think it is to alert the user that something is there. In some cases
without the red box, if the preview shows up as too small, it will seem
invisible.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2020-05-25 Thread Scott Kostyshak
On Mon, May 25, 2020 at 05:40:32PM +0200, Enrico Forestieri wrote:
> On Sun, May 24, 2020 at 09:43:55PM -0400, Scott Kostyshak wrote:
> > On Mon, Feb 19, 2018 at 06:36:36PM +0100, Jean-Marc Lasgouttes wrote:
> > > commit 56e012be83fd4fec1e21d750e961ff936cc8c889
> > > Author: Jean-Marc Lasgouttes 
> > > Date:   Mon Feb 19 18:24:29 2018 +0100
> > > 
> > > Improve metrics of equations. More work remains to be done.
> > > 
> > > Use proper value for above/below skip (12pt) instead of the hardcoded
> > > 12 pixels.
> > > 
> > > Add forgotten skip before display math preview.
> > > 
> > > Make "too small preview" size dpi-dependent.
> > > Make gap in front of equation (what is it good for, BTW?) 
> > > dpi-dependent.
> > > ---
> > 
> > Starting with this commit, if I open the attached .lyx file the epsilon
> > gets the "too small preview" red box. It doesn't seem to depend on the
> > zoom.
> > 
> > Can anyone else reproduce?
> 
> I can reproduce on master but not on stable.
> 
> However, I had a sort of déjà vu:
> https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg204452.html

True, I forgot about that. I guess the difference here is that epsilon
is a more common character than some of the characters in that file.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2020-05-25 Thread Enrico Forestieri
On Sun, May 24, 2020 at 09:43:55PM -0400, Scott Kostyshak wrote:
> On Mon, Feb 19, 2018 at 06:36:36PM +0100, Jean-Marc Lasgouttes wrote:
> > commit 56e012be83fd4fec1e21d750e961ff936cc8c889
> > Author: Jean-Marc Lasgouttes 
> > Date:   Mon Feb 19 18:24:29 2018 +0100
> > 
> > Improve metrics of equations. More work remains to be done.
> > 
> > Use proper value for above/below skip (12pt) instead of the hardcoded
> > 12 pixels.
> > 
> > Add forgotten skip before display math preview.
> > 
> > Make "too small preview" size dpi-dependent.
> > Make gap in front of equation (what is it good for, BTW?) dpi-dependent.
> > ---
> 
> Starting with this commit, if I open the attached .lyx file the epsilon
> gets the "too small preview" red box. It doesn't seem to depend on the
> zoom.
> 
> Can anyone else reproduce?

I can reproduce on master but not on stable.

However, I had a sort of déjà vu:
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg204452.html

-- 
Enrico
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2020-05-25 Thread Jean-Marc Lasgouttes

Le 25/05/2020 à 16:23, Scott Kostyshak a écrit :

Rereading your mail ... if we use another character (e.g. \alpha), the box is 
OK.
Checking all Greek chars, only epsilon box looks bad. (and \omicron 'ο' is 
missing,
while \textomicron exists)


It also seems not to depend on the zoom level.


Sorry to be out of the loop. I read the mail, but have a lot of work 
right now. The issue is probably that I replaced a fixed pixel value by 
another one which depends on zoom. This part of the commit can be 
reverted of improved, I do not know yet what is best.


The question is to know what the intent of this red marking is.

JMarc
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2020-05-25 Thread Scott Kostyshak
On Mon, May 25, 2020 at 04:05:04PM +0200, Kornel Benko wrote:
> Am Mon, 25 May 2020 09:39:24 -0400
> schrieb Scott Kostyshak :
> 
> > On Mon, May 25, 2020 at 09:28:31AM +0200, Kornel Benko wrote:
> > > Am Sun, 24 May 2020 21:43:55 -0400
> > > schrieb Scott Kostyshak :
> > >   
> > > > On Mon, Feb 19, 2018 at 06:36:36PM +0100, Jean-Marc Lasgouttes wrote:  
> > > > > commit 56e012be83fd4fec1e21d750e961ff936cc8c889
> > > > > Author: Jean-Marc Lasgouttes 
> > > > > Date:   Mon Feb 19 18:24:29 2018 +0100
> > > > > 
> > > > > Improve metrics of equations. More work remains to be done.
> > > > > 
> > > > > Use proper value for above/below skip (12pt) instead of the 
> > > > > hardcoded
> > > > > 12 pixels.
> > > > > 
> > > > > Add forgotten skip before display math preview.
> > > > > 
> > > > > Make "too small preview" size dpi-dependent.
> > > > > Make gap in front of equation (what is it good for, BTW?) 
> > > > > dpi-dependent.
> > > > > ---
> > > > 
> > > > Starting with this commit, if I open the attached .lyx file the epsilon
> > > > gets the "too small preview" red box. It doesn't seem to depend on the
> > > > zoom.
> > > > 
> > > > Can anyone else reproduce?
> > > > 
> > > > Scott  
> > > 
> > > Same here. OTOH, also the created pdf has very small epsilon  
> > 
> > Thanks for checking.
> > 
> > Scott
> 
> Rereading your mail ... if we use another character (e.g. \alpha), the box is 
> OK.
> Checking all Greek chars, only epsilon box looks bad. (and \omicron 'ο' is 
> missing,
> while \textomicron exists)

It also seems not to depend on the zoom level.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2020-05-25 Thread Kornel Benko
Am Mon, 25 May 2020 09:39:24 -0400
schrieb Scott Kostyshak :

> On Mon, May 25, 2020 at 09:28:31AM +0200, Kornel Benko wrote:
> > Am Sun, 24 May 2020 21:43:55 -0400
> > schrieb Scott Kostyshak :
> >   
> > > On Mon, Feb 19, 2018 at 06:36:36PM +0100, Jean-Marc Lasgouttes wrote:  
> > > > commit 56e012be83fd4fec1e21d750e961ff936cc8c889
> > > > Author: Jean-Marc Lasgouttes 
> > > > Date:   Mon Feb 19 18:24:29 2018 +0100
> > > > 
> > > > Improve metrics of equations. More work remains to be done.
> > > > 
> > > > Use proper value for above/below skip (12pt) instead of the 
> > > > hardcoded
> > > > 12 pixels.
> > > > 
> > > > Add forgotten skip before display math preview.
> > > > 
> > > > Make "too small preview" size dpi-dependent.
> > > > Make gap in front of equation (what is it good for, BTW?) 
> > > > dpi-dependent.
> > > > ---
> > > 
> > > Starting with this commit, if I open the attached .lyx file the epsilon
> > > gets the "too small preview" red box. It doesn't seem to depend on the
> > > zoom.
> > > 
> > > Can anyone else reproduce?
> > > 
> > > Scott  
> > 
> > Same here. OTOH, also the created pdf has very small epsilon  
> 
> Thanks for checking.
> 
> Scott

Rereading your mail ... if we use another character (e.g. \alpha), the box is 
OK.
Checking all Greek chars, only epsilon box looks bad. (and \omicron 'ο' is 
missing,
while \textomicron exists)

Kornel


pgpAaS3RR8lgQ.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2020-05-25 Thread Scott Kostyshak
On Mon, May 25, 2020 at 09:28:31AM +0200, Kornel Benko wrote:
> Am Sun, 24 May 2020 21:43:55 -0400
> schrieb Scott Kostyshak :
> 
> > On Mon, Feb 19, 2018 at 06:36:36PM +0100, Jean-Marc Lasgouttes wrote:
> > > commit 56e012be83fd4fec1e21d750e961ff936cc8c889
> > > Author: Jean-Marc Lasgouttes 
> > > Date:   Mon Feb 19 18:24:29 2018 +0100
> > > 
> > > Improve metrics of equations. More work remains to be done.
> > > 
> > > Use proper value for above/below skip (12pt) instead of the hardcoded
> > > 12 pixels.
> > > 
> > > Add forgotten skip before display math preview.
> > > 
> > > Make "too small preview" size dpi-dependent.
> > > Make gap in front of equation (what is it good for, BTW?) 
> > > dpi-dependent.
> > > ---  
> > 
> > Starting with this commit, if I open the attached .lyx file the epsilon
> > gets the "too small preview" red box. It doesn't seem to depend on the
> > zoom.
> > 
> > Can anyone else reproduce?
> > 
> > Scott
> 
> Same here. OTOH, also the created pdf has very small epsilon

Thanks for checking.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2020-05-25 Thread Kornel Benko
Am Sun, 24 May 2020 21:43:55 -0400
schrieb Scott Kostyshak :

> On Mon, Feb 19, 2018 at 06:36:36PM +0100, Jean-Marc Lasgouttes wrote:
> > commit 56e012be83fd4fec1e21d750e961ff936cc8c889
> > Author: Jean-Marc Lasgouttes 
> > Date:   Mon Feb 19 18:24:29 2018 +0100
> > 
> > Improve metrics of equations. More work remains to be done.
> > 
> > Use proper value for above/below skip (12pt) instead of the hardcoded
> > 12 pixels.
> > 
> > Add forgotten skip before display math preview.
> > 
> > Make "too small preview" size dpi-dependent.
> > Make gap in front of equation (what is it good for, BTW?) dpi-dependent.
> > ---  
> 
> Starting with this commit, if I open the attached .lyx file the epsilon
> gets the "too small preview" red box. It doesn't seem to depend on the
> zoom.
> 
> Can anyone else reproduce?
> 
> Scott

Same here. OTOH, also the created pdf has very small epsilon

Kornel


pgp5SnnhjmXTb.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2020-05-24 Thread Scott Kostyshak
On Mon, Feb 19, 2018 at 06:36:36PM +0100, Jean-Marc Lasgouttes wrote:
> commit 56e012be83fd4fec1e21d750e961ff936cc8c889
> Author: Jean-Marc Lasgouttes 
> Date:   Mon Feb 19 18:24:29 2018 +0100
> 
> Improve metrics of equations. More work remains to be done.
> 
> Use proper value for above/below skip (12pt) instead of the hardcoded
> 12 pixels.
> 
> Add forgotten skip before display math preview.
> 
> Make "too small preview" size dpi-dependent.
> Make gap in front of equation (what is it good for, BTW?) dpi-dependent.
> ---

Starting with this commit, if I open the attached .lyx file the epsilon
gets the "too small preview" red box. It doesn't seem to depend on the
zoom.

Can anyone else reproduce?

Scott


mwe_redbox.23.lyx
Description: application/lyx


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-04-04 Thread Jean-Marc Lasgouttes

Le 04/04/2018 à 16:50, Pavel Sanda a écrit :

Jean-Marc Lasgouttes wrote:

I pushed it to master. Please try it out and let me know whether it is
ready for 2.3.x, especially with small font size.


I am working with it. The most striking of small cursor is if you type operator
first, e.g. hit minus ("-") in mathed first and see the cursor size.

I am fine with that, but I can imagine it can be irritating to others...
But it's up to them to show up and scream ;)


This is not supposed to happen... I'll have a look.

JMarc


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-04-04 Thread Pavel Sanda
Jean-Marc Lasgouttes wrote:
> I pushed it to master. Please try it out and let me know whether it is 
> ready for 2.3.x, especially with small font size.

I am working with it. The most striking of small cursor is if you type operator
first, e.g. hit minus ("-") in mathed first and see the cursor size.

I am fine with that, but I can imagine it can be irritating to others...
But it's up to them to show up and scream ;)

Pavel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-04-04 Thread Jean-Marc Lasgouttes

Le 03/04/2018 à 17:41, Pavel Sanda a écrit :

Jean-Marc Lasgouttes wrote:

Can you confirm that these go away when preview are disabled?

No, I get the assertion even with preview off.
I also found recipy to reproduce:
1. open math manual, go to section 3.1
2. enter with cursor the large math inset showing nested fractions with
cfrac
3. scroll down via mouse wheel so the inset gets out of the screen
4. assertion


The following patch should be OK then. If it is, I'll push it to master and
we'll figure out what to do from there.


Sweet, I can confirm that the crash is gone. Pavel



I pushed it to master. Please try it out and let me know whether it is 
ready for 2.3.x, especially with small font size.


JMarc


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-04-03 Thread Pavel Sanda
Jean-Marc Lasgouttes wrote:
>>> Can you confirm that these go away when preview are disabled?
>> No, I get the assertion even with preview off.
>> I also found recipy to reproduce:
>> 1. open math manual, go to section 3.1
>> 2. enter with cursor the large math inset showing nested fractions with 
>> cfrac
>> 3. scroll down via mouse wheel so the inset gets out of the screen
>> 4. assertion
>
> The following patch should be OK then. If it is, I'll push it to master and 
> we'll figure out what to do from there.

Sweet, I can confirm that the crash is gone. Pavel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-04-03 Thread Jean-Marc Lasgouttes

Le 21/03/2018 à 13:09, Pavel Sanda a écrit :

Jean-Marc Lasgouttes wrote:

Le 20/03/2018 ?? 17:39, Pavel Sanda a écrit :

Unf I also am getting assertion when navigating through complex fractions
and scrolling with mouse wheel at the same time.
Not sure whether your patch is involved.


Can you confirm that these go away when preview are disabled?


No, I get the assertion even with preview off.

I also found recipy to reproduce:
1. open math manual, go to section 3.1
2. enter with cursor the large math inset showing nested fractions with cfrac
3. scroll down via mouse wheel so the inset gets out of the screen
4. assertion


The following patch should be OK then. If it is, I'll push it to master 
and we'll figure out what to do from there.


JMarc


From 3d64ace4f2a301e14ca5cef8ee33f9343c9bcc8e Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes 
Date: Tue, 20 Mar 2018 16:41:59 +0100
Subject: [PATCH] Set current cursor font in MathData::metrics()

Also make sure that caret dimension in mathed is not larger than inset
height.

This makes size of the cursor closer to current font in mathed.
---
 src/BufferView.cpp  | 12 ++--
 src/mathed/MathData.cpp |  9 +
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 0e30cc7..dafcc9d 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -2965,8 +2965,16 @@ void BufferView::caretPosAndHeight(Point & p, int & h) const
 	Cursor const & cur = cursor();
 	Font const font = cur.real_current_font;
 	frontend::FontMetrics const & fm = theFontMetrics(font);
-	int const asc = fm.maxAscent();
-	int const des = fm.maxDescent();
+	int asc = fm.maxAscent();
+	int des = fm.maxDescent();
+	// If the cursor is in mathed and it has cached metrics, reduce
+	// the height to fit the inner cell (mathed cells are tight
+	// vertically).
+	if (cur.inMathed() && coordCache().getArrays().hasDim(())) {
+		Dimension const dim = cur.cell().dimension(*this);
+		asc = min(asc, dim.asc);
+		des = min(des, dim.des);
+	}
 	h = asc + des;
 	p = getPos(cur);
 	p.y_ -= asc;
diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp
index d242a86..96aef29 100644
--- a/src/mathed/MathData.cpp
+++ b/src/mathed/MathData.cpp
@@ -261,6 +261,15 @@ bool isInside(DocIterator const & it, MathData const & ar,
 
 void MathData::metrics(MetricsInfo & mi, Dimension & dim) const
 {
+	// This is the only point where the drawing font is known.
+	// We set cursor current font so that the blinking caret height
+	// adapts to math font.
+	Cursor & cur = mi.base.bv->cursor();
+	if (cur.inMathed() && () == 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



Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-21 Thread Pavel Sanda
Kornel Benko wrote:
> > No, I get the assertion even with preview off.
> > 
> > I also found recipy to reproduce:
> > 1. open math manual, go to section 3.1
> 
> You mean 3.2 here?

Yes, sorry.

> > 2. enter with cursor the large math inset showing nested fractions with
> > cfrac 3. scroll down via mouse wheel so the inset gets out of the screen 4.
> > assertion
> > 
> > Can you reproduce?
> 
> No crash without the patch.
> Crash with the patch.

Good. Pavel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-21 Thread Kornel Benko
Am Mittwoch, 21. März 2018 13:09:02 CET schrieb Pavel Sanda :
> Jean-Marc Lasgouttes wrote:
> > Le 20/03/2018 ?? 17:39, Pavel Sanda a écrit :
> >> Unf I also am getting assertion when navigating through complex fractions
> >> and scrolling with mouse wheel at the same time.
> >> Not sure whether your patch is involved.
> > 
> > Can you confirm that these go away when preview are disabled?
> 
> No, I get the assertion even with preview off.
> 
> I also found recipy to reproduce:
> 1. open math manual, go to section 3.1

You mean 3.2 here?

> 2. enter with cursor the large math inset showing nested fractions with
> cfrac 3. scroll down via mouse wheel so the inset gets out of the screen 4.
> assertion
> 
> Can you reproduce?

No crash without the patch.
Crash with the patch.

> Pavel

Kornel

signature.asc
Description: This is a digitally signed message part.


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-21 Thread Pavel Sanda
Pavel Sanda wrote:
> Jean-Marc Lasgouttes wrote:
> > Le 20/03/2018 ?? 17:39, Pavel Sanda a écrit :
> >> Unf I also am getting assertion when navigating through complex fractions
> >> and scrolling with mouse wheel at the same time.
> >> Not sure whether your patch is involved.
> >
> > Can you confirm that these go away when preview are disabled?
> 
> No, I get the assertion even with preview off.
> 
> I also found recipy to reproduce:
> 1. open math manual, go to section 3.1
> 2. enter with cursor the large math inset showing nested fractions with cfrac
> 3. scroll down via mouse wheel so the inset gets out of the screen
> 4. assertion
> 
> Can you reproduce?

this is under qt5...

> Pavel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-21 Thread Pavel Sanda
Jean-Marc Lasgouttes wrote:
> Le 20/03/2018 ?? 17:39, Pavel Sanda a écrit :
>> Unf I also am getting assertion when navigating through complex fractions
>> and scrolling with mouse wheel at the same time.
>> Not sure whether your patch is involved.
>
> Can you confirm that these go away when preview are disabled?

No, I get the assertion even with preview off.

I also found recipy to reproduce:
1. open math manual, go to section 3.1
2. enter with cursor the large math inset showing nested fractions with cfrac
3. scroll down via mouse wheel so the inset gets out of the screen
4. assertion

Can you reproduce?
Pavel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-21 Thread Jean-Marc Lasgouttes

Le 20/03/2018 à 17:39, Pavel Sanda a écrit :

Unf I also am getting assertion when navigating through complex fractions
and scrolling with mouse wheel at the same time.
Not sure whether your patch is involved.


Can you confirm that these go away when preview are disabled?

JMarc


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Jean-Marc Lasgouttes
Le 20 mars 2018 17:49:44 GMT+01:00, Pavel Sanda  a écrit :
>Pavel Sanda wrote:
>> Unf I also am getting assertion when navigating through complex
>fractions
>> and scrolling with mouse wheel at the same time.
>> Not sure whether your patch is involved.
>
>limited testing indicates it's part of the second patch.p

Yes, the backtrace says so. I am not totally surprised, I am currently tracking 
a bug where some insets (maths ?) do not have a dimension.

JMarc

Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Pavel Sanda
Pavel Sanda wrote:
> Unf I also am getting assertion when navigating through complex fractions
> and scrolling with mouse wheel at the same time.
> Not sure whether your patch is involved.

limited testing indicates it's part of the second patch.p


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Pavel Sanda
Jean-Marc Lasgouttes wrote:
> Le 20/03/2018 ?? 16:57, Pavel Sanda a écrit :
>> This is already huge improvement to the current situation.
>> It might still make sense to decrease little bit, I can try
>> different patch if you have another variant at hand.
>
> This, for example. I am not sure how robust it is, but it seems to work.

The power of the second patch proved itself as I was able to immediately spot
nesting error in my equation which was not apparent after playing with it last
20 mins with normal cursors. 

If it was on me, I'd say the second is better, but I think we need to get
opinion of others as well. The cursor gets really small on complex equations
and while I like it exactness it could be considered way too small by less
obsessive folks than I am...

Unf I also am getting assertion when navigating through complex fractions
and scrolling with mouse wheel at the same time.
Not sure whether your patch is involved.

CoordCache.cpp (30): break on pointer: 0x570ad3a0 hint: dim size: 0
#0  lyx::lyxbreaker (data=data@entry=0x57374de0, 
hint=hint@entry=0x55dad61d "dim", size=0)
at CoordCache.cpp:31
#1  0x559844fc in lyx::CoordCacheBase::checkDim 
(hint=0x55dad61d "dim", 
thing=0x57374de0, this=0x583236e8) at ./CoordCache.h:151
#2  lyx::CoordCacheBase::dim (thing=0x57374de0, 
this=0x583236e8) at ./CoordCache.h:95
#3  lyx::MathData::dimension (this=0x57374de0, bv=...) at 
mathed/MathData.cpp:895
#4  0x558f57a2 in lyx::BufferView::caretPosAndHeight 
(this=0x58323270, p=..., 
h=h@entry=@0x7fffd3dc: 0) at BufferView.cpp:2971
#5  0x55b8beff in 
lyx::frontend::GuiWorkArea::Private::updateCaretGeometry (this=0x5831a290)
at GuiWorkArea.cpp:601
#6  0x55b8c520 in lyx::frontend::GuiWorkArea::scheduleRedraw 
(this=0x583188d0, 
update_metrics=) at GuiWorkArea.cpp:476
#7  0x55b33dc5 in lyx::frontend::WorkAreaManager::redrawAll 
(this=0x56f53ec0, 
update_metrics=update_metrics@entry=false) at WorkAreaManager.cpp:38
#8  0x556d6bb9 in lyx::Buffer::changed (this=, 
update_metrics=update_metrics@entry=false) at Buffer.cpp:662
#9  0x558f8865 in lyx::BufferView::processUpdateFlags 
(this=this@entry=0x58323270, 
flags=, flags@entry=lyx::Update::Force) at BufferView.cpp:545
#10 0x558f97bc in lyx::BufferView::scrollDocView (this=0x58323270, 
value=value@entry=-84, 
update=update@entry=true) at BufferView.cpp:660
#11 0x55b8cfc4 in lyx::frontend::GuiWorkArea::scrollTo 
(this=0x583188d0, value=-84)
at GuiWorkArea.cpp:677


Pavel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Jean-Marc Lasgouttes

Le 20/03/2018 à 16:57, Pavel Sanda a écrit :

This is already huge improvement to the current situation.
It might still make sense to decrease little bit, I can try
different patch if you have another variant at hand.


This, for example. I am not sure how robust it is, but it seems to work.

JMarc


From 22841811d75df5aee35691c7709eebfd0b7ea8e7 Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes 
Date: Tue, 20 Mar 2018 16:41:59 +0100
Subject: [PATCH] Set current cursor font in MathData::metrics()

Also make sure that caret dimension in mathed is not larger than inset
height.

This makes size of the cursor closer to current font in mathed.
---
 src/BufferView.cpp  | 9 +++--
 src/mathed/MathData.cpp | 6 ++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 0e30cc7..375ac90 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -2965,8 +2965,13 @@ void BufferView::caretPosAndHeight(Point & p, int & h) const
 	Cursor const & cur = cursor();
 	Font const font = cur.real_current_font;
 	frontend::FontMetrics const & fm = theFontMetrics(font);
-	int const asc = fm.maxAscent();
-	int const des = fm.maxDescent();
+	int asc = fm.maxAscent();
+	int des = fm.maxDescent();
+	if (d->cursor_.inMathed()) {
+		Dimension const dim = d->cursor_.cell().dimension(*this);
+		asc = min(asc, dim.asc);
+		des = min(des, dim.des);
+	}
 	h = asc + des;
 	p = getPos(cur);
 	p.y_ -= asc;
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() && () == 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



Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Jean-Marc Lasgouttes

Le 20/03/2018 à 15:37, Scott Kostyshak a écrit :

It is probably a good time to have this discussion: do we want the UI
element size/thickness to depend from dpi/zoom?


My first thought is that it makes sense to zoom.

What do other applications do in similar situations?

Is the symbol indicating a new line (from ctrl+return) also part of this
discussion?  Or it is viewed as a character so that's why it zooms?


It has the width of an 'n' and an ascent equal to maxAscent of the font.
What I would change is to make the thickness of the line depend on zoom

So what I am heading towards these days is zooming like a magnifier 
would do.


If I take a look at LibreOffice, I see that the width of a tabular line 
does not depend on zoom. It might depend on dpi, though. But I do not 
know whether dpi since is supposed to be reliable on all platforms.


MS Office does zoom the tabular rules thickness OTOH.

Actually, MetricsBase::solid_line_thickness_ depends on the zoom, but 
not of the dpi:

if (lyxrc.currentZoom >= 200) {
// derive the line thickness from zoom factor
// the zoom is given in percent
// (increase thickness at 250%, 450% etc.)
solid_line_thickness_ = (lyxrc.currentZoom + 150) / 200;

Stephan, is it a problem with retina screen, or does the OS take care of 
this? (I think it does).

Also do other people have experience of HiDPI screens in other cases?

JMarc



Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Pavel Sanda
Jean-Marc Lasgouttes wrote:
> 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?

This is already huge improvement to the current situation.
It might still make sense to decrease little bit, I can try
different patch if you have another variant at hand.

Pavel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Jean-Marc Lasgouttes

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 
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() && () == 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



Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Kornel Benko
Am Montag, 19. März 2018 21:46:05 CET schrieb Scott Kostyshak 
:
> On Mon, Feb 19, 2018 at 05:36:36PM +, Jean-Marc Lasgouttes wrote:
> > commit 56e012be83fd4fec1e21d750e961ff936cc8c889
> > Author: Jean-Marc Lasgouttes 
> > Date:   Mon Feb 19 18:24:29 2018 +0100
> > 
> > Improve metrics of equations. More work remains to be done.
> > 
> > Use proper value for above/below skip (12pt) instead of the hardcoded
> > 12 pixels.
> > 
> > Add forgotten skip before display math preview.
> > 
> > Make "too small preview" size dpi-dependent.
> > Make gap in front of equation (what is it good for, BTW?)
> > dpi-dependent.
> 
> Starting with this commit, when I view lib/fonts/test/stmary10.lyx and
> turn preview on, I see several previews marked with red. Attached is a
> screenshot. Is this change expected?
> 
> I'm on Ubuntu with Qt 5.6.2.
> 
> Scott

The red parts disappears here if I change the zoom.

Kornel


signature.asc
Description: This is a digitally signed message part.


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Jean-Marc Lasgouttes

Le 20/03/2018 à 13:10, Pavel Sanda a écrit :

I have been using mathed very intensively past few weeks and the main glitch
which is continuously frustrating me is that often I can't visually distinguish
whether I am in subscript or no. In larger equations involving fractions the
cursor moves vertically for only few pixels and it's extremely easy to think
that you are in the center of the parent inset. I continously lose my cursor
position in equation when hitting 'down' to get into subscript while I'm
actually already there.


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.


JMarc


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Scott Kostyshak
On Tue, Mar 20, 2018 at 11:38:12AM +, Jean-Marc Lasgouttes wrote:
> Le 20/03/2018 à 02:46, Scott Kostyshak a écrit :
> > Starting with this commit, when I view lib/fonts/test/stmary10.lyx and
> > turn preview on, I see several previews marked with red. Attached is a
> > screenshot. Is this change expected?
> 
> Here is the part that causes the issue, if I understand well:
> 
> +bool previewTooSmall(MetricsBase const & mb, Dimension const & dim)
> +{
> +   // Value was hardcoded to 10 pixels
> +   int const minval = mb.bv->zoomedPixels(10);
> +   return dim.width() <= minval && dim.height() <= minval;
> +}
>  }
> 
> This is part of an ongoing effort where I replace hardcoded values (here a
> "too small" preview is less than 10 pixels) by values that change with DPI
> and zoom. The assumption is that the user is working at a zoom level which
> is his/her comfort zone.
> 
> There is a ticket at  where racoon
> disagree with this concept and prefers that the wide row indicator does not
> have a changing width with zoom.
> 
> Similarly, I have a work in progress that changes the length and width of
> mathed corners depending on zoom.
> 
> It is probably a good time to have this discussion: do we want the UI
> element size/thickness to depend from dpi/zoom?

My first thought is that it makes sense to zoom.

What do other applications do in similar situations?

Is the symbol indicating a new line (from ctrl+return) also part of this
discussion?  Or it is viewed as a character so that's why it zooms?

Scott


signature.asc
Description: PGP signature


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Kornel Benko
Am Dienstag, 20. März 2018 13:34:53 CET schrieb Pavel Sanda :
> Be my guest and don't touch the rest :)

OK. Done.

Kornel


signature.asc
Description: This is a digitally signed message part.


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Pavel Sanda
Kornel Benko wrote:
> > > Why can't you use it if it is at other place?
> > > Copying would mean, that I had to copy (and commit) every time a change is
> > > done.
> > > Adding this directory to the tests is a possibility, but complicates even
> > > more the tests IMHO.
> > 
> > I do not think you understood the purpose of this file.
> 
> This is not important as long as the test finds errors. And in this case,
> the test would have found the lyx2lyx error which started the thread
>   "lyx2lyx conversion problem"

As said feel free to make any test you want. This particular lyx2lyx problem
was trigerred by the header of lyx file - even empty file would serve you well,
the content of stmary10.lyx is irrelevant here.

> > It belongs to the directory
> > fonts because the glyphs it renders comes from the ttf files there and its
> > to be used when when you debug their painting.
> 
> Add a Readme in lib/fonts/test? (To help my bad memory for instance)

Be my guest and don't touch the rest :)

I'm slowly working in that location these days.
Pavel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Kornel Benko
Am Dienstag, 20. März 2018 12:58:34 CET schrieb Pavel Sanda :
> Kornel Benko wrote:
> > > > I propose to move it to
> > > > 
> > > > autotests/export/fonts/stmary10.lyx
> > > > 
> > > > instead, and leave a readme in lib/fonts/test showing the new path.
> > > 
> > > No, please don't move it. But feel free to copy it to whatever test you
> > > have in mind. I'm working on the missing glyphs right now and this file
> > > is helpful where it is.
> > 
> > Why can't you use it if it is at other place?
> > Copying would mean, that I had to copy (and commit) every time a change is
> > done.
> > Adding this directory to the tests is a possibility, but complicates even
> > more the tests IMHO.
> 
> I do not think you understood the purpose of this file.

This is not important as long as the test finds errors. And in this case,
the test would have found the lyx2lyx error which started the thread
"lyx2lyx conversion problem"

> It's not meant for the test if the file compiles, but whether are the glyphs
> in the font rendered properly on the screen.

I see, screen rendering is not part of the test suite.

> It belongs to the directory
> fonts because the glyphs it renders comes from the ttf files there and its
> to be used when when you debug their painting.

Add a Readme in lib/fonts/test? (To help my bad memory for instance)

> Pavel

Kornel



signature.asc
Description: This is a digitally signed message part.


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Pavel Sanda
Jean-Marc Lasgouttes wrote:
> Similarly, I have a work in progress that changes the length and width of 
> mathed corners depending on zoom.
>
> It is probably a good time to have this discussion: do we want the UI 
> element size/thickness to depend from dpi/zoom?

This is hard to say until one sees the result visually.

I have been using mathed very intensively past few weeks and the main glitch
which is continuously frustrating me is that often I can't visually distinguish
whether I am in subscript or no. In larger equations involving fractions the
cursor moves vertically for only few pixels and it's extremely easy to think
that you are in the center of the parent inset. I continously lose my cursor
position in equation when hitting 'down' to get into subscript while I'm
actually already there.

It became so annoying that I thought to write about this separately, but since
we are already in this thread: would it be hard to make cursor smaller when you
go into nested small inset?

Pavel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Pavel Sanda
Kornel Benko wrote:
> > > I propose to move it to
> > > 
> > >   autotests/export/fonts/stmary10.lyx
> > > 
> > > instead, and leave a readme in lib/fonts/test showing the new path.
> > 
> > No, please don't move it. But feel free to copy it to whatever test you have
> > in mind. I'm working on the missing glyphs right now and this file is
> > helpful where it is.
> 
> Why can't you use it if it is at other place?
> Copying would mean, that I had to copy (and commit) every time a change is 
> done.
> Adding this directory to the tests is a possibility, but complicates even 
> more 
> the tests IMHO.

I do not think you understood the purpose of this file.
It's not meant for the test if the file compiles, but whether are the glyphs
in the font rendered properly on the screen. It belongs to the directory
fonts because the glyphs it renders comes from the ttf files there and its
to be used when when you debug their painting.

Pavel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Jean-Marc Lasgouttes

Le 20/03/2018 à 02:46, Scott Kostyshak a écrit :

Starting with this commit, when I view lib/fonts/test/stmary10.lyx and
turn preview on, I see several previews marked with red. Attached is a
screenshot. Is this change expected?


Here is the part that causes the issue, if I understand well:

+bool previewTooSmall(MetricsBase const & mb, Dimension const & dim)
+{
+   // Value was hardcoded to 10 pixels
+   int const minval = mb.bv->zoomedPixels(10);
+   return dim.width() <= minval && dim.height() <= minval;
+}
 }

This is part of an ongoing effort where I replace hardcoded values (here 
a "too small" preview is less than 10 pixels) by values that change with 
DPI and zoom. The assumption is that the user is working at a zoom level 
which is his/her comfort zone.


There is a ticket at  where 
racoon disagree with this concept and prefers that the wide row 
indicator does not have a changing width with zoom.


Similarly, I have a work in progress that changes the length and width 
of mathed corners depending on zoom.


It is probably a good time to have this discussion: do we want the UI 
element size/thickness to depend from dpi/zoom?


JMarc


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Kornel Benko
Am Dienstag, 20. März 2018 11:42:18 CET schrieb Pavel Sanda :
> Kornel Benko wrote:
> > Don't see it after latest commit from Riki.
> > 
> > Apropo, why is this test-file not part of the test suite?
> 
> What do you want to test there?

If it compiles of course.

> > I propose to move it to
> > 
> > autotests/export/fonts/stmary10.lyx
> > 
> > instead, and leave a readme in lib/fonts/test showing the new path.
> 
> No, please don't move it. But feel free to copy it to whatever test you have
> in mind. I'm working on the missing glyphs right now and this file is
> helpful where it is.

Why can't you use it if it is at other place?
Copying would mean, that I had to copy (and commit) every time a change is 
done.
Adding this directory to the tests is a possibility, but complicates even more 
the tests IMHO.

> Pavel

Kornel



signature.asc
Description: This is a digitally signed message part.


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Pavel Sanda
Kornel Benko wrote:
> Don't see it after latest commit from Riki.
> 
> Apropo, why is this test-file not part of the test suite?

What do you want to test there?

> I propose to move it to
>   autotests/export/fonts/stmary10.lyx
> instead, and leave a readme in lib/fonts/test showing the new path.

No, please don't move it. But feel free to copy it to whatever test you have in 
mind.
I'm working on the missing glyphs right now and this file is helpful where it 
is.

Pavel


Re: [LyX/master] Improve metrics of equations. More work remains to be done.

2018-03-20 Thread Kornel Benko
Am Montag, 19. März 2018 21:46:05 CET schrieb Scott Kostyshak 
:
> On Mon, Feb 19, 2018 at 05:36:36PM +, Jean-Marc Lasgouttes wrote:
> > commit 56e012be83fd4fec1e21d750e961ff936cc8c889
> > Author: Jean-Marc Lasgouttes 
> > Date:   Mon Feb 19 18:24:29 2018 +0100
> > 
> > Improve metrics of equations. More work remains to be done.
> > 
> > Use proper value for above/below skip (12pt) instead of the hardcoded
> > 12 pixels.
> > 
> > Add forgotten skip before display math preview.
> > 
> > Make "too small preview" size dpi-dependent.
> > Make gap in front of equation (what is it good for, BTW?)
> > dpi-dependent.
> 
> Starting with this commit, when I view lib/fonts/test/stmary10.lyx and
> turn preview on, I see several previews marked with red. Attached is a
> screenshot. Is this change expected?
> 
> I'm on Ubuntu with Qt 5.6.2.
> 
> Scott

Don't see it after latest commit from Riki.

Apropo, why is this test-file not part of the test suite?
I propose to move it to
autotests/export/fonts/stmary10.lyx
instead, and leave a readme in lib/fonts/test showing the new path.

Kornel


signature.asc
Description: This is a digitally signed message part.