From 975b65fc1939187bb6493a47da5cfabb77d70a3e Mon Sep 17 00:00:00 2001 From: Marius Date: Thu, 25 Apr 2013 20:20:33 +0300 Subject: beta 2013.04.25 18:50 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4134 -> 4136 bytes tex/context/base/context-version.png | Bin 40539 -> 40499 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/node-inj.lua | 101 ++++++++++++++++----- tex/context/base/status-files.pdf | Bin 24718 -> 24726 bytes tex/context/base/status-lua.pdf | Bin 211512 -> 211579 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 62 +++++++++---- 8 files changed, 126 insertions(+), 41 deletions(-) diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index df19f22cf..e53a2201d 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.04.24 13:39} +\newcontextversion{2013.04.25 18:50} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 86f4912f4..9d1236a83 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png index a7429df88..6e4197107 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 8b5825485..4d9101353 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.04.24 13:39} +\edef\contextversion{2013.04.25 18:50} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/node-inj.lua b/tex/context/base/node-inj.lua index 3e1687426..a53b5df50 100644 --- a/tex/context/base/node-inj.lua +++ b/tex/context/base/node-inj.lua @@ -28,6 +28,7 @@ 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 @@ -147,7 +148,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 @@ -191,6 +192,25 @@ end -- We can have a fast test on a font being processed, so we can check faster for marks etc -- but I'll make a context variant anyway. +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 @@ -335,27 +355,58 @@ function injections.handler(head,where,keep) local d = mrks[index] if d then local rlmode = d[3] - if rlmode and rlmode >= 0 then - -- new per 2010-10-06, width adapted per 2010-02-03 - -- we used to negate the width of marks because in tfm - -- that makes sense but we no longer do that so as a - -- consequence the sign of p.width was changed - local k = wx[p] - if k then - -- brill roman: A\char"0300 (but ugly anyway) - n.xoffset = p.xoffset - p.width + d[1] - k[2] -- was + p.width + -- + -- local k = wx[p] + -- if rlmode and rlmode >= 0 then + -- -- new per 2010-10-06, width adapted per 2010-02-03 + -- -- we used to negate the width of marks because in tfm + -- -- that makes sense but we no longer do that so as a + -- -- consequence the sign of p.width was changed + -- -- this is a real mess ... somewhat 'first font that gets + -- -- tested gets treated best' + -- if k then + -- -- brill roman: A\char"0300 (but ugly anyway) + -- n.xoffset = p.xoffset - p.width + d[1] - k[2] -- was + p.width + -- else + -- -- lucida: U\char"032F (default+mark) + -- n.xoffset = p.xoffset - p.width + d[1] -- 01-05-2011 + -- end + -- else + -- if k then -- k[4] ? + -- n.xoffset = p.xoffset - d[1] - k[2] + -- else + -- n.xoffset = p.xoffset - d[1] + -- end + -- end + -- + local k = wx[p] + if k then + local x = k[2] + local w = k[4] + if w then + if rlmode and rlmode >= 0 then + -- kern(x) glyph(p) kern(w-x) + n.xoffset = p.xoffset - p.width + d[1] - x + else + -- kern(w-x) glyph(p) kern(x) + n.xoffset = p.xoffset - d[1] - x + end else - -- lucida: U\char"032F (default+mark) - n.xoffset = p.xoffset - p.width + d[1] -- 01-05-2011 + if rlmode and rlmode >= 0 then + n.xoffset = p.xoffset - p.width + d[1] + else + -- needs checking: is x ok here? + n.xoffset = p.xoffset - d[1] - x -- x: todo ? + 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 end + -- -- if mk[p] then n.yoffset = p.yoffset + d[2] else @@ -387,17 +438,17 @@ function injections.handler(head,where,keep) local wx = w - x if rl < 0 then -- KE: don't use r2l here if wx ~= 0 then - insert_node_before(head,n,newkern(wx)) + insert_node_before(head,n,newkern(wx)) -- type 0/2 end if x ~= 0 then - insert_node_after (head,n,newkern(x)) + insert_node_after (head,n,newkern(x)) -- type 0/2 end else if x ~= 0 then - insert_node_before(head,n,newkern(x)) + insert_node_before(head,n,newkern(x)) -- type 0/2 end if wx ~= 0 then - insert_node_after(head,n,newkern(wx)) + insert_node_after (head,n,newkern(wx)) -- type 0/2 end end elseif x ~= 0 then @@ -405,7 +456,7 @@ function injections.handler(head,where,keep) -- uses kernclasses between glyphs so we're probably safe (KE has a -- problematic font where marks interfere with rl < 0 in the previous -- case) - insert_node_before(head,n,newkern(x)) + insert_node_before(head,n,newkern(x)) -- a real font kern, type 0 end end end @@ -414,9 +465,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)) -- type 0/2 else - insert_node_before(head,n,newkern(k)) + insert_node_before(head,n,newkern(k)) -- type 0/2 end end end @@ -424,6 +475,9 @@ function injections.handler(head,where,keep) if not keep then kerns = { } end + -- if trace_injections then + -- show_result(head) + -- end return head, true elseif not keep then kerns, cursives, marks = { }, { }, { } @@ -474,6 +528,9 @@ function injections.handler(head,where,keep) if not keep then kerns = { } end + -- if trace_injections then + -- show_result(head) + -- end return head, true else -- no tracing needed diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 0d4bd81af..63a039b77 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index bdbd77bb3..0464bf88c 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index da5e35a80..bb89e3902 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 : 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