summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/pack-rul.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-04-18 22:52:45 +0000
committerKarl Berry <karl@freefriends.org>2015-04-18 22:52:45 +0000
commit16aa5a7c87f18a2483d0d61795899f886781b51c (patch)
tree1d72f00b2a4185425393598402fe055c61d1de58 /Master/texmf-dist/tex/context/base/pack-rul.lua
parente68dc4d5506d46bf72823234f902bc76d1f70352 (diff)
context, from www.pragma-ade.com/context/beta/cont-tmf.zip (18apr15)
git-svn-id: svn://tug.org/texlive/trunk@36923 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/pack-rul.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/pack-rul.lua18
1 files changed, 15 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/context/base/pack-rul.lua b/Master/texmf-dist/tex/context/base/pack-rul.lua
index 0c29eb5f1dd..151642c3a1b 100644
--- a/Master/texmf-dist/tex/context/base/pack-rul.lua
+++ b/Master/texmf-dist/tex/context/base/pack-rul.lua
@@ -14,6 +14,12 @@ if not modules then modules = { } end modules ['pack-rul'] = {
-- challenge: adapt glue_set
-- setfield(h,"glue_set", getfield(h,"glue_set") * getfield(h,"width")/maxwidth -- interesting ... doesn't matter much
+-- \framed[align={lohi,middle}]{$x$}
+-- \framed[align={lohi,middle}]{$ $}
+-- \framed[align={lohi,middle}]{\hbox{ }}
+-- \framed[align={lohi,middle}]{\hbox{}}
+-- \framed[align={lohi,middle}]{$\hskip2pt$}
+
local type = type
local hlist_code = nodes.nodecodes.hlist
@@ -24,6 +30,8 @@ local line_code = nodes.listcodes.line
local texsetdimen = tex.setdimen
local texsetcount = tex.setcount
+local implement = interfaces.implement
+
local nuts = nodes.nuts
local getfield = nuts.getfield
@@ -39,7 +47,7 @@ local hpack = nuts.hpack
local traverse_id = nuts.traverse_id
local node_dimensions = nuts.dimensions
-function commands.doreshapeframedbox(n)
+local function doreshapeframedbox(n)
local box = getbox(n)
local noflines = 0
local firstheight = nil
@@ -91,7 +99,7 @@ function commands.doreshapeframedbox(n)
-- vdone = true
end
if not firstheight then
- -- done
+ -- done)
elseif maxwidth ~= 0 then
if hdone then
for h in traverse_id(hlist_code,list) do
@@ -117,6 +125,8 @@ function commands.doreshapeframedbox(n)
-- end
setfield(box,"width",maxwidth)
averagewidth = noflines > 0 and totalwidth/noflines or 0
+ else -- e.g. empty math {$ $} or \hbox{} or ...
+setfield(box,"width",0)
end
end
end
@@ -128,7 +138,7 @@ function commands.doreshapeframedbox(n)
texsetdimen("global","framedaveragewidth",averagewidth)
end
-function commands.doanalyzeframedbox(n)
+local function doanalyzeframedbox(n)
local box = getbox(n)
local noflines = 0
local firstheight = nil
@@ -156,6 +166,8 @@ function commands.doanalyzeframedbox(n)
texsetdimen("global","framedlastdepth",lastdepth or 0)
end
+implement { name = "doreshapeframedbox", actions = doreshapeframedbox, arguments = "integer" }
+implement { name = "doanalyzeframedbox", actions = doanalyzeframedbox, arguments = "integer" }
function nodes.maxboxwidth(box)
local boxwidth = getfield(box,"width")