]> git.lyx.org Git - features.git/commitdiff
Use \babelfonts only if babel >= 3.15 is available.
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 13 Jul 2019 06:42:42 +0000 (08:42 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sat, 13 Jul 2019 06:42:42 +0000 (08:42 +0200)
lib/chkconfig.ltx
lib/doc/LaTeXConfig.lyx
src/BufferParams.cpp

index 970b26baaa254a19580287d1ed754454ab74d01c..fb04719377992452d0d76545675b89d21e0bec16 100644 (file)
     #6
   \fi}
 
+% Tests whether an package is present in a specific version (or newer)
+% Syntax: \TestPackageVersion{<name>}{<yyyy/mm/dd>}
+% Note: This requires the package to be loaded first
+
+\newcommand{\TestPackageVersion}[2]{
+  \message{^^J\prefix checking for package #1 at least as of #2...}
+  \IfFileExists{#1.sty}
+  {
+    \@ifpackagelater{#1}{#2}{\existstrue}{\existsfalse}
+  }
+  {
+    \existsfalse
+  }
+  \ifexists
+    \message{yes^^J}
+    \AddVariable{#1}{yes}
+    \AddPackage{#1-#2}
+  \else
+    \message{no^^J}
+    \AddVariable{#1}{no}
+  \fi}
+
+
 % Adapted from ltxcheck.tex
 \newcommand{\TestFont}[2][\default]{
   \def\default{#2}
 %\TestPackage{mathabx}
 %\TestPackage{mathdesign}% But see above!
 
+%%% Specific package versions
+% This only works if the package has been loaded before
+\IfFileExists{babel.sty}{\RequirePackage{babel}}{}
+\TestPackageVersion{babel}{2017/11/03}
+
 %%% Document classes
 % The list of layout files has been put in this file here by the
 % configure script.
index 8ad9a5b318332109ca9fb14c2904e5d831843cf5..3f7fcf8737d94207bd1f7968b56e61a733a63410 100644 (file)
@@ -1,5 +1,5 @@
 #LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 578
+\lyxformat 580
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -4940,6 +4940,31 @@ Table of contents
 \end_layout
 
 \begin_deeper
+\begin_layout Standard
+
+\change_inserted -712698321 1563000039
+As of version 3.15 (2017/11/03), 
+\family sans
+babel
+\family default
+ also provides specific commands to select OpenType, TrueType and PostScript
+ fonts from the Operating System (with XeTeX or LuaTeX).
+ If this version (or a newer one) is installed (on your system: 
+\begin_inset Info
+type  "package"
+arg   "babel-2017/11/03"
+\end_inset
+
+), \SpecialChar LyX
+ will use this rather than 
+\family sans
+fontspec
+\family default
+'s commands.
+\change_unchanged
+
+\end_layout
+
 \begin_layout Standard
 Your \SpecialChar LaTeX
  installation has hyphenation patterns for the following languages:
index dd6e91e1f8fd9ed48dd7d38602b554aa5cf4bfe7..e65e6e4a12c742faa8e950cd9a19a51a2024e905 100644 (file)
@@ -1762,8 +1762,9 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                os << from_ascii(ams);
 
        if (useNonTeXFonts) {
-               // Babel loads fontspec itself
-               if (!features.isProvided("fontspec") && !features.useBabel())
+               // Babel (as of 2017/11/03) loads fontspec itself
+               if (!features.isProvided("fontspec")
+                   && !(features.useBabel() && features.isAvailable("babel-2017/11/03")))
                        os << "\\usepackage{fontspec}\n";
                if (features.mustProvide("unicode-math")
                    && features.isAvailable("unicode-math"))
@@ -3390,14 +3391,15 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
                // variants are understood by both engines. However,
                // we want to provide support for at least TeXLive 2009
                // (for XeTeX; LuaTeX is only supported as of v.2)
-               // Babel has its own higher-level interface on top of
-               // fontspec that is to be used.
-               bool const babel = features.useBabel();
+               // As of 2017/11/03, Babel has its own higher-level
+               // interface on top of fontspec that is to be used.
+               bool const babelfonts = features.useBabel()
+                               && features.isAvailable("babel-2017/11/03");
                string const texmapping =
                        (features.runparams().flavor == OutputParams::XETEX) ?
                        "Mapping=tex-text" : "Ligatures=TeX";
                if (fontsRoman() != "default") {
-                       if (babel)
+                       if (babelfonts)
                                os << "\\babelfont{rm}[";
                        else
                                os << "\\setmainfont[";
@@ -3411,7 +3413,7 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
                if (fontsSans() != "default") {
                        string const sans = parseFontName(fontsSans());
                        if (fontsSansScale() != 100) {
-                               if (babel)
+                               if (babelfonts)
                                        os << "\\babelfont{sf}";
                                else
                                        os << "\\setsansfont";
@@ -3422,7 +3424,7 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
                                os << texmapping << "]{"
                                   << sans << "}\n";
                        } else {
-                               if (babel)
+                               if (babelfonts)
                                        os << "\\babelfont{sf}[";
                                else
                                        os << "\\setsansfont[";
@@ -3435,7 +3437,7 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
                if (fontsTypewriter() != "default") {
                        string const mono = parseFontName(fontsTypewriter());
                        if (fontsTypewriterScale() != 100) {
-                               if (babel)
+                               if (babelfonts)
                                        os << "\\babelfont{tt}";
                                else
                                        os << "\\setmonofont";
@@ -3446,7 +3448,7 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
                                os << "]{"
                                   << mono << "}\n";
                        } else {
-                               if (babel)
+                               if (babelfonts)
                                        os << "\\babelfont{tt}";
                                else
                                        os << "\\setmonofont";