commit ea08384bd42f272838afaec39316933a084f99d8
Author: Juergen Spitzmueller <[email protected]>
Date:   Fri Jan 23 12:51:36 2026 +0100

    Properly resolve font in insets that do not iherit font (#13278)
---
 src/output_latex.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index 8ae99ca38d..adaf16f782 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -861,9 +861,14 @@ void TeXOnePar(Buffer const & buf,
        // This paragraph is merged and we do not show changes in the output
        bool const merged_par = !bparams.output_changes && 
par.parEndChange().deleted();
 
-       if (text.inset().isPassThru()) {
-               Font const outerfont = text.outerFont(pit);
+       // If we are inside an inset that does not inherit font,
+       // the outerfont is the buffer's main font, otherwise
+       // the (top-level) environment's font
+       Font const outerfont = par.inInset().inheritFont()
+                       ? text.outerFont(pit)
+                       : Font(bparams.getFont());
 
+       if (text.inset().isPassThru()) {
                // No newline before first paragraph in this lyxtext
                if (pit > 0 && !text.inset().getLayout().parbreakIgnored() && 
!merged_par) {
                        os << '\n';
@@ -886,7 +891,6 @@ void TeXOnePar(Buffer const & buf,
                state->nest_level_ += 1;
 
        if (style.pass_thru) {
-               Font const outerfont = text.outerFont(pit);
                parStartCommand(par, os, runparams, style);
                if (style.isCommand() && style.needprotect)
                        // Due to the moving argument, some fragile
@@ -1241,8 +1245,6 @@ void TeXOnePar(Buffer const & buf,
                                bparams.postpone_fragile_content;
        }
 
-       Font const outerfont = text.outerFont(pit);
-
        // FIXME UNICODE
        os << from_utf8(everypar);
        par.latex(bparams, outerfont, os, runparams, start_pos, end_pos, force);
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to