diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-05-31 09:46:19 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-05-31 09:46:19 +0200 |
commit | a274872832cdd1e71ce4b019858c61c5a77c6b98 (patch) | |
tree | 31aac20468007968eb094db54e530a00a7fec5ff /tex/context/base/mkiv/supp-box.lua | |
parent | 66f653890a45d1275826d56798071a97468d88be (diff) | |
download | context-a274872832cdd1e71ce4b019858c61c5a77c6b98.tar.gz |
2016-05-31 09:07:00
Diffstat (limited to 'tex/context/base/mkiv/supp-box.lua')
-rw-r--r-- | tex/context/base/mkiv/supp-box.lua | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/supp-box.lua b/tex/context/base/mkiv/supp-box.lua index 98d0e0474..bf41899bf 100644 --- a/tex/context/base/mkiv/supp-box.lua +++ b/tex/context/base/mkiv/supp-box.lua @@ -38,6 +38,7 @@ local getid = nuts.getid local getlist = nuts.getlist local getattribute = nuts.getattribute local getbox = nuts.getbox +local takebox = nuts.takebox local setfield = nuts.setfield local setlink = nuts.setlink @@ -54,6 +55,7 @@ local find_tail = nuts.tail local traverse_id = nuts.traverse_id local link_nodes = nuts.linked local dimensions = nuts.dimensions +local hpack = nuts.hpack local listtoutf = nodes.listtoutf @@ -389,6 +391,35 @@ interfaces.implement { end } +interfaces.implement { + name = "getnaturalwd", + arguments = "integer", + actions = function(n) + local w, h, d = 0, 0, 0 + local l = getlist(getbox(n)) + if l then + w, h, d = dimensions(l) + end + context("\\dimexpr%i\\scaledpoint\\relax",w) + end +} + +local function setboxtonaturalwd(n) + local old = takebox(n) + local new = hpack(getlist(old)) + setlist(old,nil) + free_node(old) + setbox(n,new) +end + +interfaces.implement { + name = "setnaturalwd", + arguments = "integer", + actions = setboxtonaturalwd +} + +nodes.setboxtonaturalwd = setboxtonaturalwd + local function firstdirinbox(n) local b = getbox(n) if b then |