diff --git a/luametalatex-baseregisters.lua b/luametalatex-baseregisters.lua index 2b47c16..2e84965 100644 --- a/luametalatex-baseregisters.lua +++ b/luametalatex-baseregisters.lua @@ -128,6 +128,7 @@ pdf_variable(dimen_code, token.scan_dimen, 'horigin', tex.sp'1in') pdf_variable(dimen_code, token.scan_dimen, 'vorigin', tex.sp'1in') pdf_variable(dimen_code, token.scan_dimen, 'linkmargin', tex.sp'0pt') pdf_variable(dimen_code, token.scan_dimen, 'destmargin', tex.sp'0pt') +pdf_variable(dimen_code, token.scan_dimen, 'threadmargin', tex.sp'0pt') -- We don't support threads, so this isn't doing anything pdf_variable(count_code, token.scan_int, 'majorversion', 1) pdf_variable(count_code, token.scan_int, 'minorversion', 7) pdf_variable(count_code, token.scan_int, 'compresslevel', 0) @@ -155,6 +156,14 @@ pdf_toks('pageattr', '') pdf_toks('pagesattr', '') pdf_toks('pageresources', '') +-- The following two are special: The should have force_default=true because we ignore them, +-- but they are token lists so that doesn't really work. Instead, we check during shipout that +-- the variables are empty. TODO: Find a nicer solution +-- The reason for not implementing them is that XForm specific resources and attributes make +-- much more sense, so these two generic ones are useless and error-prone. +pdf_toks('xformresources', '') +pdf_toks('xformattr', '') + function tex.getbodydir() return tex.bodydirection end function tex.getpagedir() return tex.pagedirection end function tex.setbodydir(i) tex.bodydirection = i end diff --git a/luametalatex-pdf-savedbox.lua b/luametalatex-pdf-savedbox.lua index dabcffe..4dad21c 100644 --- a/luametalatex-pdf-savedbox.lua +++ b/luametalatex-pdf-savedbox.lua @@ -1,4 +1,5 @@ local writer -- = require'luametalatex-nodewriter' -- This would introduce some cyclic dependency +local pdfvariable = pdf.variable -- XForms currently have the form {width, height, depth, objnum, attributes, list, margin} local xforms = {} @@ -12,6 +13,9 @@ local function shipout(pfile, xform, fontdirs, usedglyphs) local out, resources, annots = writer(pfile, list, fontdirs, usedglyphs) cur_page = last_page assert(annots == '') + if pdfvariable.xformattr ~= '' or pdfvariable.xformresources ~= '' then + texio.write_nl('term and log', 'WARNING (savedboxresource shipout): Ignoring unsupported PDF variables xformattr and xformresources. Specify resources and attributes for specific XForms instead.') + end local dict = string.format('/Subtype/Form/BBox[%f %f %f %f]/Resources<<%s%s>>%s', -to_bp(margin), -to_bp(list.depth+margin), to_bp(list.width+margin), to_bp(list.height+margin), resources, xform.resources or '', xform.attributes or '') node.flush_list(list) xform.list = nil