diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/base/ltluatex.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltluatex.dtx | 92 |
1 files changed, 81 insertions, 11 deletions
diff --git a/Master/texmf-dist/source/latex/base/ltluatex.dtx b/Master/texmf-dist/source/latex/base/ltluatex.dtx index c8a432f08ec..e5f507258f3 100644 --- a/Master/texmf-dist/source/latex/base/ltluatex.dtx +++ b/Master/texmf-dist/source/latex/base/ltluatex.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 2015 2016 +% Copyright 2015 2017 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -24,7 +24,7 @@ \ProvidesFile{ltluatex.dtx} %</driver> %<*tex> -[2016/03/13 v1.0n +[2017/01/20 v1.1b %</tex> %<plain> LuaTeX support for plain TeX (core) %<*tex> @@ -802,6 +802,46 @@ %<latexrelease>\EndIncludeInRelease % \end{macrocode} % +% In \verb|\everyjob|, if luaotfload is available, load it and switch to TU. +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{2017/01/01}% +%<latexrelease> {\fontencoding}{TU in everyjob}% +%<latexrelease>\fontencoding{TU}\let\encodingdefault\f@encoding +%<latexrelease>\ifx\directlua\@undefined\else +%<2ekernel>\everyjob\expandafter{% +%<2ekernel> \the\everyjob +%<*2ekernel,latexrelease> + \directlua{% +%% Horrible hack, locally reset the luatex version number +%% This is not required for the source version of luaotfload +%% but is required due to an error in the version check in the +%% public version (January 2017) +%% https://github.com/lualatex/luaotfload/issues/387 +%% It is expected that this will be removed before TeXLive 2017 + local tmp_version=tex.luatexversion % + tex.luatexversion=199 % + if xpcall(function ()% + require('luaotfload-main')% + end,texio.write_nl) then % + local _void = luaotfload.main ()% + else % + texio.write_nl('Error in luaotfload: reverting to OT1')% + tex.print('\string\\def\string\\encodingdefault{OT1}')% + end % + tex.luatexversion=tmp_version% + }% + \let\f@encoding\encodingdefault + \expandafter\let\csname ver@luaotfload.sty\endcsname\fmtversion +%</2ekernel,latexrelease> +%<latexrelease>\fi +%<2ekernel> } +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\fontencoding}{TU in everyjob}% +%<latexrelease>\fontencoding{OT1}\let\encodingdefault\f@encoding +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% % \begin{macrocode} %<2ekernel|latexrelease>\fi %</2ekernel|tex|latexrelease> @@ -1161,7 +1201,7 @@ local types = { % \end{macrocode} % % Now, list all predefined callbacks with their current type, based on the -% Lua\TeX{} manual version~0.80. A full list of the currently-available +% Lua\TeX{} manual version~1.01. A full list of the currently-available % callbacks can be obtained using % \begin{verbatim} % \directlua{ @@ -1176,7 +1216,7 @@ local types = { % \begin{macrocode} local callbacktypes = callbacktypes or { % \end{macrocode} -% Section 4.1.1: file discovery callbacks. +% Section 8.2: file discovery callbacks. % \begin{macrocode} find_read_file = exclusive, find_write_file = exclusive, @@ -1194,7 +1234,7 @@ local callbacktypes = callbacktypes or { find_type1_file = data, find_image_file = data, % \end{macrocode} -% Section 4.1.2: file reading callbacks. +% % \begin{macrocode} open_read_file = exclusive, read_font_file = exclusive, @@ -1215,14 +1255,14 @@ local callbacktypes = callbacktypes or { find_cidmap_file = data, read_cidmap_file = exclusive, % \end{macrocode} -% Section 4.1.3: data processing callbacks. +% Section 8.3: data processing callbacks. % \changes{v1.0m}{2016/02/11}{token\_filter removed} % \begin{macrocode} process_input_buffer = data, process_output_buffer = data, process_jobname = data, % \end{macrocode} -% Section 4.1.4: node list processing callbacks. +% Section 8.4: node list processing callbacks. % \changes{v1.0m}{2016/02/11} % {process\_rule, [hv]pack\_quality append\_to\_vlist\_filter added} % \changes{v1.0n}{2016/03/13}{insert\_local\_par added} @@ -1230,6 +1270,7 @@ local callbacktypes = callbacktypes or { % \begin{macrocode} contribute_filter = simple, buildpage_filter = simple, + build_page_insert = exclusive, pre_linebreak_filter = list, linebreak_filter = list, append_to_vlist_filter = list, @@ -1246,8 +1287,9 @@ local callbacktypes = callbacktypes or { insert_local_par = simple, mlist_to_hlist = list, % \end{macrocode} -% Section 4.1.5: information reporting callbacks. +% Section 8.5: information reporting callbacks. % \changes{v1.0m}{2016/02/11}{show\_warning\_message added} +% \changes{v1.0p}{2016/11/17}{call\_edit added} % \begin{macrocode} pre_dump = simple, start_run = simple, @@ -1260,13 +1302,14 @@ local callbacktypes = callbacktypes or { show_lua_error_hook = simple, start_file = simple, stop_file = simple, + call_edit = simple, % \end{macrocode} -% Section 4.1.6: PDF-related callbacks. +% Section 8.6: PDF-related callbacks. % \begin{macrocode} finish_pdffile = data, finish_pdfpage = data, % \end{macrocode} -% Section 4.1.7: font-related callbacks. +% Section 8.7: font-related callbacks. % \begin{macrocode} define_font = exclusive, % \end{macrocode} @@ -1301,6 +1344,33 @@ end % More precisely, the functions below are used to generate a specialized % function (closure) for a given callback, which is the actual handler. % +% +% The way the functions are combined together depends on +% the type of the callback. There are currently 4 types of callback, depending +% on the calling convention of the functions the callback can hold: +% \begin{description} +% \item[simple] is for functions that don't return anything: they are called +% in order, all with the same argument; +% \item[data] is for functions receiving a piece of data of any type +% except node list head (and possibly other arguments) and returning it +% (possibly modified): the functions are called in order, and each is +% passed the return value of the previous (and the other arguments +% untouched, if any). The return value is that of the last function; +% \item[list] is a specialized variant of \emph{data} for functions +% filtering node lists. Such functions may return either the head of a +% modified node list, or the boolean values |true| or |false|. The +% functions are chained the same way as for \emph{data} except that for +% the following. If +% one function returns |false|, then |false| is immediately returned and +% the following functions are \emph{not} called. If one function returns +% |true|, then the same head is passed to the next function. If all +% functions return |true|, then |true| is returned, otherwise the return +% value of the last function not returning |true| is used. +% \item[exclusive] is for functions with more complex signatures; functions in +% this type of callback are \emph{not} combined: An error is raised if +% a second callback is registered.. +% \end{description} +% % Handler for |data| callbacks. % \begin{macrocode} local function data_handler(name) @@ -1393,7 +1463,7 @@ local function create_callback(name, ctype, default) end if callbacktypes[name] then luatexbase_error("Unable to create callback `" .. name .. - "':\ncallback type disallowed as name") + "':\ncallback is already defined") end if default ~= false and type (default) ~= "function" then luatexbase_error("Unable to create callback `" .. name .. |