diff --git a/luametalatex-back-pdf.lua b/luametalatex-back-pdf.lua index 39f1e48..a3ae559 100644 --- a/luametalatex-back-pdf.lua +++ b/luametalatex-back-pdf.lua @@ -68,13 +68,17 @@ local reset_deadcycles = { } token.luacmd("shipout", function() local pfile = get_pfile() + local total_voffset, total_hoffset = tex.voffset + pdfvariable.vorigin, tex.hoffset + pdfvariable.horigin local voff = node.new'kern' - voff.kern = tex.voffset + pdfvariable.vorigin + voff.kern = total_voffset voff.next = token.scan_list() - voff.next.shift = tex.hoffset + pdfvariable.horigin + voff.next.shift = total_hoffset local list = node.direct.tonode(node.direct.vpack(node.direct.todirect(voff))) - list.height = tex.pageheight - list.width = tex.pagewidth + local pageheight, pagewidth = tex.pageheight, tex.pagewidth + -- In the following, the total_[hv]offset represents a symmetric offset applied on the right/bottom. + -- The upper/left one is already included in the box dimensions + list.height = pageheight ~= 0 and pageheight or list.height + list.depth + total_voffset + list.width = pagewidth ~= 0 and pagewidth or list.width + total_hoffset local page, parent = pfile:newpage() cur_page = page local out, resources, annots = writer(pfile, list, fontdirs, usedglyphs, colorstacks) diff --git a/luametalatex-baseregisters.lua b/luametalatex-baseregisters.lua index 95c000f..7e4b7f7 100644 --- a/luametalatex-baseregisters.lua +++ b/luametalatex-baseregisters.lua @@ -117,9 +117,9 @@ end tex_variable(count_code, token.scan_int, 'suppressfontnotfounderror', 0) tex_variable(count_code, token.scan_int, 'outputmode', 1) -- The "traditional" default would be 0, - -- but we do not actually support that. -tex_variable(dimen_code, token.scan_dimen, 'pageheight', tex.sp'297mm') -tex_variable(dimen_code, token.scan_dimen, 'pagewidth', tex.sp'210mm') + -- but we do not actually support that. +tex_variable(dimen_code, token.scan_dimen, 'pageheight', 0) +tex_variable(dimen_code, token.scan_dimen, 'pagewidth', 0) tex_variable(count_code, token.scan_int, 'bodydirection', 0) tex_variable(count_code, token.scan_int, 'pagedirection', 0)