diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-03-26 13:38:18 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-03-26 13:38:18 +0100 |
commit | 788487819ccf38a8478cc2afd88e0c0b088d0ec1 (patch) | |
tree | 215addbe3b9e293c2958227e7fc8923880b2e71f /tex/context/base/mkiv/spac-chr.lua | |
parent | adfe72d5a0c9d7bdc1bd7bc8faabb4d05e21d70a (diff) | |
download | context-788487819ccf38a8478cc2afd88e0c0b088d0ec1.tar.gz |
2016-03-26 13:07:00
Diffstat (limited to 'tex/context/base/mkiv/spac-chr.lua')
-rw-r--r-- | tex/context/base/mkiv/spac-chr.lua | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/tex/context/base/mkiv/spac-chr.lua b/tex/context/base/mkiv/spac-chr.lua index 3eb348586..97b32c366 100644 --- a/tex/context/base/mkiv/spac-chr.lua +++ b/tex/context/base/mkiv/spac-chr.lua @@ -34,12 +34,12 @@ local getfield = nuts.getfield local setfield = nuts.setfield local getnext = nuts.getnext local getprev = nuts.getprev -local getid = nuts.getid local getattr = nuts.getattr local setattr = nuts.setattr local getfont = nuts.getfont local getchar = nuts.getchar local setsubtype = nuts.setsubtype +local isglyph = nuts.isglyph local setcolor = nodes.tracers.colors.set @@ -181,32 +181,42 @@ local methods = { [0x001F] = function(head,current) local next = getnext(current) - if next and getid(next) == glyph_code then - local char = getchar(next) - head, current = remove_node(head,current,true) - if not is_punctuation[char] then - local p = fontparameters[getfont(next)] - head, current = insert_node_before(head,current,new_glue(p.space,p.space_stretch,p.space_shrink)) + if next then + local char = isglyph(next) + if char then + head, current = remove_node(head,current,true) + if not is_punctuation[char] then + local p = fontparameters[getfont(next)] + head, current = insert_node_before(head,current,new_glue(p.space,p.space_stretch,p.space_shrink)) + end end end end, [0x00A0] = function(head,current) -- nbsp local next = getnext(current) - if next and getid(next) == glyph_code then - local char = getchar(next) - if char == 0x200C or char == 0x200D then -- nzwj zwj + if next then + local char = isglyph(current) + if not char then + -- move on + elseif char == 0x200C or char == 0x200D then -- nzwj zwj next = getnext(next) - if next and nbsphash[getchar(next)] then - return false + if next then + char = isglyph(next) + if char and nbsphash[char] then + return false + end end elseif nbsphash[char] then return false end end local prev = getprev(current) - if prev and getid(prev) == glyph_code and nbsphash[getchar(prev)] then - return false + if prev then + local char = isglyph(prev) + if char and nbsphash[char] then + return false + end end return nbsp(head,current) end, @@ -280,10 +290,9 @@ function characters.handler(head) -- todo: use traverse_id local current = head local done = false while current do - local id = getid(current) - if id == glyph_code then - local next = getnext(current) - local char = getchar(current) + local char, id = isglyph(current) + if char then + local next = getnext(current) local method = methods[char] if method then if trace_characters then |