summaryrefslogtreecommitdiff
path: root/tex/context/base/node-nut.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2015-10-04 20:15:06 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2015-10-04 20:15:06 +0200
commitd81d584da5152af05c07f7842054a926aae20e10 (patch)
tree9e15be94f1f8d05cccdbd575d4d5f0bac8cad221 /tex/context/base/node-nut.lua
parentc9ac836b7b44d49c623ad8052639ca7beeaf1311 (diff)
downloadcontext-d81d584da5152af05c07f7842054a926aae20e10.tar.gz
2015-10-04 19:27:00
Diffstat (limited to 'tex/context/base/node-nut.lua')
-rw-r--r--tex/context/base/node-nut.lua41
1 files changed, 30 insertions, 11 deletions
diff --git a/tex/context/base/node-nut.lua b/tex/context/base/node-nut.lua
index 14ee29a45..ef46d4d13 100644
--- a/tex/context/base/node-nut.lua
+++ b/tex/context/base/node-nut.lua
@@ -89,20 +89,10 @@ if not modules then modules = { } end modules ['node-met'] = {
local type, rawget = type, rawget
local nodes = nodes
-local gonuts = nodes.gonuts
local direct = node.direct
local fastcopy = table.fastcopy
--- if type(direct) ~= "table" then
--- return
--- elseif gonuts then
--- statistics.register("running in nuts mode", function() return "yes" end)
--- else
--- statistics.register("running in nuts mode", function() return "no" end)
--- return
--- end
-
local texget = tex.get
local nodecodes = nodes.nodecodes
@@ -208,6 +198,32 @@ nuts.unset_attribute = direct.unset_attribute
nuts.protect_glyphs = direct.protect_glyphs
nuts.unprotect_glyphs = direct.unprotect_glyphs
+nuts.effective_glue = direct.effective_glue
+
+if not nuts.effective_glue then
+
+ local getfield = nuts.getfield
+
+ function nuts.effective_glue(glue,parent)
+ local spec = getfield(glue,"spec")
+ local width = getfield(spec,"width")
+ if parent then
+ local sign = getfield(parent,"glue_sign")
+ if sign == 1 then
+ if getfield(spec,"stretch_order") == getfield(parent,"glue_order") then
+ return width + getfield(spec,"stretch") * getfield(parent,"glue_set")
+ end
+ elseif sign == 2 then
+ if getfield(spec,"shrink_order") == getfield(parent,"glue_order") then
+ return width - getfield(spec,"shrink") * getfield(parent,"glue_set")
+ end
+ end
+ end
+ return width
+ end
+
+end
+
-- placeholders
if not direct.kerning then
@@ -276,13 +292,16 @@ if not direct.getdisc then
-- this one is more efficient than three assignments and we need to
-- do it in order to updat ethe internal tail data (will change)
- function direct.setdisc(n,pre,post,replace,subtype)
+ function direct.setdisc(n,pre,post,replace,subtype,penalty)
setfield(n,"pre",pre)
setfield(n,"post",post)
setfield(n,"replace",replace)
if subtype then
setfield(n,"subtype",subtype)
end
+ if penalty then
+ -- setfield(n,"penalty",penalty)
+ end
end
-- very small speedup but more convenient