diff options
author | Karl Berry <karl@freefriends.org> | 2021-03-06 21:58:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-03-06 21:58:15 +0000 |
commit | 974640d66e61e81cb197ad96fdff7b08343e4c5a (patch) | |
tree | 2e1f75f32f312b7f24ba82b4590ae230bcd6f399 /Master/texmf-dist/tex/context/base/mkxl/lpdf-res.lmt | |
parent | b4fa72e61230aca75f7f6fbf988821f71edfb6b2 (diff) |
context
git-svn-id: svn://tug.org/texlive/trunk@58167 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkxl/lpdf-res.lmt')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkxl/lpdf-res.lmt | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-res.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-res.lmt new file mode 100644 index 00000000000..d3c591343fc --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-res.lmt @@ -0,0 +1,41 @@ +if not modules then modules = { } end modules ['lpdf-res'] = { + version = 1.001, + comment = "companion to lpdf-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local codeinjections = backends.codeinjections + +local nuts = nodes.nuts +local tonut = nodes.tonut + +local setwhd = nuts.setwhd +local setlist = nuts.setlist + +local new_hlist = nuts.pool.hlist + +local boxresources = tex.boxresources +local saveboxresource = boxresources.save +local useboxresource = boxresources.use +local getboxresourcedimensions = boxresources.getdimensions + +local pdfcollectedresources = lpdf.collectedresources + +function codeinjections.registerboxresource(n,offset) + local r = saveboxresource(n,nil,pdfcollectedresources(),true,0,offset or 0) -- direct, todo: accept functions as attr/resources + return r +end + +function codeinjections.restoreboxresource(index) + local hbox = new_hlist() + local list, wd, ht, dp = useboxresource(index) + setlist(hbox,tonut(list)) + setwhd(hbox,wd,ht,dp) + return hbox -- so we return a nut ! +end + +function codeinjections.boxresourcedimensions(index) + return getboxresourcedimensions(index) +end |