summaryrefslogtreecommitdiff
path: root/tex/generic
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-02-20 15:53:16 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-02-20 15:53:16 +0100
commit7ddc6c5aec02c5802944772975133733dc0e7440 (patch)
tree584f033bef72a8ab4b1e2174c3b2eadef1940494 /tex/generic
parentb5ef32a9a6a99e134e669b702e89a55fbabf5306 (diff)
downloadcontext-7ddc6c5aec02c5802944772975133733dc0e7440.tar.gz
2017-02-20 15:15:00
Diffstat (limited to 'tex/generic')
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua140
1 files changed, 117 insertions, 23 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index dc16e2426..baf9b1a8f 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 02/19/17 17:14:56
+-- merge date : 02/20/17 15:10:11
do -- begin closure to overcome local limits and interference
@@ -20956,16 +20956,48 @@ local function testrun(disc,t_run,c_run,...)
end
local pre,post,replace,pretail,posttail,replacetail=getdisc(disc,true)
local done=false
- if replace and prev then
- setlink(replacetail,next)
- local ok,overflow=t_run(replace,next,...)
- if ok and overflow then
- setfield(disc,"replace")
- setlink(prev,replace)
- setboth(disc)
- flush_node_list(disc)
- return replace,true
+ if (post or replace) and prev then
+ if post then
+ setlink(posttail,next)
+ else
+ post=next
+ end
+ if replace then
+ setlink(replacetail,next)
else
+ replace=next
+ end
+ local d_post=t_run(post,next,...)
+ local d_replace=t_run(replace,next,...)
+ if (d_post and d_post>0) or (d_replace and d_replace>0) then
+ local d=d_replace or d_post
+ if d_post and d<d_post then
+ d=d_post
+ end
+ local head,tail=getnext(disc),disc
+ for i=1,d do
+ tail=getnext(tail)
+ if getid(tail)==disc_code then
+ head,tail=flattendisk(head,tail)
+ end
+ end
+ local next=getnext(tail)
+ setnext(tail)
+ setprev(head)
+ local new=copy_node_list(head)
+ if posttail then
+ setlink(posttail,head)
+ else
+ post=head
+ end
+ if replacetail then
+ setlink(replacetail,new)
+ else
+ replace=new
+ end
+ setlink(disc,next)
+ else
+ setnext(posttail)
setnext(replacetail)
setprev(next,disc)
end
@@ -21050,6 +21082,7 @@ local function c_run_single(head,font,attr,lookupcache,step,dataset,sequence,rlm
return head,done
end
local function t_run_single(start,stop,font,attr,lookupcache)
+ local lastd=nil
while start~=stop do
local char=ischar(start,font)
if char then
@@ -21062,29 +21095,59 @@ local function t_run_single(start,stop,font,attr,lookupcache)
local lookupmatch=lookupcache[char]
if lookupmatch then
local s=startnext
+ local ss=nil
+ local sstop=s==stop
+ if not s then
+ s=ss
+ ss=nil
+ end
+ while getid(s)==disc_code do
+ ss=getnext(s)
+ s=getfield(s,"replace")
+ if not s then
+ s=ss
+ ss=nil
+ end
+ end
local l=nil
local d=0
while s do
- if s==stop then
- d=1
- elseif d>0 then
- d=d+1
- end
local lg=lookupmatch[getchar(s)]
if lg then
+ if sstop then
+ d=1
+ elseif d>0 then
+ d=d+1
+ end
l=lg
s=getnext(s)
+ sstop=s==stop
+ if not s then
+ s=ss
+ ss=nil
+ end
+ while getid(s)==disc_code do
+ ss=getnext(s)
+ s=getfield(s,"replace")
+ if not s then
+ s=ss
+ ss=nil
+ end
+ end
else
break
end
end
if l and l.ligature then
- return true,d>1
+ lastd=d
end
end
else
end
- start=starttnext
+ if lastd then
+ return lastd
+ end
+ start=startnext
else
break
end
@@ -21166,6 +21229,7 @@ local function c_run_multiple(head,font,attr,steps,nofsteps,dataset,sequence,rlm
return head,done
end
local function t_run_multiple(start,stop,font,attr,steps,nofsteps)
+ local lastd=nil
while start~=stop do
local char=ischar(start,font)
if char then
@@ -21182,24 +21246,51 @@ local function t_run_multiple(start,stop,font,attr,steps,nofsteps)
local lookupmatch=lookupcache[char]
if lookupmatch then
local s=startnext
+ local ss=nil
+ local sstop=s==stop
+ if not s then
+ s=ss
+ ss=nil
+ end
+ while getid(s)==disc_code do
+ ss=getnext(s)
+ s=getfield(s,"replace")
+ if not s then
+ s=ss
+ ss=nil
+ end
+ end
local l=nil
local d=0
while s do
- if s==stop then
- d=1
- elseif d>0 then
- d=d+1
- end
local lg=lookupmatch[getchar(s)]
if lg then
+ if sstop then
+ d=1
+ elseif d>0 then
+ d=d+1
+ end
l=lg
s=getnext(s)
+ sstop=s==stop
+ if not s then
+ s=ss
+ ss=nil
+ end
+ while getid(s)==disc_code do
+ ss=getnext(s)
+ s=getfield(s,"replace")
+ if not s then
+ s=ss
+ ss=nil
+ end
+ end
else
break
end
end
if l and l.ligature then
- return true,d>1
+ lastd=d
end
end
else
@@ -21208,6 +21299,9 @@ local function t_run_multiple(start,stop,font,attr,steps,nofsteps)
end
else
end
+ if lastd then
+ return lastd
+ end
start=startnext
else
break