On 2016-01-03, Scott Kostyshak wrote:
> On Sat, Jan 02, 2016 at 09:10:40PM +0000, Guenter Milde wrote:
>> On 2015-12-20, Guenter Milde wrote:
>> > On 2015-12-19, Jürgen Spitzmüller wrote:
>> >> Am Mittwoch 16 Dezember 2015, 20:35:27 schrieb Guenter Milde:

...
>> >> Probably an oversight. I agree that polyglossia should be preferred
>> >> now for all LuaTeX ouput (with fontspec).

>> > This means we only have to check for "useNonTeXFonts" 
>> > (polyglossia is already used for all XeTeX output).

>> The following patch will auto-select polyglossia with fontspec whenever
>> possible.

>> OK to commit?

> Are there any differences in the test results? I forget---you are able
> to run the tests right? At some point I remember you could not run them
> but I think we figured it out.

There are differences. The augmented patch includes what I think will be the
changes and the reasons. However, I did not run the tests.

I can play with the test selection and labeling, but all tests return
failure (probably, because I compile LyX with autotools make in a
different build-dir).


Günter

>From 35f064b6ac4e97dc9a4a724c1f948c1b0428bbb4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnter=20Milde?= <mi...@lyx.org>
Date: Sat, 2 Jan 2016 22:26:01 +0100
Subject: [PATCH] Use polyglossia also with DVI (LuaTeX).

Simplify the logic for language package selection and make it more consistent:

Use polyglossia with non-TeX fonts (system fonts/Unicode fonts) for all
export flavours (XeTeX, LuaTeX, DVI-LuaTeX), if the language package setting
is "auto" and there is no language not supported by Babel and no package
providing Babel.

This solves some Babel-related autotest cases and leads to one new failure
due to the polyglossia language nesting problem.
---
 development/autotests/suspiciousTests | 18 +++---------------
 src/BufferParams.cpp                  |  7 ++-----
 src/LaTeXFeatures.cpp                 |  4 ++--
 3 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/development/autotests/suspiciousTests 
b/development/autotests/suspiciousTests
index 6ddf611..816b609 100644
--- a/development/autotests/suspiciousTests
+++ b/development/autotests/suspiciousTests
@@ -62,7 +62,7 @@ export/examples/uk/splash_(dvi3|pdf[45])_texF
 
 # missing commands (polyglossia?)
 # Explore! (works with dvi3 or language_package==babel)
-export/doc/fr/UserGuide_pdf[45]_systemF
+export/doc/fr/UserGuide_(dvi3|pdf[45])_systemF
 
 # Bug in Babel-Spanish with Xe/LuaTeX and Unicode fonts:
 #
@@ -71,16 +71,6 @@ export/doc/fr/UserGuide_pdf[45]_systemF
 # Workaround: add a line to the user-preamble
 #   \@ifpackageloaded{fontspec}{\unaccentedoperators}{}
 export/doc/es/UserGuide_.*_systemF
-#
-# Export with DVI (luatex) uses Babel instead of Polyglossia.
-# Don't use the above workaround here - these documents don't require Babel
-# problem should be solved by fixing auto-selection of language package.
-export/examples/es/ejemplo_con_lyx_dvi3_systemF
-# Galician shares some code with Babel-Spanish (including the bug).
-export/doc/gl/Tutorial_dvi3_systemF
-export/examples/gl/exemplo_lyxificado_dvi3_systemF
-# document language is Spanish: changing to Basque solves the problem
-export/examples/eu/adibide_lyx-atua_dvi3_systemF
 
 # Missing characters (U+0361, U+1E61) in LM,
 # set different system font in the source?
@@ -135,10 +125,8 @@ export/doc/(de/|es/|fr/)Customization_pdf[45]_systemF
 # ! LuaTeX error 
...e/2015/texmf-dist/tex/luatex/hyph-utf8/luatex-hyphen.lua:53: luatex-hyphen: 
no entry in language.dat.lua for this language: bahasa
 export/doc/attic/id_UserGuide_dvi3.*
 export/doc/attic/id_UserGuide_pdf5.*
-export/(doc|examples)/id/.*_dvi3.*
-export/(doc|examples)/id/.*_pdf5_texF
-export/.*/hu/.*(dvi3)_.*
-export/.*/hu/.*(pdf5)_texF
+export/(doc|examples)/id/.*_(dvi3|pdf5)_texF
+export/.*/hu/.*(dvi3|pdf5)_texF
 
 # documents requiring pre-processing fail with Japanese #8823
 export/examples/ja/(knitr|lilypond|sweave)_(dvi|pdf3?)
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index e3121c7..fe47c05 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -1399,11 +1399,8 @@ void BufferParams::validate(LaTeXFeatures & features) 
const
        }
 
        // some languages are only available via polyglossia
-       if ((features.runparams().flavor == OutputParams::XETEX
-            || features.runparams().flavor == OutputParams::LUATEX)
-           && (features.hasPolyglossiaExclusiveLanguages()
-               || useNonTeXFonts))
-               features.require("polyglossia");
+       if (features.hasPolyglossiaExclusiveLanguages())
+          features.require("polyglossia");
 
        if (useNonTeXFonts && fontsMath() != "auto")
                features.require("unicode-math");
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index feab837..a69fd59 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -382,14 +382,14 @@ LaTeXFeatures::LangPackage LaTeXFeatures::langPackage() 
const
        if (local_lp == "none")
                return LANG_PACK_NONE;
 
-       /* If "auto" is selected, we load polyglossia if required,
+       /* If "auto" is selected, we load polyglossia with non-TeX fonts,
         * else we select babel.
         * If babel is selected (either directly or via the "auto"
         * mechanism), we really do only require it if we have
         * a language that needs it.
         */
        bool const polyglossia_required =
-               isRequired("polyglossia")
+               params_.useNonTeXFonts
                && isAvailable("polyglossia")
                && !isProvided("babel")
                && this->hasOnlyPolyglossiaLanguages();
-- 
2.5.1


Reply via email to