]> git.lyx.org Git - features.git/commitdiff
Fix text direction of references with XeTeX/bidi
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 5 Aug 2019 14:30:01 +0000 (16:30 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Tue, 6 Aug 2019 08:07:41 +0000 (10:07 +0200)
Fixes: #11626
(cherry picked from commit 231b36d95011f99993684add6e0cdd6012ec13d4)

src/Paragraph.cpp
src/insets/Inset.cpp
src/insets/Inset.h
src/insets/InsetGraphics.h
src/insets/InsetHyperlink.h
src/insets/InsetInfo.cpp
src/insets/InsetInfo.h
src/insets/InsetRef.cpp
src/insets/InsetRef.h
src/mathed/InsetMathHull.h
status.23x

index d95c53138701e634a53697168fb40b5e8f10d6ea..6718bf35dbc222236f648ffac4d32d6b6511d44e 100644 (file)
@@ -1089,7 +1089,7 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
        bool close = false;
        odocstream::pos_type const len = os.os().tellp();
 
-       if (inset->forceLTR()
+       if (inset->forceLTR(runparams)
            && running_font.isRightToLeft()
            // ERT is an exception, it should be output with no
            // decorations at all
index 0257ed0c45f1c56dad489b94ccbda9811dc89e2d..3ab5f33bc4f6b2b11253eacab4f7e1e5b7192436 100644 (file)
@@ -246,7 +246,7 @@ bool Inset::allowEmpty() const
 }
 
 
-bool Inset::forceLTR() const
+bool Inset::forceLTR(OutputParams const &) const
 {
        return getLayout().forceLTR();
 }
index fe58cd434ec698868327e4cc0c0e849539a2e79f..a1c0518a2cc729438e598cc69485fbe44b0db6aa 100644 (file)
@@ -237,7 +237,7 @@ public:
        /// Don't eliminate empty paragraphs
        virtual bool allowEmpty() const;
        /// Force inset into LTR environment if surroundings are RTL
-       virtual bool forceLTR() const;
+       virtual bool forceLTR(OutputParams const &) const;
        /// whether to include this inset in the strings generated for the TOC
        virtual bool isInToc() const;
 
index 27f9cf1caf8583e56e78c78d7c159b2ad3641c98..28ea3372464862c851fb2d849fff9c8d8c0cfda4 100644 (file)
@@ -106,7 +106,7 @@ private:
        ///
        std::string contextMenuName() const;
        /// Force inset into LTR environment if surroundings are RTL
-       bool forceLTR() const { return true; }
+       bool forceLTR(OutputParams const &) const { return true; }
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd);
        ///
index a70200cc7523c7f1b6413ce64473b1bbd5292acb..d5da130d763e3d0e58486501ad58feb4056baa96 100644 (file)
@@ -32,7 +32,7 @@ public:
        ///
        bool hasSettings() const { return true; }
        ///
-       bool forceLTR() const { return true; }
+       bool forceLTR(OutputParams const &) const { return true; }
        ///
        bool isInToc() const { return true; }
        ///
index 13dd240f1373475d738e16ed06dcadcba6b45f47..a3b83428d3d139332e6bd49ce970e9d3a2e2d800 100644 (file)
@@ -297,7 +297,7 @@ void InsetInfo::setText(docstring const & str)
 }
 
 
-bool InsetInfo::forceLTR() const
+bool InsetInfo::forceLTR(OutputParams const &) const
 {
        return !buffer().params().language->rightToLeft() || force_ltr_;
 }
index 36b224e56648e655c321b95d73eb21b406f42314..57549e3382eb75b1c301e01b01820053008427a2 100644 (file)
@@ -126,7 +126,7 @@ public:
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd);
        /// Force inset into LTR environment if surroundings are RTL
-       bool forceLTR() const;
+       bool forceLTR(OutputParams const &) const;
        ///
        void setInfo(std::string const & info);
        /// update info_ and text
index d5901d505a16270370593bb911b1828862fd3f3e..0b9669d01aa3cdcb22c92743b3763f402c400ee6 100644 (file)
@@ -471,11 +471,16 @@ void InsetRef::validate(LaTeXFeatures & features) const
                features.require("nameref");
 }
 
-bool InsetRef::forceLTR() const
+bool InsetRef::forceLTR(OutputParams const & rp) const
 {
-       // We force LTR for references. Namerefs are output in the scripts direction
-       // at least with fontspec/bidi, though (see #11518).
+       // We force LTR for references. However,
+       // * Namerefs are output in the scripts direction
+       //   at least with fontspec/bidi and luabidi, though (see #11518).
+       // * Parentheses are automatically swapped with XeTeX/bidi 
+       //   [not with LuaTeX/luabidi] (see #11626).
        // FIXME: Re-Audit all other RTL cases.
+       if (rp.use_polyglossia && rp.flavor == OutputParams::XETEX)
+               return false;
        return (getCmdName() != "nameref" || !buffer().masterParams().useNonTeXFonts);
 }
 
index 3e3e7b07d94fd9c2f68f43c5e5c0cd68263f7ba8..c1860e1a4c298712f491a00a885893da303ac294 100644 (file)
@@ -73,7 +73,7 @@ public:
        void addToToc(DocIterator const & di, bool output_active,
                                  UpdateType utype, TocBackend & backend) const;
        ///
-       bool forceLTR() const;
+       bool forceLTR(OutputParams const &) const;
        //@}
 
        /// \name Static public methods obligated for InsetCommand derived classes
index 6f9f90873ceb8f435877d882a2dd10f807073010..132003a6fb37ef94d78b40be69e2adcb7cb8daab 100644 (file)
@@ -179,7 +179,7 @@ public:
        static int displayMargin() { return 12; }
 
        /// Force inset into LTR environment if surroundings are RTL
-       virtual bool forceLTR() const { return true; }
+       virtual bool forceLTR(OutputParams const &) const { return true; }
        ///
        void recordLocation(DocIterator const & di);
 
index cc615f005f6c2820cb1aabdd83b1da18eeb0347b..a4d3324dd51ef9697981c3330b8817fda22eeeed 100644 (file)
@@ -83,6 +83,8 @@ What's new
 
 - Fix direction of roman numbers with RTL documents and LuaTeX.
 
+- Fix direction of references with XeTeX/bidi (bug 11626).
+
 
 * USER INTERFACE