From 130c7440696bf3c246636b1dabceb65827293ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Milde?= Date: Fri, 12 Jul 2019 12:46:50 +0200 Subject: [PATCH] Drop support for XeTeX + TeX fonts + inputenc utf8. LyX follows LaTeX in dropping support for this combination (it only worked by tricking "inputenc.sty"). There is no known case where this combination is required or helpfull. For power users with special needs, XeTeX + TeX fonts is still available after setting the input encoding to "ascii" or "utf8-plain". See also #10600. --- .../latex/inputenc-xetex-utf8-expl3-bug.lyx | 59 +-- .../export/latex/inputenc-xetex-utf8.lyx | 487 ------------------ development/autotests/ignoredTests | 16 +- development/autotests/invertedTests | 16 +- development/autotests/unreliableTests | 3 - src/Buffer.cpp | 4 +- src/BufferParams.cpp | 26 +- src/output_latex.cpp | 10 +- 8 files changed, 25 insertions(+), 596 deletions(-) delete mode 100644 autotests/export/latex/inputenc-xetex-utf8.lyx diff --git a/autotests/export/latex/inputenc-xetex-utf8-expl3-bug.lyx b/autotests/export/latex/inputenc-xetex-utf8-expl3-bug.lyx index 65a9395fe3..1351d5c9c5 100644 --- a/autotests/export/latex/inputenc-xetex-utf8-expl3-bug.lyx +++ b/autotests/export/latex/inputenc-xetex-utf8-expl3-bug.lyx @@ -1,5 +1,5 @@ #LyX 2.4 created this file. For more info see https://www.lyx.org/ -\lyxformat 574 +\lyxformat 580 \begin_document \begin_header \save_transient_properties true @@ -58,6 +58,7 @@ \justification true \use_refstyle 1 \use_minted 0 +\use_lineno 0 \branch na \selected 0 \filename_suffix 0 @@ -145,36 +146,6 @@ LyXen ist schön. \end_inset -\end_layout - -\begin_layout Standard -\begin_inset Note Note -status open - -\begin_layout Plain Layout -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/012-hebrew_he.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Plain Layout -Hebrew does not work with XeTeX and TeX-fonts: -\end_layout - -\begin_layout Plain Layout -Error 256 (driver return code) generating output; file 012-hebrew_he_HE8.pdf - may not be valid. - -\end_layout - -\end_inset - - \end_layout \begin_layout Standard @@ -183,33 +154,11 @@ Compilation errors under TeXLive-19 with XeTeX, TeX-fonts, inputenc utf8, \end_layout \begin_layout Standard -required by xfrac.sty: +required by xfrac.sty (autoloaded for some fraction characters): ⅕ \end_layout \begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/074-76-letterlike-numberforms-arrows.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -required by menukeys.sty: -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/078-79-misc-technical-control-pics.lyx" -literal "false" - -\end_inset - - +required by menukeys.sty (autoloaded for some technical symbols): ⌦ \end_layout \end_body diff --git a/autotests/export/latex/inputenc-xetex-utf8.lyx b/autotests/export/latex/inputenc-xetex-utf8.lyx deleted file mode 100644 index b48ee657bd..0000000000 --- a/autotests/export/latex/inputenc-xetex-utf8.lyx +++ /dev/null @@ -1,487 +0,0 @@ -#LyX 2.4 created this file. For more info see https://www.lyx.org/ -\lyxformat 573 -\begin_document -\begin_header -\save_transient_properties true -\origin unavailable -\textclass article -\begin_preamble - -\end_preamble -\use_default_options true -\maintain_unincluded_children false -\language english -\language_package default -\inputencoding utf8 -\fontencoding HE8,T1 -\font_roman "lmodern" "FreeSerif" -\font_sans "default" "FreeSans" -\font_typewriter "default" "FreeMono" -\font_math "auto" "auto" -\font_default_family default -\use_non_tex_fonts false -\font_sc false -\font_osf false -\font_sf_scale 100 100 -\font_tt_scale 100 100 -\use_microtype false -\use_dash_ligatures false -\graphics default -\default_output_format pdf4 -\output_sync 0 -\bibtex_command default -\index_command default -\float_placement class -\float_alignment class -\paperfontsize default -\spacing single -\use_hyperref false -\papersize default -\use_geometry false -\use_package amsmath 1 -\use_package amssymb 1 -\use_package cancel 1 -\use_package esint 1 -\use_package mathdots 1 -\use_package mathtools 1 -\use_package mhchem 1 -\use_package stackrel 1 -\use_package stmaryrd 1 -\use_package undertilde 1 -\cite_engine basic -\cite_engine_type default -\biblio_style plain -\use_bibtopic false -\use_indices false -\paperorientation portrait -\suppress_date false -\justification true -\use_refstyle 1 -\use_minted 0 -\branch na -\selected 0 -\filename_suffix 0 -\color #faf0e6 -\end_branch -\branch bisect -\selected 0 -\filename_suffix 0 -\color #faf0e6 -\end_branch -\index Index -\shortcut idx -\color #008000 -\end_index -\secnumdepth 3 -\tocdepth 3 -\paragraph_separation indent -\paragraph_indentation default -\is_math_indent 0 -\math_numbering_side default -\quotes_style english -\dynamic_quotes 0 -\papercolumns 1 -\papersides 1 -\paperpagestyle default -\tablestyle default -\tracking_changes false -\output_changes false -\html_math_output 0 -\html_css_as_file 0 -\html_be_strict false -\end_header - -\begin_body - -\begin_layout Standard -XeTeX works with 8-bit fonts for -\begin_inset Quotes eld -\end_inset - -utf8 -\begin_inset Quotes erd -\end_inset - - and -\begin_inset Quotes eld -\end_inset - -ascii -\begin_inset Quotes erd -\end_inset - - input encodings. - There are, however, a number of incompatibilities, because the combination - XeTeX+TeX-fonts is rarely used and some packages wrongly test for XeTeX - instead of fontenc. -\end_layout - -\begin_layout Standard -This ERT fails with -\begin_inset Quotes eld -\end_inset - -ascii -\begin_inset Quotes erd -\end_inset - - but works with -\begin_inset Quotes eld -\end_inset - -utf8 -\begin_inset Quotes erd -\end_inset - -: -\begin_inset ERT -status open - -\begin_layout Plain Layout - -LyXen ist schön. -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/001-4-latin.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/005-7-ipa-modifiers-combining.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/008-greek-and-coptic.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/009-cyrillic.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/009-cyrillic_ru.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset ERT -status open - -\begin_layout Plain Layout - - -\backslash -fontencoding{HE8} -\backslash -selectfont -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/012-hebrew_HE8.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset ERT -status open - -\begin_layout Plain Layout - - -\backslash -fontencoding{T1} -\backslash -selectfont -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset Note Note -status open - -\begin_layout Plain Layout -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/012-hebrew_he.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Plain Layout -Hebrew does not work with XeTeX and TeX-fonts: -\end_layout - -\begin_layout Plain Layout -Error 256 (driver return code) generating output; file 012-hebrew_he_HE8.pdf - may not be valid. - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/031-thai_th.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/065-67-phonetic-extensions.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/068-latin-extended-additional.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/069-greek-extended.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/070-72-general-punctuation-sub-super-currency.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset Note Note -status open - -\begin_layout Plain Layout -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/074-76-letterlike-numberforms-arrows.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Plain Layout -Compilation errors with XeTeX, TeX-fonts, inputenc utf8, and expl3.sty (required - by xfrac.sty). -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/077-mathops.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset Note Note -status open - -\begin_layout Plain Layout -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/078-79-misc-technical-control-pics.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Plain Layout -Compilation errors with XeTeX, TeX-fonts, inputenc utf8, and expl3.sty (required - by menukeys.sty). -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/081-enclosed-alphanumerics.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/082-84-box-drawing-blocks-geometric.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/084-misc-symbols.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/085-dingbats.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/087-90-misc-math-A-arrows-A-B.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/091-92-misc-math-B-supp-math-ops.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/125_152-modifiers-presentation.lyx" -literal "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset CommandInset include -LatexCommand input -filename "unicodesymbols/246-mathematical-alphanumeric.lyx" -literal "false" - -\end_inset - - -\end_layout - -\end_body -\end_document diff --git a/development/autotests/ignoredTests b/development/autotests/ignoredTests index a401f14dba..5890c50643 100644 --- a/development/autotests/ignoredTests +++ b/development/autotests/ignoredTests @@ -65,14 +65,20 @@ export/examples/Graphics_and_Insets/Instant_Preview_(dvi3|pdf4)_systemF export/examples/Articles/Chess/Game_2_pdf[25].* export/examples/(|fr/)Presentations/Powerdot_pdf[25].* -export/examples/Modules/Chessboard_(lyx(16|20|21|22|23)|(pdf3|pdf5|dvi3)_texF) +export/examples/Modules/Chessboard_(lyx(16|20|21|22|23)|(pdf5|dvi3)_texF) # XeTeX with TeX fonts ###################### -# XeTeX with TeX-fonts works only for input encodings "UTF-8" and "ASCII". +# XeTeX with TeX-fonts works only for input encodings "utf8-plain" and "ascii". # Ignore documents with other inputencoding values: -export/export/latex/languages/supported-languages_babel_auto-legacy_pdf4_texF -export/examples/fr/Example_%28raw%29_pdf4_texF +export/doc/(|ar|ca|cs|da|de|en|el|es|eu|fa|fr|gl|he|hu|id|it|nb||nl|pl|pt|pt_BR|pt_PT|ro|ru|sk|sl|sr|sv|uk).*_pdf4_texF +export/examples/(|ar|ca|cs|da|de|en|el|es|eu|fa|fr|gl|he|hu|id|it|nb||nl|pl|pt|pt_BR|pt_PT|ro|ru|sk|sl|sr|sv|uk).*_pdf4_texF +export/mathmacros/.*_pdf4_texF +export/templates/(|ar|ca|cs|da|de|en|el|es|eu|fa|fr|gl|he|hu|id|it|nb||nl|pl|pt|pt_BR|pt_PT|ro|ru|sk|sl|sr|sv|uk).*_pdf4_texF +export/tabletemplates/.*_pdf4_texF +# allow dedicated XeTeX tests: +!export/export/.*xetex.*_pdf4_texF +export/export/.*_pdf4_texF # pLaTeX ######## @@ -141,7 +147,7 @@ export/templates/Articles/Copernicus_Publications_.*_lyx(16|20|21|22) #! Missing number, treated as zero. # in copernicus.cls:199 # \ifnum\pdfoutput=\z@ -export/templates/Articles/Copernicus_.*(dvi3|pdf4|pdf5)_(texF|systemF) +export/templates/Articles/Copernicus_.*_(texF|systemF) diff --git a/development/autotests/invertedTests b/development/autotests/invertedTests index 0e83643540..581ba5cf4f 100644 --- a/development/autotests/invertedTests +++ b/development/autotests/invertedTests @@ -182,10 +182,7 @@ export/export/latex/languages/ru_auto-legacy-luatex.*_texF # New in TL18 -> cf. unreliableTests.varying_versions. # Workaround: suppressing auto-date, setting inputenc to "utf8", or using # date inset (new in LyX 2.4) in the source documents. -export/export/latex/languages/uk-babel-date-missing-chars-with-ascii_(pdf4|dvi3)_texF -# the "dvi3" tests for these pass, but have wrong output. -export/doc/uk/Intro_pdf4_texF -export/examples/uk/Welcome_pdf4_texF +export/export/latex/languages/uk-babel-date-missing-chars-with-ascii_dvi3_texF # Babel with non-TeX fonts fails for some supported languages # Lithuanian: L7x font encoding also set with LuaTeX and non-TeX fonts @@ -197,9 +194,6 @@ export/export/latex/languages/supported-languages_babel_non-tex_(dvi3|pdf5)_syst export/export/latex/languages/supported-languages_(dvi|pdf).*_texF export/export/latex/languages/supported-languages_babel_(dvi|pdf).*_texF -# Babel-Spanish fails sometimes with XeTeX and TeX fonts -export/doc/es/(Math|UserGuide|EmbeddedObjects|Customization)_pdf4_texF - # Polyglossia + LuaTeX issue # Reported upstream here: # https://github.com/reutenauer/polyglossia/issues/163 @@ -257,8 +251,7 @@ export/export/latex/CJK/en-de-el-ru-ko_utf8_(dvi3|pdf5)_systemF # Arabic # # Larger Arabic documents currently have non-TeX fonts and XeTeX -# as default output (examples/ar/Welcome_pdf4_texF works). -# To fix pdfTeX export: +# as default output. To fix pdfTeX export: # - set all non-Arab text parts to a different language (e.g. English) # - define alternatives for hyperref (e.g. with textorpdfstring) # for correct handling of hyperref. @@ -270,10 +263,6 @@ export/export/latex/CJK/en-de-el-ru-ko_utf8_(dvi3|pdf5)_systemF # {} # I'm broken. Please show this to someone who can fix # see discussion at https://www.mail-archive.com/search?l=mid&q=20161114035123.s5lt4ib4x4obtptp%40steph -# -# Arabic letters in hyperlink name fail with TeX fonts because of wrong font encoding -# 8-bit TeX exports are ignored (\output_format xetex). -export/doc/ar/.*_pdf4_texF # Babel-Arabic loads "inputenc" which fails with LuaTeX export/.*/ar/.*_(dvi3|pdf5)_texF @@ -339,5 +328,4 @@ Sublabel: attic # Files in the attic with non-default output # (i.e. could be ERT, package incompatiblity, ...) export/doc/attic/it_(UserGuide_dvi3|UserGuide_pdf4)_systemF -export/doc/attic/sk_UserGuide_pdf4_texF export/doc/attic/id_UserGuide_.*systemF diff --git a/development/autotests/unreliableTests b/development/autotests/unreliableTests index 128a2de9cb..578cfe44be 100644 --- a/development/autotests/unreliableTests +++ b/development/autotests/unreliableTests @@ -116,9 +116,6 @@ Sublabel: erratic ################# # Tests depending on local configuration, or the phase of the moon. -# Manual export fails the first time but works the second time. (Why?) -export/doc/es/(Customization|Intro)_pdf4_texF - Sublabel: varying_versions ########################## diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 0882c3d3c3..3ab6c611f4 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -4482,9 +4482,7 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir if (format == "pdf4") s += "\n" + bformat(_("Hint: use non-TeX fonts or set input encoding " - " to '%1$s' or '%2$s'"), - from_utf8(encodings.fromLyXName("utf8")->guiName()), - from_utf8(encodings.fromLyXName("ascii")->guiName())); + " to '%1$s'"), from_utf8(encodings.fromLyXName("ascii")->guiName())); Alert::error(_("Couldn't export file"), s); } return ExportNoPathToFormat; diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 0978b6fe7b..dd6e91e1f8 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -104,18 +104,6 @@ static char const * const tex_graphics[] = { namespace lyx { -// XeTeX with TeX fonts: -// run in 8-bit emulation mode and trick `inputenc` into working with XeTeX -static docstring const xetex_pre_inputenc = from_ascii( - "\\XeTeXinputencoding \"bytes\" % current file\n" - "\\XeTeXdefaultencoding \"bytes\" % included files\n" - "\\makeatletter\n" - "\\let\\origUmathchar\\Umathchar\n" - "\\let\\Umathchar\\@undefined\n"); -static docstring const xetex_post_inputenc = from_ascii( - "\\let\\Umathchar\\origUmathchar\n" - "\\makeatother\n"); - // Local translators namespace { @@ -2687,10 +2675,8 @@ FormatList const & BufferParams::exportableFormats(bool only_viewable) const if (useNonTeXFonts) { excludes.insert("latex"); excludes.insert("pdflatex"); - } else if (inputenc != "ascii" && inputenc != "utf8" - && inputenc != "utf8x" && inputenc != "utf8-plain") - // XeTeX with TeX fonts requires input encoding ascii or utf8 - // (https://www.tug.org/pipermail/xetex/2010-April/016452.html). + } else if (inputenc != "ascii" && inputenc != "utf8-plain") + // XeTeX with TeX fonts requires input encoding ascii (#10600). excludes.insert("xetex"); FormatList result = theConverters().getReachable(backs[0], only_viewable, true, excludes); @@ -2721,8 +2707,8 @@ vector BufferParams::backends() const v.push_back("pdflatex"); v.push_back("latex"); } - if (useNonTeXFonts || inputenc == "ascii" || inputenc == "utf8" - || inputenc == "utf8x" || inputenc == "utf8-plain") + if (useNonTeXFonts + || inputenc == "ascii" || inputenc == "utf8-plain") v.push_back("xetex"); v.push_back("luatex"); v.push_back("dviluatex"); @@ -3346,16 +3332,12 @@ void BufferParams::writeEncodingPreamble(otexstream & os, if (features.isRequired("japanese") || features.isProvided("inputenc")) break; - if (features.runparams().flavor == OutputParams::XETEX) - os << xetex_pre_inputenc; os << "\\usepackage[" << from_ascii(encoding().latexName()); if (features.runparams().flavor == OutputParams::LUATEX || features.runparams().flavor == OutputParams::DVILUATEX) os << "]{luainputenc}\n"; else os << "]{inputenc}\n"; - if (features.runparams().flavor == OutputParams::XETEX) - os << xetex_post_inputenc; break; } } diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 41e579a554..7a8bf24c66 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -1658,14 +1658,10 @@ pair switchEncoding(odocstream & os, BufferParams const & bparams, OutputParams const & runparams, Encoding const & newEnc, bool force, bool noswitchmacro) { - // Never switch encoding with non-TeX fonts (always "utf8plain"), - // with LuaTeX and TeX fonts (only one encoding accepted by luainputenc), + // Never switch encoding with XeTeX/LuaTeX // or if we're in a moving argument or inherit the outer encoding. - if (bparams.useNonTeXFonts - || runparams.flavor == OutputParams::LUATEX - || runparams.flavor == OutputParams::DVILUATEX - || newEnc.name() == "inherit") - return make_pair(false, 0); + if (runparams.isFullUnicode() || newEnc.name() == "inherit") + return make_pair(false, 0); // Only switch for auto-selected legacy encodings (inputenc setting // "auto-legacy" or "auto-legacy-plain").