[LyX/master] Address an edge case where we need to loaf fontspec also with babel

Juergen Spitzmueller spitz at lyx.org
Sat Feb 18 14:18:54 UTC 2023


commit 2987530434105787d13fe6d6796da678dc5ee370
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sat Feb 18 16:12:49 2023 +0100

    Address an edge case where we need to loaf fontspec also with babel
---
 src/BufferParams.cpp |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 4d7550a..e702b18 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -1921,8 +1921,12 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
 
 	if (useNonTeXFonts) {
 		// Babel (as of 2017/11/03) loads fontspec itself
+		// However, it does so only if a non-default font is requested via \babelfont
+		// Thus load fontspec if this is not the case and we need fontspec features
 		if (!features.isProvided("fontspec")
-		    && !(features.useBabel() && features.isAvailableAtLeastFrom("babel", 2017, 11, 3)))
+		    && !(features.useBabel() && features.isAvailableAtLeastFrom("babel", 2017, 11, 3)
+			&& (fontsRoman() != "default" || fontsSans() != "default" || fontsTypewriter() != "default")
+			&& !features.isRequired("textquotesinglep") && !features.isRequired("textquotedoublep")))
 			os << "\\usepackage{fontspec}\n";
 		if (features.mustProvide("unicode-math")
 		    && features.isAvailable("unicode-math"))


More information about the lyx-cvs mailing list