summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/node-nut.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-02-09 01:00:38 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-02-09 01:00:38 +0100
commitf4c9d2d305f1214a144fcb23a66964761583234a (patch)
treee296f0ac0541d75729af1272346f30506405a6a4 /tex/context/base/mkiv/node-nut.lua
parent1687077b0a63417ad4dce58f6c869a6e115d9b72 (diff)
downloadcontext-f4c9d2d305f1214a144fcb23a66964761583234a.tar.gz
2018-02-09 00:12:00
Diffstat (limited to 'tex/context/base/mkiv/node-nut.lua')
-rw-r--r--tex/context/base/mkiv/node-nut.lua38
1 files changed, 38 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua
index a621b6481..fe154504f 100644
--- a/tex/context/base/mkiv/node-nut.lua
+++ b/tex/context/base/mkiv/node-nut.lua
@@ -144,13 +144,48 @@ nodes.tonut = tonut
-- helpers
if not direct.getfam then -- LUATEXVERSION < 1.070
+
local getfield = direct.getfield
local setfield = direct.setfield
direct.getfam = function(n) return getfield(n,"small_fam") end
direct.setfam = function(n,f) setfield(n,"small_fam",f) end
+
+end
+
+if not direct.getdirection then
+
+ local getdir = direct.getdir
+ local setdir = direct.setdir
+
+ direct.getdirection = function(n)
+ local d = getdir(n)
+ if d == "TLT" then return 0 end
+ if d == "+TLT" then return 0, false end
+ if d == "-TLT" then return 0, true end
+ if d == "TRT" then return 1 end
+ if d == "+TRT" then return 1, false end
+ if d == "-TRT" then return 1, true end
+ if d == "LTL" then return 2 end
+ if d == "+LTL" then return 2, false end
+ if d == "-LTL" then return 2, true end
+ if d == "RTT" then return 3 end
+ if d == "+RTT" then return 3, false end
+ if d == "-RTT" then return 3, true end
+ end
+
+ direct.setdirection = function(n,d,c)
+ if d == 0 then if c == true then setdir("-TLT") elseif c == false then setdir("+TLT") else setdir("TLT") end
+ elseif d == 1 then if c == true then setdir("-TRT") elseif c == false then setdir("+TRT") else setdir("TRT") end
+ elseif d == 2 then if c == true then setdir("-LTL") elseif c == false then setdir("+LTL") else setdir("LTL") end
+ elseif d == 3 then if c == true then setdir("-RTT") elseif c == false then setdir("+RTT") else setdir("RTT") end
+ else if c == true then setdir("-TLT") elseif c == false then setdir("+TLT") else setdir("TLT") end end
+ end
+
end
+local nuts = nodes.nuts
+
nuts.tostring = direct.tostring
nuts.copy = direct.copy
nuts.copy_node = direct.copy
@@ -300,6 +335,9 @@ nuts.setkern = direct.setkern
nuts.getdir = direct.getdir
nuts.setdir = direct.setdir
+nuts.getdirection = direct.getdirection
+nuts.setdirection = direct.setdirection
+
nuts.getpenalty = direct.getpenalty
nuts.setpenalty = direct.setpenalty