]> git.lyx.org Git - lyx.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>
Mon, 5 Aug 2019 14:30:01 +0000 (16:30 +0200)
Fixes: #11626
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

index d129cb403e237662bfc81f496fa113cec6a04454..311e9528070f7cf0dfe23ade396091b36d741dac 100644 (file)
@@ -1005,7 +1005,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 93866bacd7c9a24d1cb852ee2a583b7f070e1fe8..397a8d0380db6f773df9689221d731b4fdde025a 100644 (file)
@@ -246,7 +246,7 @@ bool Inset::allowEmpty() const
 }
 
 
-bool Inset::forceLTR() const
+bool Inset::forceLTR(OutputParams const &) const
 {
        return getLayout().forceLTR();
 }
index 0f76671ea821a709f684467af6906298351a41fa..f458121e7d7bab35ccfd43b73a0cd0b14d6671db 100644 (file)
@@ -242,7 +242,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 b92f19bb20b68c9c8e2cbde71d49ec4b22721182..2cba4f05fa3f47a13e80c170733a39ef0b4832a8 100644 (file)
@@ -110,7 +110,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 2e42ad0e0ad239ab08f3687b84e2ef461233d83f..58cd25be5f514101628625d90274ac3d7afc0176 100644 (file)
@@ -743,7 +743,7 @@ void InsetInfo::setText(docstring const & str, Language const * lang)
 }
 
 
-bool InsetInfo::forceLTR() const
+bool InsetInfo::forceLTR(OutputParams const &) const
 {
        return params_.force_ltr;
 }
index 2f1b65153b956efae0ea87af343fed3112b71bc3..6fa080d2be6aa05889c7c67ed5fc47c34a130574 100644 (file)
@@ -196,7 +196,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);
        ///
index e8eecedde90d8dc9bf6295e0dd1e358b223ff53e..82db322320aaae7d5d89bba6537ecfa69b65a120 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.useBidiPackage())
+               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 73de59f0a2367fb9d06f479720e7f26622277f1d..a6fc8c9d6415efd79d0eb437732553849bd54cc9 100644 (file)
@@ -172,7 +172,7 @@ public:
        void initUnicodeMath() const;
 
        /// 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);