From 29c97800a3fa14a0ef8209ebcbc25154de9ec48b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Thu, 25 Jul 2019 13:17:38 +0200 Subject: [PATCH] Fix typos and add parameters --- luametalatex-back-pdf.lua | 2 +- luametalatex-baseregisters.tex | 20 +++++++++++++++----- luametalatex-firstcode.lua | 3 ++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/luametalatex-back-pdf.lua b/luametalatex-back-pdf.lua index 9f5ca1d..69500af 100644 --- a/luametalatex-back-pdf.lua +++ b/luametalatex-back-pdf.lua @@ -59,7 +59,7 @@ callback.register("stop_run", function() end pfile.root = pfile:getobj() pfile.version = string.format("%i.%i", pdf.variable.majorversion, pdf.variable.minorversion) - pfile:indirect(pfile.root, string.format([[<>]], pfile.version, pfile:writepages())) + pfile:indirect(pfile.root, string.format([[<>]], pfile.version, pfile:writepages())) pfile.info = write_infodir(pfile) pfile:close() end, "Finish PDF file") diff --git a/luametalatex-baseregisters.tex b/luametalatex-baseregisters.tex index 3b2e370..b191e8b 100644 --- a/luametalatex-baseregisters.tex +++ b/luametalatex-baseregisters.tex @@ -8,6 +8,7 @@ return token.new(t.mode, t.command) end local dimen_cmd = token.command_id'assign_dimen' + local count_cmd = token.command_id'assign_int' local tex_params = {} local texmeta = getmetatable(tex) local texmetaoldindex = texmeta.__index @@ -15,7 +16,9 @@ function texmeta.__index(t, k) local v = tex_params[k] if v then - if v.command == dimen_cmd then + if v.command == count_cmd then + return tex.count[v.index] + elseif v.command == dimen_cmd then return tex.dimen[v.index] end else @@ -25,7 +28,9 @@ function texmeta.__newindex(t, k, v) local p = tex_params[k] if p then - if p.command == dimen_cmd then + if p.command == count_cmd then + tex.count[p.index] = v + elseif p.command == dimen_cmd then tex.dimen[p.index] = v end else @@ -38,7 +43,9 @@ __index = function(t, k) local v = pdf_params[k] if v then - if v.command == dimen_cmd then + if v.command == count_cmd then + return tex.count[v.index] + elseif v.command == dimen_cmd then return tex.dimen[v.index] end else @@ -48,7 +55,9 @@ __newindex = function(t, k, v) local p = pdf_params[k] if p then - if p.command == dimen_cmd then + if p.command == count_cmd then + tex.count[p.index] = v + elseif p.command == dimen_cmd then tex.dimen[p.index] = v end else @@ -71,6 +80,7 @@ \def\pdfAlloc{% \internalAlloc{pdf}% } +\texAlloc{count}{suppressfontnotfounderror}{0} \texAlloc{count}{outputmode}{1} % The "traditional" default would be 0, % but we do not actually support that. \texAlloc{dimen}{pageheight}{210mm} @@ -78,7 +88,7 @@ \pdfAlloc{dimen}{horigin}{1in} \pdfAlloc{dimen}{vorigin}{1in} \pdfAlloc{count}{majorversion}{1} -\pdfAlloc{dimen}{minorversion}{7} +\pdfAlloc{count}{minorversion}{7} \directlua{ lua.prepared_code[\csstring#lua.prepared_code+1] = tex.toks[0] .. "end" \the\toks0 diff --git a/luametalatex-firstcode.lua b/luametalatex-firstcode.lua index c9ba3e9..b0d79e1 100644 --- a/luametalatex-firstcode.lua +++ b/luametalatex-firstcode.lua @@ -13,6 +13,7 @@ function token.luacmd(name, func, ...) local idx = new_luafunction(name) set_lua(name, idx, ...) functions[idx] = func + return idx end local properties = node.get_properties_table() -- setmetatable(node.direct.get_properties_table(), { @@ -28,7 +29,7 @@ local whatsits = { [0] = "open", "write", "close", - nil, + "special", nil, nil, "save_pos",