From 11a33a66bf1a407097c0aea0d2fe7df3f6056f89 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 14 Dec 2013 14:16:56 +0100 Subject: [fontloader] sync with Context as of 2013-12-14 --- luaotfload-fontloader.lua | 83 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3 From 8304d6d429dffe685597fc886048d9f2e2e1e9da Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 14 Dec 2013 14:29:21 +0100 Subject: [tool] switch blacklist printer to io.* --- luaotfload-tool.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua index ec6ee57..deca5ea 100755 --- a/luaotfload-tool.lua +++ b/luaotfload-tool.lua @@ -773,7 +773,7 @@ actions.blacklist = function (job) names.read_blacklist() local n = 0 for n, entry in next, table.sortedkeys(names.blacklist) do - texiowrite_nl(stringformat("(%d %s)", n, entry)) + iowrite (stringformat("(%d %s)\n", n, entry)) end return true, false end @@ -867,7 +867,7 @@ actions.query = function (job) end if job.show_info then show_font_info (foundname, query, job.full_info, job.warnings) - texiowrite_nl "" + iowrite "\n" end else logs.names_report(false, 0, -- cgit v1.2.3 From 11bfbe1081cb6874ecacf4a7067f011e21722b6a Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 20 Dec 2013 13:16:38 +0100 Subject: [fontloader] sync with Context as of 2013-12-20 --- luaotfload-fontloader.lua | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/luaotfload-fontloader.lua b/luaotfload-fontloader.lua index 468168c..688cfec 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 : 12/14/13 13:43:12 +-- merge date : 12/20/13 00:55:14 do -- begin closure to overcome local limits and interference @@ -6435,8 +6435,25 @@ registerdirective("fonts.otf.loader.pack",function(v) packdata=v end) registerdirective("fonts.otf.loader.syncspace",function(v) syncspace=v end) registerdirective("fonts.otf.loader.forcenotdef",function(v) forcenotdef=v end) registerdirective("fonts.otf.loader.overloadkerns",function(v) overloadkerns=v end) +function otf.fileformat(filename) + local leader=lower(io.loadchunk(filename,4)) + local suffix=lower(file.suffix(filename)) + if leader=="otto" then + return "opentype","otf",suffix=="otf" + elseif leader=="ttcf" then + return "truetype","ttc",suffix=="ttc" + elseif suffix=="ttc" then + return "truetype","ttc",true + else + return "truetype","ttf",suffix=="ttf" + end +end local function otf_format(filename) - return formats[lower(file.suffix(filename))] + local format,suffix,okay=otf.fileformat(filename) + if not okay then + report_otf("font %a is actually an %a file",filename,format) + end + return suffix end local function load_featurefile(raw,featurefile) if featurefile and featurefile~="" then @@ -8831,7 +8848,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 disc_code=nodecodes.disc local kern_code=nodecodes.kern local nuts=nodes.nuts local nodepool=nuts.pool -- cgit v1.2.3