More PDF variabes

We can now load luatex85.sty without warnings.
This commit is contained in:
Marcel Krüger 2020-07-01 14:25:50 +02:00
parent f4f829dbac
commit 961430ce42
2 changed files with 13 additions and 0 deletions

View File

@ -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

View File

@ -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