Re: Footnote size is larger on master (\normalsize is prepended)

2021-12-31 Thread Jean-Marc Lasgouttes

Le 30/12/2021 à 17:30, Scott Kostyshak a écrit :

On Tue, Dec 28, 2021 at 09:44:27AM +0100, Jürgen Spitzmüller wrote:

Am Montag, dem 27.12.2021 um 22:00 +0100 schrieb Jean-Marc Lasgouttes:

Good news. Still, I'd like to hear Jürgen's thoughts on that.


Go ahead. If it's carefully tested I have no objections.


JMarc, I suggest you commit. It has passed the ctests last time I tried
it, and it passed the manual diffpdf checks we did.


Thanks. I just did that and further fixed greyedoutnote to reset font 
size too.


We may still have an issue with inset that do not inherit font but only 
font size. We do not support this transparently.


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-12-30 Thread Scott Kostyshak
On Tue, Dec 28, 2021 at 09:44:27AM +0100, Jürgen Spitzmüller wrote:
> Am Montag, dem 27.12.2021 um 22:00 +0100 schrieb Jean-Marc Lasgouttes:
> > Good news. Still, I'd like to hear Jürgen's thoughts on that.
> 
> Go ahead. If it's carefully tested I have no objections.

JMarc, I suggest you commit. It has passed the ctests last time I tried
it, and it passed the manual diffpdf checks we did.

Scott


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-12-28 Thread Jürgen Spitzmüller
Am Montag, dem 27.12.2021 um 22:00 +0100 schrieb Jean-Marc Lasgouttes:
> Good news. Still, I'd like to hear Jürgen's thoughts on that.

Go ahead. If it's carefully tested I have no objections.

Jürgen



signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Footnote size is larger on master (\normalsize is prepended)

2021-12-27 Thread Jean-Marc Lasgouttes

Le 27/12/2021 à 17:47, Scott Kostyshak a écrit :

I did not check carefully, but I *think* the patch fixes the following
ctest that was failing:

   export/doc/ja/Tutorial_pdf5_systemF


Good news. Still, I'd like to hear Jürgen's thoughts on that.

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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-12-27 Thread Scott Kostyshak
On Mon, Dec 27, 2021 at 07:40:38PM +0100, Kornel Benko wrote:
> Am Mon, 27 Dec 2021 13:32:39 -0500
> schrieb Scott Kostyshak :
> 
> > On Mon, Dec 27, 2021 at 06:16:08PM +0100, Kornel Benko wrote:
> > > Am Mon, 27 Dec 2021 11:47:34 -0500
> > > schrieb Scott Kostyshak :
> > >   
> > > > On Wed, Dec 15, 2021 at 11:39:52AM +0100, Jean-Marc Lasgouttes wrote:  
> > > > > Le 09/12/2021 à 05:14, Scott Kostyshak a écrit :
> > > > > > I did some brief tests on other documents and it works fine from 
> > > > > > what I
> > > > > > can see. Small typo: "an non" -> "a non".
> > > > > 
> > > > > Thanks.
> > > > > 
> > > > > > > What else could I try to be convinced that it works? Do we have 
> > > > > > > font torture
> > > > > > > tests?
> > > > > > 
> > > > > > What would font torture tests do? Do you mean different font 
> > > > > > families,
> > > > > > or documents with things like \textbf{\textit{...{blah}}}?
> > > > > 
> > > > > More like insets that inherit outside fonts in the wrong way (like the
> > > > > footnote example).
> > > > > 
> > > > > > We do have documents with lots of different languages (and thus
> > > > > > scripts). If this is what you're looking for, look at the files
> > > > > > autotests/export/latex/languages/supported-languages*.lyx
> > > > > 
> > > > > More like nesting of insets in weird situations.
> > > > > 
> > > > > Jürgen, could you take a look at the patch and tell me what you think 
> > > > > of the
> > > > > approach at least? I have this feeling that we disagree about the 
> > > > > meaning of
> > > > > all this.
> > > > 
> > > > I did not check carefully, but I *think* the patch fixes the following
> > > > ctest that was failing:
> > > > 
> > > >   export/doc/ja/Tutorial_pdf5_systemF
> > > > 
> > > > Scott  
> > > 
> > > Still fails here.
> > > ...
> > > (/usr9/local/texlive/2021/texmf-dist/tex/generic/gettitlestring/gettitlestring.
> > > sty)) (/usr9/local/texlive/2021/texmf-dist/tex/latex/esint/uesint.fd)
> > > ! Use of \relax doesn't match its definition.
> > > \ensure@KanjiEncodingPair ...t \relax \reserved@a 
> > >   \@latex@error {KANJI 
> > > Encod...
> > > 
> > > l.64 \tableofcontents
> > >{}
> > > ? 
> > > 
> > > ! LaTeX Error: KANJI Encoding pair for `JY3' undefined.
> > > ...  
> > 
> > But if you apply JMarc's patch (8 Dec on this thread), does it then pass?
> > 
> > Scott
> 
> I see, it was not yet committed.
> Applied now.
> Passes now. Sorry for the noise.

No problem, thanks for confirming. I had done a bisect and arrived at
one of the "footnote" patches, and then remembered we had this related
patch pending so tried it.

Scott


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-12-27 Thread Kornel Benko
Am Mon, 27 Dec 2021 13:32:39 -0500
schrieb Scott Kostyshak :

> On Mon, Dec 27, 2021 at 06:16:08PM +0100, Kornel Benko wrote:
> > Am Mon, 27 Dec 2021 11:47:34 -0500
> > schrieb Scott Kostyshak :
> >   
> > > On Wed, Dec 15, 2021 at 11:39:52AM +0100, Jean-Marc Lasgouttes wrote:  
> > > > Le 09/12/2021 à 05:14, Scott Kostyshak a écrit :
> > > > > I did some brief tests on other documents and it works fine from what 
> > > > > I
> > > > > can see. Small typo: "an non" -> "a non".
> > > > 
> > > > Thanks.
> > > > 
> > > > > > What else could I try to be convinced that it works? Do we have 
> > > > > > font torture
> > > > > > tests?
> > > > > 
> > > > > What would font torture tests do? Do you mean different font families,
> > > > > or documents with things like \textbf{\textit{...{blah}}}?
> > > > 
> > > > More like insets that inherit outside fonts in the wrong way (like the
> > > > footnote example).
> > > > 
> > > > > We do have documents with lots of different languages (and thus
> > > > > scripts). If this is what you're looking for, look at the files
> > > > > autotests/export/latex/languages/supported-languages*.lyx
> > > > 
> > > > More like nesting of insets in weird situations.
> > > > 
> > > > Jürgen, could you take a look at the patch and tell me what you think 
> > > > of the
> > > > approach at least? I have this feeling that we disagree about the 
> > > > meaning of
> > > > all this.
> > > 
> > > I did not check carefully, but I *think* the patch fixes the following
> > > ctest that was failing:
> > > 
> > >   export/doc/ja/Tutorial_pdf5_systemF
> > > 
> > > Scott  
> > 
> > Still fails here.
> > ...
> > (/usr9/local/texlive/2021/texmf-dist/tex/generic/gettitlestring/gettitlestring.
> > sty)) (/usr9/local/texlive/2021/texmf-dist/tex/latex/esint/uesint.fd)
> > ! Use of \relax doesn't match its definition.
> > \ensure@KanjiEncodingPair ...t \relax \reserved@a 
> >   \@latex@error {KANJI 
> > Encod...
> > 
> > l.64 \tableofcontents
> >{}
> > ? 
> > 
> > ! LaTeX Error: KANJI Encoding pair for `JY3' undefined.
> > ...  
> 
> But if you apply JMarc's patch (8 Dec on this thread), does it then pass?
> 
> Scott

I see, it was not yet committed.
Applied now.
Passes now. Sorry for the noise.

Kornel


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-12-27 Thread Scott Kostyshak
On Mon, Dec 27, 2021 at 06:16:08PM +0100, Kornel Benko wrote:
> Am Mon, 27 Dec 2021 11:47:34 -0500
> schrieb Scott Kostyshak :
> 
> > On Wed, Dec 15, 2021 at 11:39:52AM +0100, Jean-Marc Lasgouttes wrote:
> > > Le 09/12/2021 à 05:14, Scott Kostyshak a écrit :  
> > > > I did some brief tests on other documents and it works fine from what I
> > > > can see. Small typo: "an non" -> "a non".  
> > > 
> > > Thanks.
> > >   
> > > > > What else could I try to be convinced that it works? Do we have font 
> > > > > torture
> > > > > tests?  
> > > > 
> > > > What would font torture tests do? Do you mean different font families,
> > > > or documents with things like \textbf{\textit{...{blah}}}?  
> > > 
> > > More like insets that inherit outside fonts in the wrong way (like the
> > > footnote example).
> > >   
> > > > We do have documents with lots of different languages (and thus
> > > > scripts). If this is what you're looking for, look at the files
> > > > autotests/export/latex/languages/supported-languages*.lyx  
> > > 
> > > More like nesting of insets in weird situations.
> > > 
> > > Jürgen, could you take a look at the patch and tell me what you think of 
> > > the
> > > approach at least? I have this feeling that we disagree about the meaning 
> > > of
> > > all this.  
> > 
> > I did not check carefully, but I *think* the patch fixes the following
> > ctest that was failing:
> > 
> >   export/doc/ja/Tutorial_pdf5_systemF
> > 
> > Scott
> 
> Still fails here.
> ...
> (/usr9/local/texlive/2021/texmf-dist/tex/generic/gettitlestring/gettitlestring.
> sty)) (/usr9/local/texlive/2021/texmf-dist/tex/latex/esint/uesint.fd)
> ! Use of \relax doesn't match its definition.
> \ensure@KanjiEncodingPair ...t \relax \reserved@a 
>   \@latex@error {KANJI 
> Encod...
> 
> l.64 \tableofcontents
>{}
> ? 
> 
> ! LaTeX Error: KANJI Encoding pair for `JY3' undefined.
> ...

But if you apply JMarc's patch (8 Dec on this thread), does it then pass?

Scott


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-12-27 Thread Kornel Benko
Am Mon, 27 Dec 2021 11:47:34 -0500
schrieb Scott Kostyshak :

> On Wed, Dec 15, 2021 at 11:39:52AM +0100, Jean-Marc Lasgouttes wrote:
> > Le 09/12/2021 à 05:14, Scott Kostyshak a écrit :  
> > > I did some brief tests on other documents and it works fine from what I
> > > can see. Small typo: "an non" -> "a non".  
> > 
> > Thanks.
> >   
> > > > What else could I try to be convinced that it works? Do we have font 
> > > > torture
> > > > tests?  
> > > 
> > > What would font torture tests do? Do you mean different font families,
> > > or documents with things like \textbf{\textit{...{blah}}}?  
> > 
> > More like insets that inherit outside fonts in the wrong way (like the
> > footnote example).
> >   
> > > We do have documents with lots of different languages (and thus
> > > scripts). If this is what you're looking for, look at the files
> > > autotests/export/latex/languages/supported-languages*.lyx  
> > 
> > More like nesting of insets in weird situations.
> > 
> > Jürgen, could you take a look at the patch and tell me what you think of the
> > approach at least? I have this feeling that we disagree about the meaning of
> > all this.  
> 
> I did not check carefully, but I *think* the patch fixes the following
> ctest that was failing:
> 
>   export/doc/ja/Tutorial_pdf5_systemF
> 
> Scott

Still fails here.
...
(/usr9/local/texlive/2021/texmf-dist/tex/generic/gettitlestring/gettitlestring.
sty)) (/usr9/local/texlive/2021/texmf-dist/tex/latex/esint/uesint.fd)
! Use of \relax doesn't match its definition.
\ensure@KanjiEncodingPair ...t \relax \reserved@a 
  \@latex@error {KANJI Encod...

l.64 \tableofcontents
   {}
? 

! LaTeX Error: KANJI Encoding pair for `JY3' undefined.
...

Kornel


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-12-27 Thread Scott Kostyshak
On Wed, Dec 15, 2021 at 11:39:52AM +0100, Jean-Marc Lasgouttes wrote:
> Le 09/12/2021 à 05:14, Scott Kostyshak a écrit :
> > I did some brief tests on other documents and it works fine from what I
> > can see. Small typo: "an non" -> "a non".
> 
> Thanks.
> 
> > > What else could I try to be convinced that it works? Do we have font 
> > > torture
> > > tests?
> > 
> > What would font torture tests do? Do you mean different font families,
> > or documents with things like \textbf{\textit{...{blah}}}?
> 
> More like insets that inherit outside fonts in the wrong way (like the
> footnote example).
> 
> > We do have documents with lots of different languages (and thus
> > scripts). If this is what you're looking for, look at the files
> > autotests/export/latex/languages/supported-languages*.lyx
> 
> More like nesting of insets in weird situations.
> 
> Jürgen, could you take a look at the patch and tell me what you think of the
> approach at least? I have this feeling that we disagree about the meaning of
> all this.

I did not check carefully, but I *think* the patch fixes the following
ctest that was failing:

  export/doc/ja/Tutorial_pdf5_systemF

Scott


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-12-15 Thread Jean-Marc Lasgouttes

Le 09/12/2021 à 05:14, Scott Kostyshak a écrit :

I did some brief tests on other documents and it works fine from what I
can see. Small typo: "an non" -> "a non".


Thanks.


What else could I try to be convinced that it works? Do we have font torture
tests?


What would font torture tests do? Do you mean different font families,
or documents with things like \textbf{\textit{...{blah}}}?


More like insets that inherit outside fonts in the wrong way (like the 
footnote example).



We do have documents with lots of different languages (and thus
scripts). If this is what you're looking for, look at the files
autotests/export/latex/languages/supported-languages*.lyx


More like nesting of insets in weird situations.

Jürgen, could you take a look at the patch and tell me what you think of 
the approach at least? I have this feeling that we disagree about the 
meaning of all this.


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-12-08 Thread Scott Kostyshak
On Wed, Dec 08, 2021 at 07:17:03PM +0100, Jean-Marc Lasgouttes wrote:
> Le 03/12/2021 à 17:00, Scott Kostyshak a écrit :
> > On Fri, Dec 03, 2021 at 12:46:13PM +0100, Jean-Marc Lasgouttes wrote:
> > > Le 31/10/2021 � 18:11, Scott Kostyshak a �crit�:
> > > > See the attached file. On master, \normalsize is included inside the 
> > > > footnote, which is different from 2.3.x.
> > > 
> > > Here is my take on how to properly fix this issue. I do not know however
> > > what it does in other situations. Scott, do you have magic scripts and 
> > > tests
> > > to see the effect of this?
> > 
> > No magic scripts. All I do is manually compile the 2.3.0 user documents
> > with 2.3.0 (or 2.3.x) and with master and then run 'diffpdf' on the
> > results. I'm not sure it makes sense to test that the LaTeX is
> > equivalent since often there are differences in LyX's LaTeX output that
> > are expected that do not cause a difference in the PDF output. We could
> > imagine some automated tests with e.g. 'comparepdf' (a commandline tool)
> > that I think could check whether the PDF output are the same. We'd have
> > to disable the date showing up.
> 
> OK, I have done the main manuals, and found in UserGuide a place where a
> greyedout note was inserted in bold context. This shows that a \normalfont
> was missing in the lyxgreyedout definition, and the updated patch adds that.

I did some brief tests on other documents and it works fine from what I
can see. Small typo: "an non" -> "a non".

> What else could I try to be convinced that it works? Do we have font torture
> tests?

What would font torture tests do? Do you mean different font families,
or documents with things like \textbf{\textit{...{blah}}}?

We do have documents with lots of different languages (and thus
scripts). If this is what you're looking for, look at the files
autotests/export/latex/languages/supported-languages*.lyx

Scott


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-12-08 Thread Jean-Marc Lasgouttes

Le 03/12/2021 à 17:00, Scott Kostyshak a écrit :

On Fri, Dec 03, 2021 at 12:46:13PM +0100, Jean-Marc Lasgouttes wrote:

Le 31/10/2021 � 18:11, Scott Kostyshak a �crit�:

See the attached file. On master, \normalsize is included inside the footnote, 
which is different from 2.3.x.


Here is my take on how to properly fix this issue. I do not know however
what it does in other situations. Scott, do you have magic scripts and tests
to see the effect of this?


No magic scripts. All I do is manually compile the 2.3.0 user documents
with 2.3.0 (or 2.3.x) and with master and then run 'diffpdf' on the
results. I'm not sure it makes sense to test that the LaTeX is
equivalent since often there are differences in LyX's LaTeX output that
are expected that do not cause a difference in the PDF output. We could
imagine some automated tests with e.g. 'comparepdf' (a commandline tool)
that I think could check whether the PDF output are the same. We'd have
to disable the date showing up.


OK, I have done the main manuals, and found in UserGuide a place where a 
greyedout note was inserted in bold context. This shows that a 
\normalfont was missing in the lyxgreyedout definition, and the updated 
patch adds that.


What else could I try to be convinced that it works? Do we have font 
torture tests?


JMarc

From d64803774ca24546c33e55dd9b22fefbb51ad4d1 Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes 
Date: Fri, 3 Dec 2021 12:16:40 +0100
Subject: [PATCH] Tentative patch: fix font inside footnote inset

An inset that resets its font (like Footnote) does not care at all
about enclosing font. Therefore the real starting point is the class
default font. This avoid cases where the footnote contents is forced
to \normalsize.

It turns out that the Greyedout note inset, did inherit font but was
declared as not doing it. This commmit changes the definition by
adding \normalfont so that no inheritance happens.

Note that actually \normalfont resets everything but the font size.
This does not matter for footnote (which has its own font size), but
may matter elsewhere, for example Greyedout. Also, I do not know what
the situation with HTML is.
---
 src/LaTeXFeatures.cpp |  8 
 src/OutputParams.h| 21 -
 src/Paragraph.cpp |  7 +++
 3 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 0344202c91..abe1ca1d79 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -560,9 +560,9 @@ docstring const lyxgreyedoutDef(bool const rtl, bool const ct, bool const lua, b
 			ods << "  \\if@rl%\n";
 		ods << "\\everypar{%\n";
 		if (lua)
-			ods << "  \\pardir TRT \\textdir TRT\\textcolor{note_fontcolor}\\ignorespaces%\n";
+			ods << "  \\pardir TRT \\textdir TRT\\normalfont\\textcolor{note_fontcolor}\\ignorespaces%\n";
 		else
-			ods << "  \\textcolor{note_fontcolor}\\beginL\\ignorespaces%\n";
+			ods << "  \\normalfont\\textcolor{note_fontcolor}\\beginL\\ignorespaces%\n";
 		ods << "}%\n";
 		if (ct)
 			ods << "\\colorlet{lyxadded}{lyxadded!30}\\colorlet{lyxdeleted}{lyxdeleted!30}%\n";
@@ -573,7 +573,7 @@ docstring const lyxgreyedoutDef(bool const rtl, bool const ct, bool const lua, b
 		ods << "  \\else%\n";
 		if (ct)
 			ods << "\\colorlet{lyxadded}{lyxadded!30}\\colorlet{lyxdeleted}{lyxdeleted!30}%\n";
-		ods << "\\textcolor{note_fontcolor}\\bgroup\\ignorespaces%\n"
+		ods << "\\normalfont\\textcolor{note_fontcolor}\\bgroup\\ignorespaces%\n"
 		<< "\\BODY\\ignorespacesafterend\\egroup%\n"
 		<< "  \\fi%\n"
 		<< "}\n";
@@ -583,7 +583,7 @@ docstring const lyxgreyedoutDef(bool const rtl, bool const ct, bool const lua, b
 		<< "{";
 		if (ct)
 			ods << "\\colorlet{lyxadded}{lyxadded!30}\\colorlet{lyxdeleted}{lyxdeleted!30}%\n ";
-		ods << "\\textcolor{note_fontcolor}\\bgroup\\ignorespaces}\n"
+		ods << "\\normalfont\\textcolor{note_fontcolor}\\bgroup\\ignorespaces}\n"
 		<< "{\\ignorespacesafterend\\egroup}\n";
 	}
 
diff --git a/src/OutputParams.h b/src/OutputParams.h
index 7ca5c1ff62..a909ddd925 100644
--- a/src/OutputParams.h
+++ b/src/OutputParams.h
@@ -139,7 +139,26 @@ public:
 	mutable int inulemcmd = 0;
 
 	/** the font at the point where the inset is
-	 */
+	 *
+	 * Note from lasgouttes: I have doubts on the semantics of this
+	 * variable. Until this is sorted out, here are some notes on the
+	 * history of local_font.
+	 *
+	 * A research that excludes test and assignment [*] shows that
+	 * this is only used to remember language, which is a different
+	 * story (and not changed by this patch). The only exception being
+	 * in InsetMathHull::getCtObject and InsetMathNest::latex to
+	 * support change tracking in insets, but I am not 100% sure that
+	 * this is required. And historically [**] local_font used to be
+	 * local_lang; it may be good to return to this simpler variable
+	 * later.
+	 *
+	 *  [*] git grep local_font src|grep -v 'local_font 

Re: Footnote size is larger on master (\normalsize is prepended)

2021-12-03 Thread Scott Kostyshak
On Fri, Dec 03, 2021 at 12:46:13PM +0100, Jean-Marc Lasgouttes wrote:
> Le 31/10/2021 � 18:11, Scott Kostyshak a �crit�:
> > See the attached file. On master, \normalsize is included inside the 
> > footnote, which is different from 2.3.x.
> 
> Here is my take on how to properly fix this issue. I do not know however
> what it does in other situations. Scott, do you have magic scripts and tests
> to see the effect of this?

No magic scripts. All I do is manually compile the 2.3.0 user documents
with 2.3.0 (or 2.3.x) and with master and then run 'diffpdf' on the
results. I'm not sure it makes sense to test that the LaTeX is
equivalent since often there are differences in LyX's LaTeX output that
are expected that do not cause a difference in the PDF output. We could
imagine some automated tests with e.g. 'comparepdf' (a commandline tool)
that I think could check whether the PDF output are the same. We'd have
to disable the date showing up.

Scott

> 
> My belief is that this is the correct way of doing things. Some other parts
> of the code may conflict with that, though.
> 
> I added in the commit message some notes gathered during my research, so
> that they do not get lost.
> 
> JMarc
> 
> -- 
> lyx-devel mailing list
> lyx-devel@lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-devel



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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-12-03 Thread Jean-Marc Lasgouttes

Le 31/10/2021 à 18:11, Scott Kostyshak a écrit :

See the attached file. On master, \normalsize is included inside the footnote, 
which is different from 2.3.x.


Here is my take on how to properly fix this issue. I do not know however 
what it does in other situations. Scott, do you have magic scripts and 
tests to see the effect of this?


My belief is that this is the correct way of doing things. Some other 
parts of the code may conflict with that, though.


I added in the commit message some notes gathered during my research, so 
that they do not get lost.


JMarc

>From 83bfbaf2bd4a0672ee1222f5454859a2dba9db6b Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes 
Date: Fri, 3 Dec 2021 12:16:40 +0100
Subject: [PATCH] Tentative patch: fix font inside footnote inset

An inset that resets its font (like Footnote) does not care at all
about enclosing font. Therefore the real starting point is the class
default font. This avoid cases where the footnote contents is forced
to \normalsize.

Note that actually \normalfont resets everything but the font size.
This does not matter for footnote (which has its own font size), but
may matter elsewhere.

Concerning local_font: a research that excludes test and assignment
[*] shows that this is only used to remember language, which is a
different story (and not changed by this patch). The only exception
being in InsetMathHull::getCtObject and InsetMathNest::latex to
support change tracking in insets, but I am not 100% sure that this is
required. And historically [**] local_font used to be local_lang; it
may be good to return to this simpler variable later.

[*] git grep local_font src|grep -v 'local_font [!=]*='

[**] before afed118a, which improved support for InsetLine; however,
since 0e7ab29f, InsetLine does not depend on the current font anymore.
---
 src/Paragraph.cpp | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 7fb46aee7d..f78925fafb 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -2533,10 +2533,9 @@ void Paragraph::latex(BufferParams const & bparams,
 	pos_type body_pos = beginOfBody();
 	unsigned int column = 0;
 
-	// If we are inside an non inheritFont() inset, the real outerfont is local_font
-	Font const real_outerfont = (!inInset().inheritFont()
- && runparams.local_font != nullptr)
-			? Font(runparams.local_font->fontInfo()) : outerfont;
+	// If we are inside an non inheritFont() inset, the outerfont is the default font
+	Font const real_outerfont =
+		inInset().inheritFont() ? outerfont : Font(bparams.documentClass().defaultfont());
 
 	if (body_pos > 0) {
 		// the optional argument is kept in curly brackets in
-- 
2.25.1

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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-11-03 Thread Jean-Marc Lasgouttes


Le 02/11/2021 à 15:52, Jürgen Spitzmüller a écrit :

With inheritFont() == false, we end up in unnecessary font switches at
footnote start, e.g. \footnote{\normalsize text ...} in section
headings (see Scott's example), and I want to avoid that.


Agreed. However it seems that the code
1/ looks at the outside font, sees that it is \normalsize
2/ look at footnote font and sees that it is \footnotesize
3/ decides to override the font size to do as if a footnote should 
plainly inherit the outside font.


There is _no_ reason in my opinion why the font outside the inset should 
be considered at all when inheritFont() is false. It is however 
difficult to follow the code in Paragraph::latex:


	// If we are inside an non inheritFont() inset, the real outerfont is 
local_font

Font const real_outerfont = (!inInset().inheritFont()
 && runparams.local_font != nullptr)
? Font(runparams.local_font->fontInfo()) : outerfont;

I think I know at some time what local_font was, but I forgot. I see 
that it is set in dozens of places in the code (which murmurs "fragile 
code" in my ear), but I am not sure why. AFAICS, this is more a language 
thing than a font thing (but I am even not sure of this).


OK, there is a comment about this variable:

/** the font at the point where the inset is
 */
Font const * local_font = nullptr;

If the comment is correct, then the code is wrong IMO.

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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-11-03 Thread Scott Kostyshak
On Wed, Nov 03, 2021 at 08:12:55AM +0100, Jürgen Spitzmüller wrote:
> Scott Kostyshak  schrieb am Mi., 3. Nov. 2021, 02:44:
> 
> >
> > Thanks for taking a look. I see, so master behavior is correct. I think
> > in most cases the intent is to not have it bold, i.e., I might look into
> > removing the bold in the .lyx files if I am motivated.
> >
> 
> I think a non-bold footnote symbol in otherwise bold context looks odd.

Good to know. I'll skip it then.

Scott


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-11-03 Thread Jürgen Spitzmüller
Scott Kostyshak  schrieb am Mi., 3. Nov. 2021, 02:44:

>
> Thanks for taking a look. I see, so master behavior is correct. I think
> in most cases the intent is to not have it bold, i.e., I might look into
> removing the bold in the .lyx files if I am motivated.
>

I think a non-bold footnote symbol in otherwise bold context looks odd.

Jürgen


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-11-02 Thread Scott Kostyshak
On Tue, Nov 02, 2021 at 08:33:47AM +0100, Jürgen Spitzmüller wrote:
> Am Montag, dem 01.11.2021 um 15:27 -0400 schrieb Scott Kostyshak:
> > Fixes the original issue from what I can see, although I know nothing
> > about the code. I'm not sure if the following is a related issue. See
> > attached. It's hard to see, but the in-line footnote number itself is
> > now bold on master. Note the "\bfseries" in the difference in TeX
> > code
> > produced below.
> > 
> > master with your patch:
> > 
> >   To set the bracket size for the second line correctly, the first
> > line
> >   is ended with \textbf{\textbackslash
> > right.}\index{Commands!R!right@\textbackslash right}
> >   and the second line with \textbf{\textbackslash
> > left.}{\bfseries\footnote{for more about \textbf{\textbackslash left}
> > and \textbf{\textbackslash right}
> > 
> > 2.3.x:
> > 
> >   To set the bracket size for the second line correctly, the first
> > line
> >   is ended with \textbf{\textbackslash
> > right.}\index{Commands!R!right@\textbackslash right}
> >   and the second line with \textbf{\textbackslash left.}\footnote{for
> > more about \textbf{\textbackslash left} and \textbf{\textbackslash
> > right}
> 
> I'd need to see the LyX file, but if the footnote itself is set bold
> there, master is correct and stable is wrong. This is something we
> fixed in master.

Thanks for taking a look. I see, so master behavior is correct. I think
in most cases the intent is to not have it bold, i.e., I might look into
removing the bold in the .lyx files if I am motivated.

Scott


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-11-02 Thread Jürgen Spitzmüller
Am Dienstag, dem 02.11.2021 um 15:52 +0100 schrieb Jürgen Spitzmüller:
> With inheritFont() == false, we end up in unnecessary font switches
> at footnote start, e.g. \footnote{\normalsize text ...} in section
> headings (see Scott's example), and I want to avoid that.

And note that this is not only cosmetic, but also wrong, as this resets
the footnote text size from \footnotesize to \normalsize. See attached
example and compare the output (both TeX and PDF) in stable and master.

Jürgen



footnote-size-is-different.23.lyx
Description: application/lyx


signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Footnote size is larger on master (\normalsize is prepended)

2021-11-02 Thread Jürgen Spitzmüller
Am Dienstag, dem 02.11.2021 um 15:40 +0100 schrieb Jean-Marc
Lasgouttes:
> Why do you want to inherit anything for the footnote? OK, it turns
> out that using \normalfont (as \footnotetext does) resets everything
> but the font size (I believe), but footnote does reset the font
> completely.

With inheritFont() == false, we end up in unnecessary font switches at
footnote start, e.g. \footnote{\normalsize text ...} in section
headings (see Scott's example), and I want to avoid that.

With inheritFont() == true, these switches are gone (as it should be),
but the font in the workarea is wrong.

resetsFontEdit() (layout's ResetsFont) does not help here, it does
something different (don't ask me, what).

If we are stuck with the current choices, I'd rather prefer wrong
workarea font that cluttered LaTeX output. 

Jürgen



signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Footnote size is larger on master (\normalsize is prepended)

2021-11-02 Thread Jean-Marc Lasgouttes

Le 02/11/2021 à 14:45, Jürgen Spitzmüller a écrit :

Am Dienstag, dem 02.11.2021 um 14:08 +0100 schrieb Jean-Marc
Lasgouttes:

I do not see the needed for treating the screen differently from the
lyx file.


My point was to differentiate inheritance of font properties on screen
from inheritance in the TeX output (nothing to do with the LyX file).
Some contexts (footnote is a case in point) require us to use different
font on screen but not change the font in output (as this is done by
the contexts themselves). So footnote should inheritFont() but not
inheritScreenFont(). This is not possible with the current mechanism
(and it only worked since font metrics were hardcoded in InsetFootlike
before you removed that hardcoding).


Why do you want to inherit anything for the footnote? OK, it turns out 
that using \normalfont (as \footnotetext does) resets everything but the 
font size (I believe), but footnote does reset the font completely. And 
I think that it makes sense that it does that. So the font at the point 
where the footnote is is not relevant semantically.


Since we have had this discussion already, so I guess the point is that 
you disagree with me. Otherwise, I think I know how we could coerce 
lyx2lyx to convert from resetfont to inheritfont.


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-11-02 Thread Jürgen Spitzmüller
Am Dienstag, dem 02.11.2021 um 14:08 +0100 schrieb Jean-Marc
Lasgouttes:
> I do not see the needed for treating the screen differently from the
> lyx file. 

My point was to differentiate inheritance of font properties on screen
from inheritance in the TeX output (nothing to do with the LyX file).
Some contexts (footnote is a case in point) require us to use different
font on screen but not change the font in output (as this is done by
the contexts themselves). So footnote should inheritFont() but not
inheritScreenFont(). This is not possible with the current mechanism
(and it only worked since font metrics were hardcoded in InsetFootlike
before you removed that hardcoding).

> I'll try to propose something, but currently I do not have much
> free time.

OK.

Jürgen


signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Footnote size is larger on master (\normalsize is prepended)

2021-11-02 Thread Jean-Marc Lasgouttes

Le 01/11/2021 à 10:29, Jürgen Spitzmüller a écrit :

Am Montag, dem 01.11.2021 um 09:56 +0100 schrieb Jürgen Spitzmüller:

(2.) revert b37929fd to correct the workarea font in footnotes (which
otherwise inherits the font of the context, e.g. section)

JMarc, what do you think about (2.)? It was part of your series to
address #12204.


On another look I tend to think that, rather than overwriting metrics
and draw in individual insets, we would need a method similar to
inheritFont() which only applies to screen font (I thought that
resetsFonEdit() is that, but it isn't).


I do not see the needed for treating the screen differently from the lyx 
file. I'll try to propose something, but currently I do not have much 
free time.


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-11-02 Thread Jürgen Spitzmüller
Am Montag, dem 01.11.2021 um 15:27 -0400 schrieb Scott Kostyshak:
> Fixes the original issue from what I can see, although I know nothing
> about the code. I'm not sure if the following is a related issue. See
> attached. It's hard to see, but the in-line footnote number itself is
> now bold on master. Note the "\bfseries" in the difference in TeX
> code
> produced below.
> 
> master with your patch:
> 
>   To set the bracket size for the second line correctly, the first
> line
>   is ended with \textbf{\textbackslash
> right.}\index{Commands!R!right@\textbackslash right}
>   and the second line with \textbf{\textbackslash
> left.}{\bfseries\footnote{for more about \textbf{\textbackslash left}
> and \textbf{\textbackslash right}
> 
> 2.3.x:
> 
>   To set the bracket size for the second line correctly, the first
> line
>   is ended with \textbf{\textbackslash
> right.}\index{Commands!R!right@\textbackslash right}
>   and the second line with \textbf{\textbackslash left.}\footnote{for
> more about \textbf{\textbackslash left} and \textbf{\textbackslash
> right}

I'd need to see the LyX file, but if the footnote itself is set bold
there, master is correct and stable is wrong. This is something we
fixed in master.

Jürgen


signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Footnote size is larger on master (\normalsize is prepended)

2021-11-01 Thread Scott Kostyshak
On Mon, Nov 01, 2021 at 11:21:49AM +0100, Jürgen Spitzmüller wrote:
> Am Montag, dem 01.11.2021 um 10:29 +0100 schrieb Jürgen Spitzmüller:
> > On another look I tend to think that, rather than overwriting metrics
> > and draw in individual insets, we would need a method similar to
> > inheritFont() which only applies to screen font (I thought that
> > resetsFonEdit() is that, but it isn't).
> 
> Something like the attached. I figure, in the long run we also need a
> layout tag.

Fixes the original issue from what I can see, although I know nothing
about the code. I'm not sure if the following is a related issue. See
attached. It's hard to see, but the in-line footnote number itself is
now bold on master. Note the "\bfseries" in the difference in TeX code
produced below.

master with your patch:

  To set the bracket size for the second line correctly, the first line
  is ended with \textbf{\textbackslash 
right.}\index{Commands!R!right@\textbackslash right}
  and the second line with \textbf{\textbackslash left.}{\bfseries\footnote{for 
more about \textbf{\textbackslash left} and \textbf{\textbackslash right}

2.3.x:

  To set the bracket size for the second line correctly, the first line
  is ended with \textbf{\textbackslash 
right.}\index{Commands!R!right@\textbackslash right}
  and the second line with \textbf{\textbackslash left.}\footnote{for more 
about \textbf{\textbackslash left} and \textbf{\textbackslash right}

Scott


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


Re: Footnote size is larger on master (\normalsize is prepended)

2021-11-01 Thread Jürgen Spitzmüller
Am Montag, dem 01.11.2021 um 10:29 +0100 schrieb Jürgen Spitzmüller:
> On another look I tend to think that, rather than overwriting metrics
> and draw in individual insets, we would need a method similar to
> inheritFont() which only applies to screen font (I thought that
> resetsFonEdit() is that, but it isn't).

Something like the attached. I figure, in the long run we also need a
layout tag.

Jürgen

diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp
index 400b7b66e8..c35526bd77 100644
--- a/src/RowPainter.cpp
+++ b/src/RowPainter.cpp
@@ -100,7 +100,7 @@ void RowPainter::paintInset(Row::Element const & e) const
 	bool const pi_do_spellcheck = pi_.do_spellcheck;
 	Change const pi_change = pi_.change;
 
-	pi_.base.font = e.inset->inheritFont() ? e.font.fontInfo() :
+	pi_.base.font = e.inset->inheritScreenFont() ? e.font.fontInfo() :
 		pi_.base.bv->buffer().params().getFont().fontInfo();
 	pi_.ltr_pos = !e.font.isVisibleRightToLeft();
 	pi_.change = pi_.change.changed() ? pi_.change : e.change;
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index a2a3e4b427..e8a13dc3f8 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -505,7 +505,7 @@ bool TextMetrics::redoParagraph(pit_type const pit, bool const align_rows)
 		Dimension dim;
 		int const w = max_width_ - leftMargin(pit, e.pos)
 			- right_margin - eop;
-		Font const & font = e.inset->inheritFont() ?
+		Font const & font = e.inset->inheritScreenFont() ?
 			displayFont(pit, e.pos) : bufferfont;
 		MacroContext mc(, parPos);
 		MetricsInfo mi(bv_, font.fontInfo(), w, mc, e.pos == 0, tight_);
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index af24423e4e..d62cc5d556 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -591,6 +591,11 @@ public:
 	 * Otherwise the document default font is used.
 	 */
 	virtual bool inheritFont() const { return true; }
+	/**
+	 * This method only applies to the screen font. It can be overriden
+	 * if output and screen font inheritance differ.
+	 */
+	virtual bool inheritScreenFont() const { return inheritFont(); }
 	/**
 	 * If this method returns true all explicitly set font attributes
 	 * are reset during editing operations.
diff --git a/src/insets/InsetFootlike.h b/src/insets/InsetFootlike.h
index e0a3fd31d0..fb53b33ee2 100644
--- a/src/insets/InsetFootlike.h
+++ b/src/insets/InsetFootlike.h
@@ -31,10 +31,10 @@ private:
 	void write(std::ostream & os) const override;
 	///
 	bool insetAllowed(InsetCode) const override;
-	/** returns false if, when outputting LaTeX, font changes should
-	be closed before generating this inset. This is needed for
-	insets that may contain several paragraphs */
-	bool inheritFont() const override { return false; }
+	/// Footnotes have InheritFont true (do not need to
+	/// explicitly reset fonts in output, but the screen font
+	/// differs from context
+	bool inheritScreenFont() const override { return false; }
 };
 
 


signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Footnote size is larger on master (\normalsize is prepended)

2021-11-01 Thread Jürgen Spitzmüller
Am Montag, dem 01.11.2021 um 09:56 +0100 schrieb Jürgen Spitzmüller:
> (2.) revert b37929fd to correct the workarea font in footnotes (which
> otherwise inherits the font of the context, e.g. section)
> 
> JMarc, what do you think about (2.)? It was part of your series to
> address #12204.

On another look I tend to think that, rather than overwriting metrics
and draw in individual insets, we would need a method similar to
inheritFont() which only applies to screen font (I thought that
resetsFonEdit() is that, but it isn't).

Jürgen



signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Footnote size is larger on master (\normalsize is prepended)

2021-11-01 Thread Jürgen Spitzmüller
Am Sonntag, dem 31.10.2021 um 13:11 -0400 schrieb Scott Kostyshak:
> See the attached file. On master, \normalsize is included inside the
> footnote, which is different from 2.3.x.

To fix this, one needs 

(1.) to set inheritFont() in InsetFootlike to true (i.e., back to
default) in order to prevent unnecessary font switches and

(2.) revert b37929fd to correct the workarea font in footnotes (which
otherwise inherits the font of the context, e.g. section)

JMarc, what do you think about (2.)? It was part of your series to
address #12204.

Jürgen



signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel