mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Fix text direction of references with XeTeX/bidi
Fixes: #11626
(cherry picked from commit 231b36d950
)
This commit is contained in:
parent
f4e700be2a
commit
7c0d9eb4d9
@ -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
|
||||
|
@ -246,7 +246,7 @@ bool Inset::allowEmpty() const
|
||||
}
|
||||
|
||||
|
||||
bool Inset::forceLTR() const
|
||||
bool Inset::forceLTR(OutputParams const &) const
|
||||
{
|
||||
return getLayout().forceLTR();
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
///
|
||||
|
@ -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; }
|
||||
///
|
||||
|
@ -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_;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user