[LyX/master] Properly set the babel bidi option (#12862)

Juergen Spitzmueller spitz at lyx.org
Sun Aug 25 13:22:39 UTC 2024


commit 17ca2ac89c3b30caf0232db22640c6175118c1d0
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sun Aug 25 15:21:56 2024 +0200

    Properly set the babel bidi option (#12862)
---
 src/BufferParams.cpp | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 3115e6b03b..f82fd1d24c 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -3069,10 +3069,7 @@ bool BufferParams::useBidiPackage(OutputParams const & rp) const
 		// or package options
 		|| (rp.use_babel
 		    && LaTeXFeatures::isAvailableAtLeastFrom("babel", 2019, 4, 3)
-		    && (hasPackageOption("babel", "bidi-r")
-			|| hasPackageOption("babel", "bidi-l")
-			|| contains(options, "bidi-r")
-			|| contains(options, "bidi-l")))
+		    && useNonTeXFonts)
 		)
 		&& rp.flavor == Flavor::XeTeX;
 }
@@ -3556,6 +3553,18 @@ string BufferParams::babelCall(LaTeXFeatures const & features, string lang_opts,
 			lang_opts += force_provide;
 		}
 	}
+	if (useNonTeXFonts && features.hasRTLLanguage()) {
+		if (!lang_opts.empty())
+			lang_opts += ", ";
+		if (features.runparams().flavor == Flavor::XeTeX) {
+			// main language RTL?
+			if (language->rightToLeft())
+				lang_opts += "bidi=bidi-r";
+			else
+				lang_opts += "bidi=bidi-l";
+		} else
+			lang_opts += "bidi=basic";
+	}
 	// The prefs may require the languages to
 	// be submitted to babel itself (not the class).
 	if ((langoptions || have_mods) && !lang_opts.empty())


More information about the lyx-cvs mailing list