From: Juergen Spitzmueller Date: Tue, 19 Nov 2019 12:37:44 +0000 (+0100) Subject: Handle paragraph direction switch in captions (with polyglossia/bidi) X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=47e3f9be8b1792245df5988d7b5cc9dde18e1ec3;p=features.git Handle paragraph direction switch in captions (with polyglossia/bidi) --- diff --git a/src/insets/Inset.h b/src/insets/Inset.h index f458121e7d..3f7178f6cf 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -423,6 +423,10 @@ public: /// if this inset has paragraphs should they be forced to use a /// local font language switch? virtual bool forceLocalFontSwitch() const { return false; } + /// if this inset has paragraphs should they be forced to use a + /// font language switch that switches paragraph directions + /// (relevant with polyglossia only)? + virtual bool forceParDirectionSwitch() const { return false; } /// Does the inset force a specific encoding? virtual Encoding const * forcedEncoding(Encoding const *, Encoding const *) const { return 0; } diff --git a/src/insets/InsetFloat.h b/src/insets/InsetFloat.h index 224017e7ea..734ba515ba 100644 --- a/src/insets/InsetFloat.h +++ b/src/insets/InsetFloat.h @@ -76,6 +76,8 @@ public: bool allowsCaptionVariation(std::string const &) const; /// LyXAlignment contentAlignment() const; + /// + bool forceParDirectionSwitch() const { return true; } private: /// void setCaptionType(std::string const & type); diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 4124d2dd1c..a349cbdccb 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -913,10 +913,12 @@ void TeXOnePar(Buffer const & buf, && runparams.local_font != nullptr && outer_language->rightToLeft() && !par_language->rightToLeft(); - bool const localswitch = runparams_in.for_search + bool const localswitch = + (runparams_in.for_search || text.inset().forceLocalFontSwitch() || (using_begin_end && text.inset().forcePlainLayout()) - || in_polyglossia_rtl_env; + || in_polyglossia_rtl_env) + && !text.inset().forceParDirectionSwitch(); if (localswitch) { lang_begin_command = use_polyglossia ? "\\text$$lang$$opts{" : lyxrc.language_command_local;