[LyX/2.5.x] Properly resolve font in insets that do not inherit font (#13278)

Juergen Spitzmueller spitz at lyx.org
Wed Feb 25 05:36:02 UTC 2026


commit d0ef93ccacfc3828da6a9292b2c53f21b013f450
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Fri Jan 23 12:51:36 2026 +0100

    Properly resolve font in insets that do not inherit font (#13278)
    
    (cherry picked from commit ea08384bd42f272838afaec39316933a084f99d8)
---
 src/output_latex.cpp | 12 +++++++-----
 status.25x           |  2 ++
 2 files changed, 9 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);
diff --git a/status.25x b/status.25x
index 2fb84414de..cf1b90e886 100644
--- a/status.25x
+++ b/status.25x
@@ -46,6 +46,8 @@ What's new
 
 * DOCUMENT INPUT/OUTPUT
 
+- Properly resolve font in insets that do not inherit font (bug 13278).
+
 - Fix old docbook layouts.
 
 


More information about the lyx-cvs mailing list