]> git.lyx.org Git - features.git/commitdiff
Handle paragraph direction switch in captions (with polyglossia/bidi)
authorJuergen Spitzmueller <spitz@lyx.org>
Tue, 19 Nov 2019 12:37:44 +0000 (13:37 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:46 +0000 (15:48 +0200)
src/insets/Inset.h
src/insets/InsetFloat.h
src/output_latex.cpp

index f458121e7d7bab35ccfd43b73a0cd0b14d6671db..3f7178f6cf7b2160f9aa7ff0a43ead6ea4f0acad 100644 (file)
@@ -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; }
index 224017e7eafa72d8d389aae4d23e47dbb666ba3d..734ba515bafdfc446849c3a008d0915c0449063f 100644 (file)
@@ -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);
index 4124d2dd1c92fde9f5cf08cb62ca29808ed1277f..a349cbdccb0cc2071f2c15785415a9101bde84c6 100644 (file)
@@ -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;