[LyX/master] Correctly re-set font before and after non-multipar inset
Juergen Spitzmueller
spitz at lyx.org
Sat Aug 15 04:41:17 UTC 2020
commit 04ba887e2c7748c2bd2d244fa2e6aa46780318c7
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Sat Aug 15 07:06:20 2020 +0200
Correctly re-set font before and after non-multipar inset
---
src/Paragraph.cpp | 39 +++++++++++++++++++++++----------------
1 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 92f6ea1..7fd7eeb 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1060,18 +1060,6 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
lang_closed = count > 0;
lang_switched_at_inset = prev_font.language() != running_font.language();
}
- // Now re-do font changes in a way needed here
- // (using switches with multi-par insets)
- InsetText const * textinset = inset->asInsetText();
- bool const cprotect = textinset
- ? textinset->hasCProtectContent(runparams.moving_arg)
- && !textinset->text().isMainText()
- : false;
- unsigned int count2 = running_font.latexWriteStartChanges(os, bparams,
- runparams, basefont,
- running_font, true,
- cprotect);
- column += count2;
// Update the running_font, making sure, however,
// to leave the language as it was.
// FIXME: probably a better way to keep track of the old
@@ -1086,6 +1074,18 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
basefont.fontInfo().setSize(copy_font.fontInfo().size());
basefont.fontInfo().setFamily(copy_font.fontInfo().family());
basefont.fontInfo().setSeries(copy_font.fontInfo().series());
+ // Now re-do font changes in a way needed here
+ // (using switches with multi-par insets)
+ InsetText const * textinset = inset->asInsetText();
+ bool const cprotect = textinset
+ ? textinset->hasCProtectContent(runparams.moving_arg)
+ && !textinset->text().isMainText()
+ : false;
+ unsigned int count2 = basefont.latexWriteStartChanges(os, bparams,
+ runparams, running_font,
+ basefont, true,
+ cprotect);
+ column += count2;
if (count2 == 0 && (lang_closed || lang_switched_at_inset))
// All fonts closed
open_font = false;
@@ -2785,16 +2785,23 @@ void Paragraph::latex(BufferParams const & bparams,
incremented = true;
}
}
- // We need to restore these after insets with
+ // We need to restore parts of this after insets with
// allowMultiPar() true
- Font const save_running_font = running_font;
Font const save_basefont = basefont;
d->latexInset(bparams, os, rp, running_font,
basefont, real_outerfont, open_font,
runningChange, style, i, column);
if (multipar_inset) {
- running_font = save_running_font;
- basefont = save_basefont;
+ if (open_font) {
+ bool needPar = false;
+ column += running_font.latexWriteEndChanges(
+ os, bparams, runparams,
+ basefont, basefont, needPar);
+ open_font = false;
+ }
+ basefont.fontInfo().setSize(save_basefont.fontInfo().size());
+ basefont.fontInfo().setFamily(save_basefont.fontInfo().family());
+ basefont.fontInfo().setSeries(save_basefont.fontInfo().series());
}
if (incremented)
--parInline;
More information about the lyx-cvs
mailing list