mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
Redo "Move some tests upstream, since we'll need it there" properly
This commit is contained in:
parent
d31e829462
commit
24af4ffcb3
@ -343,7 +343,9 @@ public:
|
|||||||
Layout const & style,
|
Layout const & style,
|
||||||
pos_type & i,
|
pos_type & i,
|
||||||
unsigned int & column,
|
unsigned int & column,
|
||||||
bool const fontswitch_inset);
|
bool const fontswitch_inset,
|
||||||
|
bool const closeLanguage,
|
||||||
|
bool const lang_switched_at_inset);
|
||||||
|
|
||||||
///
|
///
|
||||||
void latexSpecialChar(
|
void latexSpecialChar(
|
||||||
@ -959,7 +961,9 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
|
|||||||
Layout const & style,
|
Layout const & style,
|
||||||
pos_type & i,
|
pos_type & i,
|
||||||
unsigned int & column,
|
unsigned int & column,
|
||||||
bool const fontswitch_inset)
|
bool const fontswitch_inset,
|
||||||
|
bool const closeLanguage,
|
||||||
|
bool const lang_switched_at_inset)
|
||||||
{
|
{
|
||||||
Inset * inset = owner_->getInset(i);
|
Inset * inset = owner_->getInset(i);
|
||||||
LBUFERR(inset);
|
LBUFERR(inset);
|
||||||
@ -1030,21 +1034,7 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (open_font && (!inset->inheritFont() || fontswitch_inset)) {
|
if (open_font && (!inset->inheritFont() || fontswitch_inset)) {
|
||||||
// Some insets cannot be inside a font change command.
|
|
||||||
// However, even such insets *can* be placed in \L or \R
|
|
||||||
// or their equivalents (for RTL language switches),
|
|
||||||
// so we don't close the language in those cases
|
|
||||||
// (= differing isRightToLeft()).
|
|
||||||
// ArabTeX, though, doesn't seem to handle this special behavior.
|
|
||||||
bool const inRLSwitch =
|
|
||||||
basefont.isRightToLeft() != running_font.isRightToLeft()
|
|
||||||
&& basefont.language()->lang() != "arabic_arabtex"
|
|
||||||
&& running_font.language()->lang() != "arabic_arabtex";
|
|
||||||
// Having said that, PassThru insets must be inside a font change command,
|
|
||||||
// as we do not re-open the font inside. So:
|
|
||||||
bool const closeLanguage = !inset->isPassThru() && !inRLSwitch;
|
|
||||||
bool lang_closed = false;
|
bool lang_closed = false;
|
||||||
bool lang_switched_at_inset = false;
|
|
||||||
// Close language if needed
|
// Close language if needed
|
||||||
if (closeLanguage) {
|
if (closeLanguage) {
|
||||||
// We need prev_font here as language changes directly at inset
|
// We need prev_font here as language changes directly at inset
|
||||||
@ -1060,7 +1050,6 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
|
|||||||
needPar, closeLanguage);
|
needPar, closeLanguage);
|
||||||
column += count;
|
column += count;
|
||||||
lang_closed = count > 0;
|
lang_closed = count > 0;
|
||||||
lang_switched_at_inset = prev_font.language() != running_font.language();
|
|
||||||
}
|
}
|
||||||
// Update the running_font, making sure, however,
|
// Update the running_font, making sure, however,
|
||||||
// to leave the language as it was.
|
// to leave the language as it was.
|
||||||
@ -2601,6 +2590,23 @@ void Paragraph::latex(BufferParams const & bparams,
|
|||||||
&& getInset(i)->allowMultiPar()
|
&& getInset(i)->allowMultiPar()
|
||||||
&& getInset(i)->lyxCode() != ERT_CODE;
|
&& getInset(i)->lyxCode() != ERT_CODE;
|
||||||
|
|
||||||
|
bool closeLanguage = false;
|
||||||
|
bool lang_switched_at_inset = false;
|
||||||
|
if (fontswitch_inset) {
|
||||||
|
// Some insets cannot be inside a font change command.
|
||||||
|
// However, even such insets *can* be placed in \L or \R
|
||||||
|
// or their equivalents (for RTL language switches),
|
||||||
|
// so we don't close the language in those cases
|
||||||
|
// (= differing isRightToLeft()).
|
||||||
|
// ArabTeX, though, doesn't seem to handle this special behavior.
|
||||||
|
closeLanguage = basefont.isRightToLeft() == current_font.isRightToLeft()
|
||||||
|
|| basefont.language()->lang() == "arabic_arabtex"
|
||||||
|
|| current_font.language()->lang() == "arabic_arabtex";
|
||||||
|
// We need to check prev_font as language changes directly at inset
|
||||||
|
// will only be started inside the inset.
|
||||||
|
lang_switched_at_inset = prev_font.language() != current_font.language();
|
||||||
|
}
|
||||||
|
|
||||||
// Do we need to close the previous font?
|
// Do we need to close the previous font?
|
||||||
if (open_font &&
|
if (open_font &&
|
||||||
((current_font != running_font
|
((current_font != running_font
|
||||||
@ -2798,7 +2804,8 @@ void Paragraph::latex(BufferParams const & bparams,
|
|||||||
Font const save_basefont = basefont;
|
Font const save_basefont = basefont;
|
||||||
d->latexInset(bparams, os, rp, running_font,
|
d->latexInset(bparams, os, rp, running_font,
|
||||||
basefont, real_outerfont, open_font,
|
basefont, real_outerfont, open_font,
|
||||||
runningChange, style, i, column, fontswitch_inset);
|
runningChange, style, i, column, fontswitch_inset,
|
||||||
|
closeLanguage, lang_switched_at_inset);
|
||||||
if (fontswitch_inset) {
|
if (fontswitch_inset) {
|
||||||
if (open_font) {
|
if (open_font) {
|
||||||
bool needPar = false;
|
bool needPar = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user