diff options
Diffstat (limited to 'tex/context/base/mkiv/node-nut.lua')
-rw-r--r-- | tex/context/base/mkiv/node-nut.lua | 101 |
1 files changed, 31 insertions, 70 deletions
diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua index 6fe2e0f33..1465a6680 100644 --- a/tex/context/base/mkiv/node-nut.lua +++ b/tex/context/base/mkiv/node-nut.lua @@ -200,29 +200,7 @@ nuts.ligaturing = direct.ligaturing nuts.kerning = direct.kerning nuts.effective_glue = direct.effective_glue --- placeholders - -if not nuts.kerning then - - local n_kerning = node.kerning - - function nuts.kerning(head) - return tonode(n_kerning(tonut(head))) - end - -end - -if not nuts.ligaturing then - - local n_ligaturing = node.ligaturing - - function nuts.ligaturing(head) - return tonode(n_ligaturing(tonut(head))) - end - -end - -if not direct.mlist_to_hlist then +if not direct.mlist_to_hlist then -- needed local n_mlist_to_hlist = node.mlist_to_hlist @@ -232,15 +210,36 @@ if not direct.mlist_to_hlist then end -if not direct.setlist then - - local setfield = nuts.setfield +local is_zero_glue = direct.is_zero_glue +local setglue = direct.setglue +local getglue = direct.getglue + +if not is_zero_glue then + is_zero_glue = function(n) + return not n or ( + getfield(n,"width") == 0 and + getfield(n,"stretch") == 0 and + getfield(n,"shrink") == 0 + ) + end + setglue = function(n,width,stretch,shrink,stretch_order,shrink_order) + setfield(n,"width", width or 0) + setfield(n,"stretch", stretch or 0) + setfield(n,"shrink", shrink or 0) + setfield(n,"stretch_order",stretch_order or 0) + setfield(n,"shrink_order", shrink_order or 0) + end + getglue = function(n) + return + getfield(n,"width"), getfield(n,"stretch"), getfield(n,"shrink"), + getfield(n,"stretch_order"), getfield(n,"shrink_order") + end +end - function direct.setlist (n,l) setfield(n,"list",l) end - function direct.setleader (n,l) setfield(n,"leader",l) end - function direct.setsubtype(n,s) setfield(n,"subtype",s) end +nuts.is_zero_glue = is_zero_glue +nuts.setglue = setglue +nuts.getglue = getglue -end -- if not direct.getpre then -- @@ -252,10 +251,11 @@ end -- -- end -nuts.getdisc = direct.getdisc ----.getpre = direct.getpre ----.getpost = direct.getpost ----.getreplace = direct.getreplace + +nuts.getdisc = direct.getdisc nuts.setdisc = direct.setdisc nuts.setchar = direct.setchar nuts.setnext = direct.setnext @@ -267,45 +267,6 @@ nuts.setlist = direct.setlist nuts.setleader = direct.setleader nuts.setsubtype = direct.setsubtype -if not direct.is_glyph then - - local getchar = direct.getchar - local getid = direct.getid - local getfont = direct.getfont - local getsubtype = direct.getsubtype - - local glyph_code = nodes.nodecodes.glyph - - function direct.is_glyph(n,f) - local id = getid(n) - if id == glyph_code then - if f and getfont(n) == f then - return getchar(n) - else - return false - end - else - return nil, id - end - end - - function direct.is_char(n,f) - local id = getid(n) - if id == glyph_code then - if getsubtype(n) >= 256 then - return false - elseif f and getfont(n) == f then - return getchar(n) - else - return false - end - else - return nil, id - end - end - -end - nuts.is_char = direct.is_char nuts.ischar = direct.is_char nuts.is_glyph = direct.is_glyph |