From 29620364877381833baaf5c767177413c125d3cd Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 26 Apr 2013 01:15:21 +0200 Subject: import from Context as of 2013-04-26 --- luaotfload-merged.lua | 62 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 17 deletions(-) (limited to 'luaotfload-merged.lua') diff --git a/luaotfload-merged.lua b/luaotfload-merged.lua index da5e35a..bb89e39 100644 --- a/luaotfload-merged.lua +++ b/luaotfload-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 04/24/13 13:39:43 +-- merge date : 04/25/13 18:50:39 do -- begin closure to overcome local limits and interference @@ -7412,6 +7412,7 @@ nodes.injections=nodes.injections or {} local injections=nodes.injections local nodecodes=nodes.nodecodes local glyph_code=nodecodes.glyph +local kern_code=nodecodes.kern local nodepool=nodes.pool local newkern=nodepool.kern local traverse_id=node.traverse_id @@ -7505,7 +7506,7 @@ local function trace(head) local cb=n[a_cursbase] local cc=n[a_curscurs] local char=n.char - report_injections("font %s, char %U, glyph %c",char,n.font,char) + report_injections("font %s, char %U, glyph %c",n.font,char,char) if kp then local k=kerns[kp] if k[3] then @@ -7542,6 +7543,24 @@ local function trace(head) end report_injections("end run") end +local function show_result(head) + local current=head + local skipping=false + while current do + local id=current.id + if id==glyph_code then + report_injections("char: %C, width %p, xoffset %p, yoffset %p",current.char,current.width,current.xoffset,current.yoffset) + skipping=false + elseif id==kern_code then + report_injections("kern: %p",current.kern) + skipping=false + elseif not skipping then + report_injections() + skipping=true + end + current=current.next + end +end function injections.handler(head,where,keep) local has_marks,has_cursives,has_kerns=next(marks),next(cursives),next(kerns) if has_marks or has_cursives then @@ -7680,17 +7699,26 @@ function injections.handler(head,where,keep) local d=mrks[index] if d then local rlmode=d[3] - if rlmode and rlmode>=0 then - local k=wx[p] - if k then - n.xoffset=p.xoffset-p.width+d[1]-k[2] + local k=wx[p] + if k then + local x=k[2] + local w=k[4] + if w then + if rlmode and rlmode>=0 then + n.xoffset=p.xoffset-p.width+d[1]-x + else + n.xoffset=p.xoffset-d[1]-x + end else - n.xoffset=p.xoffset-p.width+d[1] + if rlmode and rlmode>=0 then + n.xoffset=p.xoffset-p.width+d[1] + else + n.xoffset=p.xoffset-d[1]-x + end end else - local k=wx[p] - if k then - n.xoffset=p.xoffset-d[1]-k[2] + if rlmode and rlmode>=0 then + n.xoffset=p.xoffset-p.width+d[1] else n.xoffset=p.xoffset-d[1] end @@ -7723,21 +7751,21 @@ function injections.handler(head,where,keep) local wx=w-x if rl<0 then if wx~=0 then - insert_node_before(head,n,newkern(wx)) + insert_node_before(head,n,newkern(wx)) end if x~=0 then - insert_node_after (head,n,newkern(x)) + insert_node_after (head,n,newkern(x)) end else if x~=0 then - insert_node_before(head,n,newkern(x)) + insert_node_before(head,n,newkern(x)) end if wx~=0 then - insert_node_after(head,n,newkern(wx)) + insert_node_after (head,n,newkern(wx)) end end elseif x~=0 then - insert_node_before(head,n,newkern(x)) + insert_node_before(head,n,newkern(x)) end end end @@ -7746,9 +7774,9 @@ function injections.handler(head,where,keep) if k~=0 then local rln=rl[n] if rln and rln<0 then - insert_node_before(head,n,newkern(-k)) + insert_node_before(head,n,newkern(-k)) else - insert_node_before(head,n,newkern(k)) + insert_node_before(head,n,newkern(k)) end end end -- cgit v1.2.3 From 76569528866a34fb649611997792d936a283190b Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 26 Apr 2013 19:08:30 +0200 Subject: import from Context as of 2013-04-26 --- luaotfload-merged.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'luaotfload-merged.lua') diff --git a/luaotfload-merged.lua b/luaotfload-merged.lua index bb89e39..0cf2ce4 100644 --- a/luaotfload-merged.lua +++ b/luaotfload-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 04/25/13 18:50:39 +-- merge date : 04/26/13 15:13:48 do -- begin closure to overcome local limits and interference @@ -7705,7 +7705,7 @@ function injections.handler(head,where,keep) local w=k[4] if w then if rlmode and rlmode>=0 then - n.xoffset=p.xoffset-p.width+d[1]-x + n.xoffset=p.xoffset-p.width+d[1]-(w-x) else n.xoffset=p.xoffset-d[1]-x end @@ -7745,7 +7745,8 @@ function injections.handler(head,where,keep) end if next(wx) then for n,k in next,wx do - local x,w=k[2] or 0,k[4] + local x=k[2] + local w=k[4] if w then local rl=k[1] local wx=w-x -- cgit v1.2.3 From ed0cde735cc25079df9600a43b09ed8163ac1d3f Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 29 Apr 2013 22:26:13 +0200 Subject: sync fontloader code with Context as of 2013-04-29 --- luaotfload-merged.lua | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) (limited to 'luaotfload-merged.lua') diff --git a/luaotfload-merged.lua b/luaotfload-merged.lua index 0cf2ce4..bf22bac 100644 --- a/luaotfload-merged.lua +++ b/luaotfload-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 04/26/13 15:13:48 +-- merge date : 04/29/13 20:30:03 do -- begin closure to overcome local limits and interference @@ -3039,7 +3039,6 @@ function caches.getreadablepaths(category,subcategory) end local function makefullname(path,name) if path and path~="" then - name="temp-"..name return file.addsuffix(file.join(path,name),"lua"),file.addsuffix(file.join(path,name),usingjit and "lub" or "luc") end end @@ -3093,7 +3092,7 @@ function caches.compile(data,luaname,lucname) d=table.serialize(data,true) end if d and d~="" then - local f=io.open(lucname,'w') + local f=io.open(lucname,'wb') if f then local s=loadstring(d) if s then @@ -3218,7 +3217,7 @@ function containers.content(container,name) return container.storage[name] end function containers.cleanname(name) - return (gsub(lower(name),"[^%w%d]+","-")) + return (gsub(lower(name),"[^%w\128-\255]+","-")) end end -- closure @@ -4829,22 +4828,35 @@ end local fonts=fonts fonts.names=fonts.names or {} fonts.names.version=1.001 -fonts.names.basename="luatex-fonts-names.lua" +fonts.names.basename="luatex-fonts-names" fonts.names.new_to_old={} fonts.names.old_to_new={} +fonts.names.cache=containers.define("fonts","data",fonts.names.version,true) local data,loaded=nil,false local fileformats={ "lua","tex","other text files" } +function fonts.names.reportmissingbase() + texio.write("") + fonts.names.reportmissingbase=nil +end +function fonts.names.reportmissingname() + texio.write("") + fonts.names.reportmissingname=nil +end function fonts.names.resolve(name,sub) if not loaded then local basename=fonts.names.basename if basename and basename~="" then - for i=1,#fileformats do - local format=fileformats[i] - local foundname=resolvers.findfile(basename,format) or "" - if foundname~="" then - data=dofile(foundname) - texio.write("") - break + data=containers.read(fonts.names.cache,basename) + if not data then + basename=file.addsuffix(basename,"lua") + for i=1,#fileformats do + local format=fileformats[i] + local foundname=resolvers.findfile(basename,format) or "" + if foundname~="" then + data=dofile(foundname) + texio.write("") + break + end end end end @@ -4860,9 +4872,12 @@ function fonts.names.resolve(name,sub) else return filename,false end - else + elseif fonts.names.reportmissingname then + fonts.names.reportmissingname() return name,false end + elseif fonts.names.reportmissingbase then + fonts.names.reportmissingbase() end end fonts.names.resolvespec=fonts.names.resolve @@ -7713,7 +7728,7 @@ function injections.handler(head,where,keep) if rlmode and rlmode>=0 then n.xoffset=p.xoffset-p.width+d[1] else - n.xoffset=p.xoffset-d[1]-x + n.xoffset=p.xoffset-d[1]-x end end else @@ -10054,6 +10069,8 @@ for s=1,#datasets do if ok then success=true break + elseif not start then + break end end else -- cgit v1.2.3