From f4c9d2d305f1214a144fcb23a66964761583234a Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 9 Feb 2018 01:00:38 +0100 Subject: 2018-02-09 00:12:00 --- tex/context/base/mkiv/node-nut.lua | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'tex/context/base/mkiv/node-nut.lua') 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 -- cgit v1.2.3