From 5c9b859165af46407543b25589ce8852ee079620 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 22 Jun 2017 00:05:31 +0200 Subject: 2017-06-21 23:09:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/font-ctx.lua | 5 +- tex/context/base/mkiv/font-otj.lua | 47 +++++++++--- tex/context/base/mkiv/font-ots.lua | 19 ++++- tex/context/base/mkiv/font-oup.lua | 51 ++++++------- tex/context/base/mkiv/font-tra.mkiv | 13 +++- tex/context/base/mkiv/page-mix.mkiv | 8 +- tex/context/base/mkiv/status-files.pdf | Bin 25686 -> 25726 bytes tex/context/base/mkiv/status-lua.pdf | Bin 423550 -> 424956 bytes tex/context/interface/mkiv/i-context.pdf | Bin 847882 -> 847755 bytes tex/context/interface/mkiv/i-readme.pdf | Bin 60772 -> 60775 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 81 ++++++++++++--------- 15 files changed, 143 insertions(+), 89 deletions(-) (limited to 'tex') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index bcb4ce13f..5b47731d3 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.06.19 15:30} +\newcontextversion{2017.06.21 23:03} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 8c3ea1acc..a09531282 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2017.06.19 15:30} +\edef\contextversion{2017.06.21 23:03} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 395edf527..bb8da4b5d 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.06.19 15:30} +\newcontextversion{2017.06.21 23:03} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 229e59916..9c7b16b7d 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -41,7 +41,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.06.19 15:30} +\edef\contextversion{2017.06.21 23:03} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua index 39a579253..f2b3b001c 100644 --- a/tex/context/base/mkiv/font-ctx.lua +++ b/tex/context/base/mkiv/font-ctx.lua @@ -587,9 +587,10 @@ local function presetcontext(name,parent,features) -- will go to con and shared if s then for k, v in next, s do -- no, as then we cannot overload: e.g. math,mathextra --- if features[k] == nil then +-- reverted, so we only take from parent when not set + if features[k] == nil then features[k] = v --- end + end end else -- just ignore an undefined one .. i.e. we can refer to not yet defined diff --git a/tex/context/base/mkiv/font-otj.lua b/tex/context/base/mkiv/font-otj.lua index 2c79500e7..458e307ec 100644 --- a/tex/context/base/mkiv/font-otj.lua +++ b/tex/context/base/mkiv/font-otj.lua @@ -23,6 +23,9 @@ if not modules then modules = { } end modules ['font-otj'] = { -- Maybe: subtype fontkern when pure kerns. +-- An alternative is to have a list per base of all marks and then do a run over the node +-- list that resolves the accumulated l/r/x/y and then do an inject pass. + if not nodes.properties then return end local next, rawget, tonumber = next, rawget, tonumber @@ -375,7 +378,6 @@ function injections.setkern(current,factor,rlmode,x,injection) end function injections.setmark(start,base,factor,rlmode,ba,ma,tfmbase,mkmk,checkmark) -- ba=baseanchor, ma=markanchor - local dx, dy = factor*(ba[1]-ma[1]), factor*(ba[2]-ma[2]) nofregisteredmarks = nofregisteredmarks + 1 if rlmode >= 0 then @@ -488,6 +490,7 @@ local function showsub(n,what,where) end local function trace(head,where) + report_injections() report_injections("begin run %s: %s kerns, %s pairs, %s marks and %s cursives registered", where or "",nofregisteredkerns,nofregisteredpairs,nofregisteredmarks,nofregisteredcursives) local n = head @@ -537,6 +540,7 @@ local function show_result(head) end current = getnext(current) end + report_injections() end -- G +D-pre G @@ -695,6 +699,9 @@ local function inject_kerns_only(head,where) else nofregisteredkerns = 0 end + if trace_injections then + show_result(head) + end return tonode(head), true end @@ -928,15 +935,25 @@ local function inject_pairs_only(head,where) else nofregisteredkerns = 0 end + if trace_injections then + show_result(head) + end return tonode(head), true end +-- local function showoffset(n,flag) +-- local x, y = getoffsets(n) +-- if x ~= 0 or y ~= 0 then +-- setcolor(n,flag and "darkred" or "darkgreen") -- maybe better grays +-- else +-- resetcolor(n) +-- end +-- end + local function showoffset(n,flag) local x, y = getoffsets(n) if x ~= 0 or y ~= 0 then - setcolor(n,flag and "darkred" or "darkgreen") - else - resetcolor(n) + setcolor(n,"darkgray") end end @@ -1011,14 +1028,17 @@ local function inject_everything(head,where) end end else - -- if pn.markdir < 0 then - -- ox = px - pn.markx - -- -- report_injections("r2l case 3: %p",ox) - -- else - -- -- ox = px - getwidth(p) + pn.markx + if pn.markdir < 0 then + ox = px - pn.markx +-- pair stuff: husayni needs it ++ (pn.leftkern or 0) +-- + -- report_injections("r2l case 3: %p",ox) + else + -- ox = px - getwidth(p) + pn.markx ox = px - pn.markx -- report_injections("l2r case 3: %p",ox) - -- end + end if pn.checkmark then local wn = getwidth(n) -- in arial marks have widths if wn and wn ~= 0 then @@ -1039,12 +1059,14 @@ local function inject_everything(head,where) end end local oy = ny + py + pn.marky +-- pair stuff: husayni needs it +oy = oy + (pn.yoffset or 0) +-- setoffsets(n,ox,oy) if trace_marks then showoffset(n,true) end end - -- todo: marks in disc while current do local next = getnext(current) local char, id = ischar(current) @@ -1377,6 +1399,9 @@ local function inject_everything(head,where) nofregisteredmarks = 0 nofregisteredcursives = 0 end + if trace_injections then + show_result(head) + end return tonode(head), true end diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 726899571..99c98e175 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -140,6 +140,7 @@ local trace_steps = false registertracker("otf.steps", function(v local trace_skips = false registertracker("otf.skips", function(v) trace_skips = v end) local trace_directions = false registertracker("otf.directions", function(v) trace_directions = v end) local trace_plugins = false registertracker("otf.plugins", function(v) trace_plugins = v end) +local trace_chains = false registertracker("otf.chains", function(v) trace_chains = v end) local trace_kernruns = false registertracker("otf.kernruns", function(v) trace_kernruns = v end) local trace_discruns = false registertracker("otf.discruns", function(v) trace_discruns = v end) @@ -681,7 +682,7 @@ function handlers.gsub_alternate(head,start,dataset,sequence,alternative) setchar(start,choice) else if trace_alternatives then - logwarning("%s: no variant %a for %s, %s",pref(dataset,sequence),value,gref(getchar(start)),comment) + logwarning("%s: no variant %a for %s, %s",pref(dataset,sequence),value,gref(getchar(start)),comment) end end return head, start, true @@ -935,6 +936,9 @@ function handlers.gpos_mark2base(head,start,dataset,sequence,markanchors,rlmode) pref(dataset,sequence),anchor,bound,gref(markchar),gref(basechar),dx,dy) end return head, start, true + elseif trace_bugs then + -- onetimemessage(currentfont,basechar,"no base anchors",report_fonts) + logwarning("%s: mark %s is not anchored to %s",pref(dataset,sequence),gref(markchar),gref(basechar)) end elseif trace_bugs then logwarning("%s: nothing preceding, case %i",pref(dataset,sequence),1) @@ -1275,13 +1279,13 @@ function chainprocs.gsub_alternate(head,start,stop,dataset,sequence,currentlooku local choice, comment = get_alternative_glyph(current,alternatives,value) if choice then if trace_alternatives then - logprocess("%s: replacing %s by alternative %a to %s, %s",cref(dataset,sequence),gref(char),choice,gref(choice),comment) + logprocess("%s: replacing %s by alternative %a to %s, %s",cref(dataset,sequence),gref(currentchar),choice,gref(choice),comment) end resetinjection(start) setchar(start,choice) else if trace_alternatives then - logwarning("%s: no variant %a for %s, %s",cref(dataset,sequence),value,gref(char),comment) + logwarning("%s: no variant %a for %s, %s",cref(dataset,sequence),value,gref(currentchar),comment) end end end @@ -1853,6 +1857,7 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,ck,skipped) -- Even worse are these family emoji shapes as they can have multiple lookups -- per slot (probably only for gpos). local i = 1 + local laststart = start while start do if skipped then while start do @@ -1900,9 +1905,13 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,ck,skipped) if i > size or not start then break elseif start then + laststart = start start = getnext(start) end end + if not start then + start = laststart + end end else -- todo: needs checking for holes in the replacements @@ -2275,6 +2284,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) local skipped = false local startprev, startnext = getboth(start) + for k=1,#contexts do -- i've only seen ccmp having > 1 (e.g. dejavu) local match = true local current = start @@ -2298,6 +2308,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) local f = ck[4] local l = ck[5] -- current match + -- seq[f][ischar(current,currentfont)] is not nil size = l - f + 1 if size > 1 then -- before/current/after | before/current | current/after @@ -2703,7 +2714,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) if done then break -- out of contexts (new, needs checking) end - -- else + -- elseif trace_chains then -- chaintrac(head,start,dataset,sequence,rlmode,ck,skipped,match) end end diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua index bf9682a8f..54ca690d1 100644 --- a/tex/context/base/mkiv/font-oup.lua +++ b/tex/context/base/mkiv/font-oup.lua @@ -2024,48 +2024,37 @@ local function mergesteps_2(lookup,strict) -- pairs return nofsteps - 1 end +-- we could have a coverage[first][second] = { } already here (because eventually +-- we also have something like that after loading) local function mergesteps_3(lookup,strict) -- marks local steps = lookup.steps local nofsteps = lookup.nofsteps - local first = steps[1] report("merging %a steps of %a lookup %a",nofsteps,lookup.type,lookup.name) - local baseclasses = { } - local coverage = { } - local used = { } + -- check first + local coverage = { } for i=1,nofsteps do - local offset = i*10 - local step = steps[i] - for k, v in sortedhash(step.baseclasses) do - baseclasses[offset+k] = v - end - for k, v in next, step.coverage do - local tk = coverage[k] + for k, v in next, steps[i].coverage do + local tk = coverage[k] -- { class, { x, y } } if tk then - for k, v in next, v do - if not tk[k] then - tk[k] = v - local c = offset + v[1] - v[1] = c - if not used[c] then - used[c] = true - end - end - end + report("quitting merge due to multiple checks") + return nofsteps else coverage[k] = v - local c = offset + v[1] - v[1] = c - if not used[c] then - used[c] = true - end end end end - for k, v in next, baseclasses do - if not used[k] then - baseclasses[k] = nil - report("discarding not used baseclass %i",k) + -- merge indeed + local first = steps[1] + local baseclasses = { } -- let's assume sparse step.baseclasses + for i=1,nofsteps do + local offset = i*10 -- we assume max 10 classes per step + local step = steps[i] + for k, v in sortedhash(step.baseclasses) do + baseclasses[offset+k] = v + end + for k, v in next, step.coverage do + v[1] = offset + v[1] end end first.baseclasses = baseclasses @@ -2370,6 +2359,8 @@ function readers.expand(data) local cu = coverage[unic] if not cu then coverage[unic] = rulehash -- can now be done cleaner i think + else + -- we can have a problem end end end diff --git a/tex/context/base/mkiv/font-tra.mkiv b/tex/context/base/mkiv/font-tra.mkiv index 38b172ba6..a03d30799 100644 --- a/tex/context/base/mkiv/font-tra.mkiv +++ b/tex/context/base/mkiv/font-tra.mkiv @@ -124,7 +124,18 @@ \unexpanded\def\otfstepcharcommand#1#2#3% font char class {\otfstepspace - \doif{#3}{mark}{\underbar}{U+\hexnumber{#2}}:\ruledhbox{\ctxlua{nodes.tracers.fontchar(#1,#2)}}% + \doif{#3}{mark}{\underbar}{U+\hexnumber{#2}}:% + \setbox\scratchbox\hbox{\ctxlua{nodes.tracers.fontchar(#1,#2)}}% + \ifdim\wd\scratchbox=\zeropoint + \scratchwidth.125\onepoint + \scratchdistance\dimexpr(\emwidth/2-\scratchwidth)\relax + \kern\scratchdistance + \ruledhbox to \scratchwidth{\hss\box\scratchbox\hss}% + \kern-\scratchwidth + \hskip\scratchdistance + \else + \ruledhbox{\box\scratchbox}% + \fi \otfstepspace} \unexpanded\def\otfstepfontcommand#1#2#3% id font size diff --git a/tex/context/base/mkiv/page-mix.mkiv b/tex/context/base/mkiv/page-mix.mkiv index 7defece12..8b58a4c3d 100644 --- a/tex/context/base/mkiv/page-mix.mkiv +++ b/tex/context/base/mkiv/page-mix.mkiv @@ -710,7 +710,13 @@ \fi}% \fi \egroup - \egroup} + \hskip\d_page_mix_rightskip + \egroup + \wd\b_page_mix_collected\dimexpr + \d_page_mix_max_width + +\d_page_mix_rightskip + +\d_page_mix_leftskip + \relax } \unexpanded\def\page_mix_command_package_column {\page_mix_hbox to \d_page_mix_column_width \bgroup diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 61de37d39..cbf98e2ef 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index ffe955c1c..3b7a6a9b7 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index d2eecaba4..7cb008805 100644 Binary files a/tex/context/interface/mkiv/i-context.pdf and b/tex/context/interface/mkiv/i-context.pdf differ diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf index b3b355a38..9b2c03c97 100644 Binary files a/tex/context/interface/mkiv/i-readme.pdf and b/tex/context/interface/mkiv/i-readme.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index aaa60e5b8..43577b42c 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 06/19/17 15:30:18 +-- merge date : 06/21/17 23:03:59 do -- begin closure to overcome local limits and interference @@ -19131,44 +19131,29 @@ end local function mergesteps_3(lookup,strict) local steps=lookup.steps local nofsteps=lookup.nofsteps - local first=steps[1] report("merging %a steps of %a lookup %a",nofsteps,lookup.type,lookup.name) - local baseclasses={} local coverage={} - local used={} for i=1,nofsteps do - local offset=i*10 - local step=steps[i] - for k,v in sortedhash(step.baseclasses) do - baseclasses[offset+k]=v - end - for k,v in next,step.coverage do - local tk=coverage[k] + for k,v in next,steps[i].coverage do + local tk=coverage[k] if tk then - for k,v in next,v do - if not tk[k] then - tk[k]=v - local c=offset+v[1] - v[1]=c - if not used[c] then - used[c]=true - end - end - end + report("quitting merge due to multiple checks") + return nofsteps else coverage[k]=v - local c=offset+v[1] - v[1]=c - if not used[c] then - used[c]=true - end end end end - for k,v in next,baseclasses do - if not used[k] then - baseclasses[k]=nil - report("discarding not used baseclass %i",k) + local first=steps[1] + local baseclasses={} + for i=1,nofsteps do + local offset=i*10 + local step=steps[i] + for k,v in sortedhash(step.baseclasses) do + baseclasses[offset+k]=v + end + for k,v in next,step.coverage do + v[1]=offset+v[1] end end first.baseclasses=baseclasses @@ -19459,6 +19444,7 @@ function readers.expand(data) local cu=coverage[unic] if not cu then coverage[unic]=rulehash + else end end end @@ -20917,6 +20903,7 @@ local function showsub(n,what,where) report_injections("end subrun") end local function trace(head,where) + report_injections() report_injections("begin run %s: %s kerns, %s pairs, %s marks and %s cursives registered", where or "",nofregisteredkerns,nofregisteredpairs,nofregisteredmarks,nofregisteredcursives) local n=head @@ -20965,6 +20952,7 @@ local function show_result(head) end current=getnext(current) end + report_injections() end local function inject_kerns_only(head,where) head=tonut(head) @@ -21100,6 +21088,9 @@ local function inject_kerns_only(head,where) else nofregisteredkerns=0 end + if trace_injections then + show_result(head) + end return tonode(head),true end local function inject_pairs_only(head,where) @@ -21312,14 +21303,15 @@ local function inject_pairs_only(head,where) else nofregisteredkerns=0 end + if trace_injections then + show_result(head) + end return tonode(head),true end local function showoffset(n,flag) local x,y=getoffsets(n) if x~=0 or y~=0 then - setcolor(n,flag and "darkred" or "darkgreen") - else - resetcolor(n) + setcolor(n,"darkgray") end end local function inject_everything(head,where) @@ -21377,7 +21369,12 @@ local function inject_everything(head,where) end end else + if pn.markdir<0 then + ox=px-pn.markx ++(pn.leftkern or 0) + else ox=px-pn.markx + end if pn.checkmark then local wn=getwidth(n) if wn and wn~=0 then @@ -21391,6 +21388,7 @@ local function inject_everything(head,where) end end local oy=ny+py+pn.marky +oy=oy+(pn.yoffset or 0) setoffsets(n,ox,oy) if trace_marks then showoffset(n,true) @@ -21703,6 +21701,9 @@ local function inject_everything(head,where) nofregisteredmarks=0 nofregisteredcursives=0 end + if trace_injections then + show_result(head) + end return tonode(head),true end local triggers=false @@ -22272,6 +22273,7 @@ local trace_steps=false registertracker("otf.steps",function(v) trace_steps=v en local trace_skips=false registertracker("otf.skips",function(v) trace_skips=v end) local trace_directions=false registertracker("otf.directions",function(v) trace_directions=v end) local trace_plugins=false registertracker("otf.plugins",function(v) trace_plugins=v end) +local trace_chains=false registertracker("otf.chains",function(v) trace_chains=v end) local trace_kernruns=false registertracker("otf.kernruns",function(v) trace_kernruns=v end) local trace_discruns=false registertracker("otf.discruns",function(v) trace_discruns=v end) local trace_compruns=false registertracker("otf.compruns",function(v) trace_compruns=v end) @@ -22714,7 +22716,7 @@ function handlers.gsub_alternate(head,start,dataset,sequence,alternative) setchar(start,choice) else if trace_alternatives then - logwarning("%s: no variant %a for %s, %s",pref(dataset,sequence),value,gref(getchar(start)),comment) + logwarning("%s: no variant %a for %s, %s",pref(dataset,sequence),value,gref(getchar(start)),comment) end end return head,start,true @@ -22946,6 +22948,8 @@ function handlers.gpos_mark2base(head,start,dataset,sequence,markanchors,rlmode) pref(dataset,sequence),anchor,bound,gref(markchar),gref(basechar),dx,dy) end return head,start,true + elseif trace_bugs then + logwarning("%s: mark %s is not anchored to %s",pref(dataset,sequence),gref(markchar),gref(basechar)) end elseif trace_bugs then logwarning("%s: nothing preceding, case %i",pref(dataset,sequence),1) @@ -23211,13 +23215,13 @@ function chainprocs.gsub_alternate(head,start,stop,dataset,sequence,currentlooku local choice,comment=get_alternative_glyph(current,alternatives,value) if choice then if trace_alternatives then - logprocess("%s: replacing %s by alternative %a to %s, %s",cref(dataset,sequence),gref(char),choice,gref(choice),comment) + logprocess("%s: replacing %s by alternative %a to %s, %s",cref(dataset,sequence),gref(currentchar),choice,gref(choice),comment) end resetinjection(start) setchar(start,choice) else if trace_alternatives then - logwarning("%s: no variant %a for %s, %s",cref(dataset,sequence),value,gref(char),comment) + logwarning("%s: no variant %a for %s, %s",cref(dataset,sequence),value,gref(currentchar),comment) end end end @@ -23712,6 +23716,7 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,ck,skipped) end else local i=1 + local laststart=start while start do if skipped then while start do @@ -23756,9 +23761,13 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,ck,skipped) if i>size or not start then break elseif start then + laststart=start start=getnext(start) end end + if not start then + start=laststart + end end else local replacements=ck[7] -- cgit v1.2.3