diff options
Diffstat (limited to 'tex/generic')
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 83 |
1 files changed, 82 insertions, 1 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 4366fb070..3a705f242 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 12/04/13 11:34:01 +-- merge date : 12/14/13 13:34:05 do -- begin closure to overcome local limits and interference @@ -1668,6 +1668,24 @@ function table.sorted(t,...) sort(t,...) return t end +function table.values(t,s) + if t then + local values,keys,v={},{},0 + for key,value in next,t do + if not keys[value] then + v=v+1 + values[v]=value + keys[k]=key + end + end + if s then + sort(values) + end + return values + else + return {} + end +end end -- closure @@ -8813,6 +8831,7 @@ nodes.injections=nodes.injections or {} local injections=nodes.injections local nodecodes=nodes.nodecodes local glyph_code=nodecodes.glyph +local kern_disc=nodecodes.disc local kern_code=nodecodes.kern local nuts=nodes.nuts local nodepool=nuts.pool @@ -11445,6 +11464,31 @@ local function featuresprocessor(head,font,attr) return head end end + local function kerndisc(disc) + local prev=getprev(disc) + local next=getnext(disc) + if prev and next then + setfield(prev,"next",next) + local a=getattr(prev,0) + if a then + a=(a==attr) and (not attribute or getattr(prev,a_state)==attribute) + else + a=not attribute or getattr(prev,a_state)==attribute + end + if a then + local lookupmatch=lookupcache[getchar(prev)] + if lookupmatch then + local h,d,ok=handler(head,prev,dataset[4],lookupname,lookupmatch,sequence,lookuphash,1) + if ok then + done=true + success=true + end + end + end + setfield(prev,"next",disc) + end + return next + end while start do local id=getid(start) if id==glyph_code then @@ -11488,6 +11532,8 @@ local function featuresprocessor(head,font,attr) local new=subrun(replace) if new then setfield(start,"replace",new) end end +elseif typ=="gpos_single" or typ=="gpos_pair" then + kerndisc(start) end start=getnext(start) elseif id==whatsit_code then @@ -11579,6 +11625,39 @@ local function featuresprocessor(head,font,attr) return head end end + local function kerndisc(disc) + local prev=getprev(disc) + local next=getnext(disc) + if prev and next then + setfield(prev,"next",next) + local a=getattr(prev,0) + if a then + a=(a==attr) and (not attribute or getattr(prev,a_state)==attribute) + else + a=not attribute or getattr(prev,a_state)==attribute + end + if a then + for i=1,ns do + local lookupname=subtables[i] + local lookupcache=lookuphash[lookupname] + if lookupcache then + local lookupmatch=lookupcache[getchar(prev)] + if lookupmatch then + local h,d,ok=handler(head,prev,dataset[4],lookupname,lookupmatch,sequence,lookuphash,i) + if ok then + done=true + break + end + end + else + report_missing_cache(typ,lookupname) + end + end + end + setfield(prev,"next",disc) + end + return next + end while start do local id=getid(start) if id==glyph_code then @@ -11633,6 +11712,8 @@ local function featuresprocessor(head,font,attr) local new=subrun(replace) if new then setfield(start,"replace",new) end end +elseif typ=="gpos_single" or typ=="gpos_pair" then + kerndisc(start) end start=getnext(start) elseif id==whatsit_code then |