summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-12-14 14:16:56 +0100
committerPhilipp Gesang <phg42.2a@gmail.com>2013-12-14 14:16:56 +0100
commit11a33a66bf1a407097c0aea0d2fe7df3f6056f89 (patch)
treedc9b244b305e884a7a375885670b31bec19e7575
parent41b172923704902bbe23ec9372df2eb097c25d87 (diff)
downloadluaotfload-11a33a66bf1a407097c0aea0d2fe7df3f6056f89.tar.gz
[fontloader] sync with Context as of 2013-12-14
-rw-r--r--luaotfload-fontloader.lua83
1 files changed, 82 insertions, 1 deletions
diff --git a/luaotfload-fontloader.lua b/luaotfload-fontloader.lua
index 6d1450d..468168c 100644
--- a/luaotfload-fontloader.lua
+++ b/luaotfload-fontloader.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 11/25/13 20:09:50
+-- merge date : 12/14/13 13:43:12
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