From 64f6e8fc0c6cb9254a6fe3db0b4ab31c51cf8524 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 4 Apr 2019 14:11:01 +0200 Subject: 2019-04-04 13:38:00 --- tex/context/base/mkiv/node-rul.lua | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'tex/context/base/mkiv/node-rul.lua') diff --git a/tex/context/base/mkiv/node-rul.lua b/tex/context/base/mkiv/node-rul.lua index ea0e5c7a0..1df5bf32a 100644 --- a/tex/context/base/mkiv/node-rul.lua +++ b/tex/context/base/mkiv/node-rul.lua @@ -48,7 +48,9 @@ local setattrlist = nuts.setattrlist local setshift = nuts.setshift local getwidth = nuts.getwidth local setwidth = nuts.setwidth +local setoffsets = nuts.setoffsets local setfield = nuts.setfield +local getdata = nuts.getdata local isglyph = nuts.isglyph @@ -163,28 +165,23 @@ local ruleactions = { } rules .ruleactions = ruleactions nutrules.ruleactions = ruleactions -- convenient -local function mathradical(n,h,v) - ----- size = getfield(n,"index") - local font = getfield(n,"transform") +local function mathaction(n,h,v,what) + local font = CONTEXTLMTXMODE > 1 and getdata(n) or getfield(n,"transform") local actions = fontresources[font].mathruleactions if actions then - local action = actions.radicalaction + local action = actions[what] if action then action(n,h,v,font) end end end +local function mathradical(n,h,v) + mathaction(n,h,v,"radicalaction") +end + local function mathrule(n,h,v) - ----- size = getfield(n,"index") - local font = getfield(n,"transform") - local actions = fontresources[font].mathruleactions - if actions then - local action = actions.hruleaction - if action then - action(n,h,v,font) - end - end + mathaction(n,h,v,"hruleaction") end local function useraction(n,h,v) @@ -745,7 +742,7 @@ implement { actions = nodes.linefillers.enable } --- We add a bonus feature here: +-- We add a bonus feature here (experiment): interfaces.implement { name = "autorule", @@ -754,19 +751,22 @@ interfaces.implement { { "width", "dimension" }, { "height", "dimension" }, { "depth", "dimension" }, + { "xoffset", "dimension" }, + { "yoffset", "dimension" }, { "left", "dimension" }, { "right", "dimension" }, }, }, actions = function(t) - local l = t.left - local r = t.right local n = new_rule( t.width, t.height, t.depth ) setattrlist(n,true) + setoffsets(n,t.xoffset,t.yoffset) -- ,t.left, t.right + local l = t.left + local r = t.right if l then setfield(n,"left",l) end -- cgit v1.2.3