diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-05-16 11:12:18 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-05-16 11:12:18 +0200 |
commit | cbc37c39432e0ebe38e0922fc6d14c2955ab3ba2 (patch) | |
tree | 38358e219d38f2a49f227d96d24fdc27eb2544e6 /tex/context/base/mkiv/font-otj.lua | |
parent | fd0c4577a4b6e85ca2db664906e1a03807ce133f (diff) | |
download | context-cbc37c39432e0ebe38e0922fc6d14c2955ab3ba2.tar.gz |
2017-05-15 21:54:00
Diffstat (limited to 'tex/context/base/mkiv/font-otj.lua')
-rw-r--r-- | tex/context/base/mkiv/font-otj.lua | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/tex/context/base/mkiv/font-otj.lua b/tex/context/base/mkiv/font-otj.lua index 634f8a83c..2c79500e7 100644 --- a/tex/context/base/mkiv/font-otj.lua +++ b/tex/context/base/mkiv/font-otj.lua @@ -1434,6 +1434,35 @@ function injections.isspace(n,threshold,id) end end +-- We have a plugin so that Kai can use the next in plain. Such a plugin is rather application +-- specific. +-- +-- local getboth = nodes.direct.getboth +-- local getid = nodes.direct.getid +-- local getprev = nodes.direct.getprev +-- local getnext = nodes.direct.getnext +-- +-- local whatsit_code = nodes.nodecodes.whatsit +-- local glyph_code = nodes.nodecodes.glyph +-- +-- local function getspaceboth(n) -- fragile: what it prev/next has no width field +-- local prev, next = getboth(n) +-- while prev and (getid(prev) == whatsit_code or (getwidth(prev) == 0 and getid(prev) ~= glyph_code)) do +-- prev = getprev(prev) +-- end +-- while next and (getid(next) == whatsit_code or (getwidth(next) == 0 and getid(next) ~= glyph_code)) do +-- next = getnext(next) +-- end +-- end +-- +-- injections.installgetspaceboth(getspaceboth) + +local getspaceboth = getboth + +function injections.installgetspaceboth(gb) + getspaceboth = gb or getboth +end + local function injectspaces(head) if not triggers then @@ -1458,9 +1487,9 @@ local function injectspaces(head) end for n in traverse_id(glue_code,tonut(head)) do - local prev, next = getboth(n) - local prevchar = ischar(prev) - local nextchar = ischar(next) + local prev, next = getspaceboth(n) + local prevchar = prev and ischar(prev) + local nextchar = next and ischar(next) if nextchar then local font = getfont(next) local trig = triggers[font] |