diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-05-25 13:21:58 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-05-25 13:21:58 +0200 |
commit | 82aed3e7e8af29f359ebef4f93684d20e98107e6 (patch) | |
tree | 2b92c44d14566481aad5635f479b1b106d4e2347 /tex/context/base/mkiv/font-otj.lua | |
parent | aceba29d651766f5621b9812d4c40e28029bc4ea (diff) | |
download | context-82aed3e7e8af29f359ebef4f93684d20e98107e6.tar.gz |
2017-05-25 12:56: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] |