[LyX/2.3.x] Force LTR for numeric citations
Juergen Spitzmueller
spitz at lyx.org
Sat Oct 19 13:43:47 UTC 2019
commit 1030c70b4820e85c4e2f7b5c5a624782a9c0dbc5
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Sun Aug 11 08:15:57 2019 +0200
Force LTR for numeric citations
Fixes: #3005
(cherry picked from commit cce9adc1859f0134800c2405200f1467c8564b13)
---
src/insets/InsetCitation.cpp | 15 +++++++++++++++
src/insets/InsetCitation.h | 2 ++
status.23x | 2 ++
3 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp
index 2444126..3e0bd6f 100644
--- a/src/insets/InsetCitation.cpp
+++ b/src/insets/InsetCitation.cpp
@@ -19,6 +19,7 @@
#include "BufferParams.h"
#include "BufferView.h"
#include "DispatchResult.h"
+#include "Font.h"
#include "FuncCode.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
@@ -443,6 +444,20 @@ docstring InsetCitation::basicLabel(bool for_xhtml) const
return '[' + label + ']';
}
+
+bool InsetCitation::forceLTR(OutputParams const & rp) const
+{
+ // We have to force LTR for numeric references
+ // [= plain BibTeX, numeric natbib and biblatex].
+ // Except for XeTeX/bidi . See #3005.
+ if (rp.local_font->isRightToLeft()
+ && rp.use_polyglossia
+ && rp.flavor == OutputParams::XETEX)
+ return false;
+ return (buffer().masterParams().citeEngine().list().front() == "basic"
+ || buffer().masterParams().citeEngineType() == ENGINE_TYPE_NUMERICAL);
+}
+
docstring InsetCitation::screenLabel() const
{
return cache.screen_label;
diff --git a/src/insets/InsetCitation.h b/src/insets/InsetCitation.h
index a8e9e18..7962809 100644
--- a/src/insets/InsetCitation.h
+++ b/src/insets/InsetCitation.h
@@ -70,6 +70,8 @@ public:
UpdateType utype, TocBackend & backend) const;
///
std::string contextMenuName() const;
+ ///
+ bool forceLTR(OutputParams const &) const;
//@}
/// \name Static public methods obligated for InsetCommand derived classes
diff --git a/status.23x b/status.23x
index 160126d..e005d5e 100644
--- a/status.23x
+++ b/status.23x
@@ -90,6 +90,8 @@ What's new
- Fix direction of roman numbers with RTL documents and LuaTeX.
+- Fix direction of numbered citations outside XeTeX/bidi (bug 3005).
+
- Fix direction of references with XeTeX/bidi (bug 11626).
- Fix interplay of the memoir class and custom page size/geometry (bug 10970).
More information about the lyx-cvs
mailing list