X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FFont.cpp;h=450d67fa3a1b794fbbd6717c0ef451fdf8f3099e;hb=c2d121f663b2814cad9190f03358d1362aab5ce5;hp=2f77c9bd951be4c3f6d815e3c6cd9ac6eddfff0b;hpb=e575e7eebd32d687f3e23be0eeca185adb3b341b;p=lyx.git diff --git a/src/Font.cpp b/src/Font.cpp index 2f77c9bd95..450d67fa3a 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -94,7 +94,7 @@ char const * LaTeXSizeNames[NUM_SIZE + 4] = { "tiny", "scriptsize", "footnotesize", "small", "normalsize", "large", "Large", "LARGE", "huge", "Huge", "error8", "error9", "error10", "error11" }; -} // namespace anon +} // namespace Font::Font(FontInfo bits, Language const * l) @@ -293,7 +293,7 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams, tmp += "{"; os << from_ascii(tmp); count += tmp.length(); - pushPolyglossiaLang(language()->polyglossia(), true); + pushLanguageName(language()->polyglossia(), true); } else if (language()->encoding()->package() != Encoding::CJK) { os << '{'; count += 1; @@ -329,6 +329,8 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams, "$$lang", language()->babel()); os << from_ascii(tmp); count += tmp.length(); + if (!lyxrc.language_command_end.empty()) + pushLanguageName(language()->babel(), true); } else if (language()->encoding()->package() != Encoding::CJK) { os << '{'; count += 1; @@ -352,7 +354,7 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams, if (!runparams.pass_thru && bits_.number() == FONT_ON && prev.fontInfo().number() != FONT_ON && (language()->lang() == "hebrew" - || language()->lang() == "farsi" + || language()->lang() == "farsi" || language()->lang() == "arabic_arabi")) { os << "{\\beginL "; count += 9; @@ -460,6 +462,7 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams, OutputParams const & runparams, Font const & base, Font const & next, + bool & needPar, bool const & closeLanguage) const { int count = 0; @@ -504,6 +507,11 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams, if (f.size() != FONT_SIZE_INHERIT) { // We only have to close if only size changed if (!env) { + if (needPar && !closeLanguage) { + os << "\\par"; + count += 4; + needPar = false; + } os << '}'; ++count; } @@ -564,8 +572,11 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams, && language()->encoding()->package() != Encoding::CJK) { os << '}'; ++count; - if (runparams.use_polyglossia) - popPolyglossiaLang(); + bool const using_begin_end = + runparams.use_polyglossia || + !lyxrc.language_command_end.empty(); + if (using_begin_end) + popLanguageName(); } return count;