commit 0789f2f2ae43742da200a27f10403f4c6a68713d
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Fri Dec 3 12:16:40 2021 +0100

    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\normalsize 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) and
    greyedout (which is fixed now), but may matter elsewhere. Also, I do
    not know what the situation with HTML is.
---
 lib/layouts/stdinsets.inc |    1 +
 src/LaTeXFeatures.cpp     |    8 ++++----
 src/OutputParams.h        |   21 ++++++++++++++++++++-
 src/Paragraph.cpp         |    7 +++----
 4 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc
index 2106d23..b604cbe 100644
--- a/lib/layouts/stdinsets.inc
+++ b/lib/layouts/stdinsets.inc
@@ -180,6 +180,7 @@ InsetLayout Note:Greyedout
        Requires              color,lyxgreyedout
        BgColor               greyedoutbg
        Font
+         Size                Normal
          Color               greyedouttext
        EndFont
        LabelFont
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index f321799..ad50374 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\\normalsize\\textcolor{note_fontcolor}\\ignorespaces%\n";
                else
-                       ods << "      
\\textcolor{note_fontcolor}\\beginL\\ignorespaces%\n";
+                       ods << "      
\\normalfont\\normalsize\\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\\normalsize\\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\\normalsize\\textcolor{note_fontcolor}\\bgroup\\ignorespaces}\n"
                    << "{\\ignorespacesafterend\\egroup}\n";
        }
 
diff --git a/src/OutputParams.h b/src/OutputParams.h
index 7ca5c1f..a909ddd 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 [!=]*='
+        *
+        * [**] before afed118a, which improved support for InsetLine;
+        * however, since 0e7ab29f, InsetLine does not depend on the
+        * current font anymore.
+       */
        Font const * local_font = nullptr;
 
        /** Document language lyx name
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 1bf48f1..da97d12 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -2539,10 +2539,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
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to