[LyX/master] Fix a lang edgecase

Juergen Spitzmueller spitz at lyx.org
Sat Aug 15 10:04:25 UTC 2020


commit dc4b11b0e92e364eedd91c081d9999f0959839a8
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sat Aug 15 12:28:38 2020 +0200

    Fix a lang edgecase
---
 src/Paragraph.cpp |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index e81eb2f..54d266e 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1058,13 +1058,15 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
 		Font const copy_font(running_font);
 		basefont = owner_->getLayoutFont(bparams, outerfont);
 		running_font = basefont;
-		if (!closeLanguage)
+		if (!closeLanguage && !lang_switched_at_inset)
 			running_font.setLanguage(copy_font.language());
 		// For these, we use switches, so they should be taken as
 		// base inside the inset.
 		basefont.fontInfo().setSize(copy_font.fontInfo().size());
 		basefont.fontInfo().setFamily(copy_font.fontInfo().family());
 		basefont.fontInfo().setSeries(copy_font.fontInfo().series());
+		if (!closeLanguage && lang_switched_at_inset)
+			basefont.setLanguage(copy_font.language());
 		// Now re-do font changes in a way needed here
 		// (using switches with multi-par insets)
 		InsetText const * textinset = inset->asInsetText();
@@ -1074,7 +1076,7 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
 			: false;
 		unsigned int count2 = basefont.latexWriteStartChanges(os, bparams,
 						      runparams, running_font,
-						      basefont, true,
+						      running_font, true,
 						      cprotect);
 		column += count2;
 		if (count2 == 0 && (lang_closed || lang_switched_at_inset))
@@ -2815,6 +2817,10 @@ void Paragraph::latex(BufferParams const & bparams,
 					basefont.fontInfo().setSize(save_basefont.fontInfo().size());
 					basefont.fontInfo().setFamily(save_basefont.fontInfo().family());
 					basefont.fontInfo().setSeries(save_basefont.fontInfo().series());
+					if (!closeLanguage && lang_switched_at_inset) {
+						basefont.setLanguage(save_basefont.language());
+						running_font.setLanguage(save_runningfont.language());
+					}
 				}
 				if (incremented)
 					--parInline;


More information about the lyx-cvs mailing list