From 6420859adf6ed13d62704d9f5f3076cce03bdcdf Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 13 May 2021 21:29:14 +0000 Subject: lua-ul, and etex-answer-y to handle spurious latex interaction (13may21) git-svn-id: svn://tug.org/texlive/trunk@59186 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/lualatex/lua-ul/docstrip-luacode.sty | 2 +- .../lua-ul/lua-ul-patches-preserve-attr.lua | 79 ++++++++++++++++++++++ Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua | 1 + Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty | 2 +- 4 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 Master/texmf-dist/tex/lualatex/lua-ul/lua-ul-patches-preserve-attr.lua (limited to 'Master/texmf-dist/tex/lualatex/lua-ul') diff --git a/Master/texmf-dist/tex/lualatex/lua-ul/docstrip-luacode.sty b/Master/texmf-dist/tex/lualatex/lua-ul/docstrip-luacode.sty index fe5c1b4f754..f3a2136a6a6 100644 --- a/Master/texmf-dist/tex/lualatex/lua-ul/docstrip-luacode.sty +++ b/Master/texmf-dist/tex/lualatex/lua-ul/docstrip-luacode.sty @@ -13,7 +13,7 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage {docstrip-luacode} - [2021/04/25 v0.1.3 Directly execute Lua code from DocStrip files] + [2021/05/12 v0.1.4 Directly execute Lua code from DocStrip files] \expanded{% \def\noexpand\docstrip@luacode@argscanner#1\directlua{ tex.sprint(\the\catcodetable@string, "\string\\end{docstrip-luacode}") diff --git a/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul-patches-preserve-attr.lua b/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul-patches-preserve-attr.lua new file mode 100644 index 00000000000..bbed3b6b47b --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul-patches-preserve-attr.lua @@ -0,0 +1,79 @@ +-- +-- This is file `lua-ul-patches-preserve-attr.lua', +-- generated with the docstrip utility. +-- +-- The original source files were: +-- +-- lua-ul.dtx (with options: `preserve-attr') +-- +-- Copyright (C) 2020-2021 by Marcel Krueger +-- +-- This file may be distributed and/or modified under the +-- conditions of the LaTeX Project Public License, either +-- version 1.3c of this license or (at your option) any later +-- version. The latest version of this license is in: +-- +-- http://www.latex-project.org/lppl.txt +-- +-- and version 1.3 or later is part of all distributions of +-- LaTeX version 2005/12/01 or later. +local getfont = font.getfont + +local direct = node.direct + +local getattr = direct.getattributelist +local getid = direct.getid +local getpenalty = direct.getpenalty +local getprev = direct.getprev +local getwidth = direct.getwidth + +local setattr = direct.setattributelist +local setkern = direct.setkern + +local insert_after = direct.insert_after +local is_glyph = direct.is_glyph +local newnode = direct.new +local todirect = direct.todirect +local tonode = direct.tonode + +local glue_id = node.id'glue' +local kern_t = node.id'kern' +local penalty_id = node.id'penalty' + +local italcorr_sub +for i, n in next, node.subtypes'kern' do + if n == 'italiccorrection' then italcorr_sub = i break end +end +assert(italcorr_sub) + +local nests = tex.nest + +local funcid = luatexbase.new_luafunction'sw@slant' +token.set_lua('sw@slant', funcid, 'protected') +lua.get_functions_table()[funcid] = function() + local nest = nests.top + local tail, after = todirect(nest.tail), nil + local id = getid(tail) + if id == glue_id then + if getwidth(tail) == 0 then return end + tail, after = getprev(tail), tail + id = getid(tail) + end + if id == penalty_id then + if getpenalty(tail) == 0 then return end + tail, after = getprev(tail), tail + end + local cid, fontid = is_glyph(tail) + if not cid then return end + local fontdir = getfont(fontid) + local characters = fontdir and fontdir.characters + local char = characters and characters[cid] + local kern = newnode(kern_t, italcorr_sub) + setkern(kern, char and char.italic or 0) + setattr(kern, getattr(tail)) + insert_after(tail, tail, kern) + if not after then nest.tail = tonode(kern) end +end +-- +-- +-- End of file `lua-ul-patches-preserve-attr.lua'. diff --git a/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua b/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua index 204f9b400cc..3d4350fc205 100644 --- a/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua +++ b/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.lua @@ -487,6 +487,7 @@ luatexbase.add_to_callback('vpack_filter', end return tonode(head) end, 'add underlines to list') +require'lua-ul-patches-preserve-attr' -- -- -- End of file `lua-ul.lua'. diff --git a/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty b/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty index 8c18e3506c4..3f9c6571f74 100644 --- a/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty +++ b/Master/texmf-dist/tex/lualatex/lua-ul/lua-ul.sty @@ -20,7 +20,7 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage {lua-ul} - [2021/04/25 v0.1.3 Underlining and related functionality for LuaTeX] + [2021/05/12 v0.1.4 Underlining and related functionality for LuaTeX] \ifx\directlua\undefined \PackageError{lua-ul}{LuaLaTeX required}% -- cgit v1.2.3