From 3a70340a95339ce3cdabf77232e0e70c2f1053ad Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnter=20Milde?= Date: Fri, 8 Jan 2016 22:51:58 +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 some new failures due to the polyglossia language nesting problem. --- development/autotests/suspiciousTests | 46 +++++++-------------------- development/autotests/unreliableTests | 2 +- src/BufferParams.cpp | 7 ++-- src/LaTeXFeatures.cpp | 4 +-- 4 files changed, 17 insertions(+), 42 deletions(-) diff --git a/development/autotests/suspiciousTests b/development/autotests/suspiciousTests index fd84a941c2..bc3999375f 100644 --- a/development/autotests/suspiciousTests +++ b/development/autotests/suspiciousTests @@ -48,8 +48,8 @@ export/doc/(es|fr)/UserGuide_pdf4_texF 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 +# Explore! (works with language_package==babel) +export/doc/fr/UserGuide_.*_systemF # Bug in Babel-Spanish with Xe/LuaTeX and Unicode fonts: # @@ -58,19 +58,11 @@ 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 # Missing characters (U+0361, U+1E61) in LM, # set different system font in the source? # + language nesting problem (may disappear after completed translation) -export/doc/(de/|es/|fr/)Customization_pdf[45]_systemF +export/doc/(de/|es/|fr/)Customization_.*_systemF # Probably language mess export/export/ja/wrong_auto_encoding_(dvi|pdf(|3)) @@ -84,14 +76,6 @@ export/export/ja/wrong_auto_encoding_(dvi|pdf(|3)) # \c e -> 0229 LATIN SMALL LETTER E WITH CEDILLA export/doc/(|de/|es/|fr/)Math.*systemF -# 1.) Unknown Japanese char in section if previous -# paragraph ended in non-Japaneese language -# This is the same error as in export/export/ja/wrong_auto_encoding (unreliableTests) -# 2.) unknown chars üß in selected encoding in 'This is a German word: Tschüß' -# -# Both reasons invalid since the commit 6b0632eea288348b912f98b79bc871830b6a3d98 -#export/doc/ja/EmbeddedObjects_(dvi|pdf|pdf3) - # missing character: There is no ^^A in font [lmroman12-regular] # and all the line down to ^^Z and beyond... # XeTeX artifact? works with LuaTeX, explore: @@ -125,22 +109,20 @@ Sublabel: lyxbugs # LyX bugs with a Trac number. # Language nesting and polyglossia #9633 -export/doc/(nb|sk)/Intro_pdf[45]_systemF +export/doc/(nb|sk)/Intro.*systemF # language nesting (may disappear after completed translation) export/examples/fr/linguistics_.*_systemF -export/doc/(de/|es/|fr/)Customization_pdf[45]_systemF +export/doc/(de/|es/|fr/)Customization_.*_systemF # use LuaTeX-compatible language names #9910 -# Wrong language name for LuaTeX +# Wrong language name for LuaTeX (with Babel, no error with Polyglossia) # After LyX 2.1 is released, apply the patch and remove these # See http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg181595.html # ! 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?) @@ -189,12 +171,6 @@ export/.*/he/.*pdf4_texF export/doc/ru/(Intro|Tutorial)_(dvi3|pdf[45])_texF export/examples/ru/splash_(dvi3|pdf[45])_texF -# dvi3 uses Babel. Autostrings use Cyrillic LICRs, -# however these are missing in xunicode.sty. 2 solutions: -# LuX: use polyglossia also with dvi3 (LuaTeX) and non-TeX fonts, -# LaTeX: define Cyrillic LICRs for EU1 and EU2 (similar to greek-euenc.def) -export/doc/uk/Intro_dvi3_systemF - # LuaTeX fails for an \mbox in an index, e.g. $a_{\mbox{a}}$. # This construct appears in the included bib file biblioExample.bib in # the entry Eisenstein2005. Error message is @@ -212,7 +188,8 @@ export/examples/fr/exemple-powerdot_pdf[25].* # Gives the following error: # # ! Package hpstatement Error: H or P statement "H251" # # (hpstatement) is not defined. -export/examples/H-P-statements_pdf[45]_systemF +# seems to be polyglossia-related (dvi3 worked with babel) +export/examples/H-P-statements_.*_systemF # requires jss.cls (not on CTAN) # "All documents need to be processed by pdflatex" [jss.pdf] @@ -230,7 +207,8 @@ Sublabel: multilingual # No problem with inserted German (or other foreign language) text # No problem if the table is Slovak too # Seems to be a problem with Check and Slovak Babel support. File a bug there. -export/export/TableErrorIfSlovakTextInserted_(dvi|pdf|pdf[23]|pdf[45]_texF|dvi3_.*F) +# All exports using babel fail: +export/export/TableErrorIfSlovakTextInserted_(dvi|pdf[23]?|.*_texF) Sublabel: attic diff --git a/development/autotests/unreliableTests b/development/autotests/unreliableTests index 4932822b54..a5c6154eb4 100644 --- a/development/autotests/unreliableTests +++ b/development/autotests/unreliableTests @@ -13,7 +13,7 @@ Sublabel: nonstandard export/templates/IUCr-article_(dvi|pdf).* export/templates/ja_beamer-conference-ornate-20min_(pdf2|pdf[45]_(texF|systemF)) export/templates/es_beamer-conference-ornate-20min_(pdf2|pdf[45]_(texF|systemF)) -export/templates/kluwer_pdf[45]_systemF +export/templates/kluwer_.*_systemF export/examples/modernCV_pdf4_(tex|system)F export/templates/ectaart_(dvi3|pdf5)_(tex|system)F diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index e3121c7770..fe47c05bf0 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 feab837699..a69fd5971d 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.39.5