diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-06-16 16:00:40 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-06-16 16:00:40 +0200 |
commit | 008292817580eba8a0f0cf83d8e2d08df8fc8c3f (patch) | |
tree | 7e47d035cc5d1f54d20f556476c439844f1956e0 /tex/generic | |
parent | 5e668aa418d6d082446e9369ae06625b50e49943 (diff) | |
download | context-008292817580eba8a0f0cf83d8e2d08df8fc8c3f.tar.gz |
2017-06-15 22:16:00
Diffstat (limited to 'tex/generic')
-rw-r--r-- | tex/generic/context/luatex/luatex-core.lua | 75 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 71 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-math.tex | 48 |
3 files changed, 126 insertions, 68 deletions
diff --git a/tex/generic/context/luatex/luatex-core.lua b/tex/generic/context/luatex/luatex-core.lua index 16df01707..870a25d48 100644 --- a/tex/generic/context/luatex/luatex-core.lua +++ b/tex/generic/context/luatex/luatex-core.lua @@ -5,18 +5,18 @@ -- copyright = 'LuaTeX Development Team', -- } -LUATEXCOREVERSION = 1.002 +LUATEXCOREVERSION = 1.003 -- This file overloads some Lua functions. The readline variants provide the same -- functionality as LuaTeX <= 1.04 and doing it this way permits us to keep the -- original io libraries clean. Performance is probably even a bit better now. local type, next, getmetatable, require = type, next, getmetatable, require -local find, gsub = string.find, string.gsub +local find, gsub, format = string.find, string.gsub, string.format local io_open = io.open local io_popen = io.popen -local io_line = io.lines +local io_lines = io.lines local fio_readline = fio.readline local fio_checkpermission = fio.checkpermission @@ -28,8 +28,8 @@ local saferoption = status.safer_option local shellescape = status.shell_escape -- 0 (disabled) 1 (anything) 2 (restricted) local kpseused = status.kpse_used -- 0 1 -io.saved_open = io_open -- can be protected -io.saved_popen = io_popen -- can be protected +local write_nl = texio.write_nl + io.saved_lines = io_lines -- always readonly mt.saved_lines = mt_lines -- always readonly @@ -71,12 +71,16 @@ local function luatex_io_popen(name,...) end end -local function luatex_io_lines(name) - local f = io_open(name,'r') - if f then - return function() - return fio_readline(f) +local function luatex_io_lines(name,how) + if name then + local f = io_open(name,how or 'r') + if f then + return function() + return fio_readline(f) + end end + else + return io_lines() end end @@ -101,29 +105,44 @@ end if saferoption == 1 then - os.execute = nil - os.spawn = nil - os.exec = nil - os.setenv = nil - os.tempdir = nil + local function installdummy(str,f) + local reported = false + return function(...) + if not reported then + write_nl(format("safer option set, function %q is %s", + str,f and "limited" or "disabled")) + reported = true + end + if f then + return f(...) + end + end + end + + local function installlimit(str,f) + local reported = false + end - io.popen = nil - io.open = nil + os.execute = installdummy("os.execute") + os.spawn = installdummy("os.spawn") + os.exec = installdummy("os.exec") + os.setenv = installdummy("os.setenv") + os.tempdir = installdummy("os.tempdir") - os.rename = nil - os.remove = nil + io.popen = installdummy("io.popen") + io.open = installdummy("io.open",luatex_io_open_readonly) - io.tmpfile = nil - io.output = nil + os.rename = installdummy("os.rename") + os.remove = installdummy("os.remove") - lfs.chdir = nil - lfs.lock = nil - lfs.touch = nil - lfs.rmdir = nil - lfs.mkdir = nil + io.tmpfile = installdummy("io.tmpfile") + io.output = installdummy("io.output") - io.saved_popen = nil - io.saved_open = luatex_io_open_readonly + lfs.chdir = installdummy("lfs.chdir") + lfs.lock = installdummy("lfs.lock") + lfs.touch = installdummy("lfs.touch") + lfs.rmdir = installdummy("lfs.rmdir") + lfs.mkdir = installdummy("lfs.mkdir") end diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 69d39090e..ecea472c4 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/06/17 13:22:11 +-- merge date : 06/15/17 22:10:43 do -- begin closure to overcome local limits and interference @@ -15417,12 +15417,14 @@ function gsubhandlers.reversechainedcontextsingle(f,fontdata,lookupid,lookupoffs before=readcoveragearray(f,tableoffset,before,true) after=readcoveragearray(f,tableoffset,after,true) return { - coverage={ - format="reversecoverage", - before=before, - current=current, - after=after, - replacements=replacements, + format="reversecoverage", + rules={ + { + before=before, + current=current, + after=after, + replacements=replacements, + } } },"reversechainedcontextsingle" else @@ -16046,6 +16048,7 @@ do local before=rule.before local current=rule.current local after=rule.after + local replacements=rule.replacements if before then for i=1,#before do before[i]=tohash(before[i]) @@ -16053,8 +16056,21 @@ do rule.before=reversed(before) end if current then - for i=1,#current do - current[i]=tohash(current[i]) + if replacements then + local first=current[1] + local hash={} + local repl={} + for i=1,#first do + local c=first[i] + hash[c]=true + repl[c]=replacements[i] + end + rule.current={ hash } + rule.replacements=repl + else + for i=1,#current do + current[i]=tohash(current[i]) + end end end if after then @@ -19456,7 +19472,7 @@ local trace_defining=false registertracker("fonts.defining",function(v) trace_de local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf -otf.version=3.029 +otf.version=3.030 otf.cache=containers.define("fonts","otl",otf.version,true) otf.svgcache=containers.define("fonts","svg",otf.version,true) otf.sbixcache=containers.define("fonts","sbix",otf.version,true) @@ -22316,12 +22332,6 @@ local getthreshold=injections.getthreshold local checkstep=(tracers and tracers.steppers.check) or function() end local registerstep=(tracers and tracers.steppers.register) or function() end local registermessage=(tracers and tracers.steppers.message) or function() end -local function checkdisccontent(d) - local pre,post,replace=getdisc(d) - if pre then for n in traverse_id(glue_code,pre) do print("pre",nodes.idstostring(pre)) break end end - if post then for n in traverse_id(glue_code,post) do print("pos",nodes.idstostring(post)) break end end - if replace then for n in traverse_id(glue_code,replace) do print("rep",nodes.idstostring(replace)) break end end -end local function logprocess(...) if trace_steps then registermessage(...) @@ -22400,7 +22410,6 @@ local function flattendisk(head,disc) elseif next then return next,next else - return end else if replace then @@ -23020,7 +23029,7 @@ function handlers.gpos_cursive(head,start,dataset,sequence,exitanchors,rlmode,st if entry then local dx,dy,bound=setcursive(start,nxt,factor,rlmode,exit,entry,characters[startchar],characters[nextchar]) if trace_cursive then - logprocess("%s: moving %s to %s cursive (%p,%p) using anchor %s and bound %s in %s mode",pref(dataset,sequence),gref(startchar),gref(nextchar),dx,dy,anchor,bound,mref(rlmode)) + logprocess("%s: moving %s to %s cursive (%p,%p) using bound %s in %s mode",pref(dataset,sequence),gref(startchar),gref(nextchar),dx,dy,bound,mref(rlmode)) end return head,start,true end @@ -23573,7 +23582,7 @@ function chainprocs.gpos_cursive(head,start,stop,dataset,sequence,currentlookup, if entry then local dx,dy,bound=setcursive(start,nxt,factor,rlmode,exit,entry,characters[startchar],characters[nextchar]) if trace_cursive then - logprocess("%s: moving %s to %s cursive (%p,%p) using anchor %s and bound %s in %s mode",pref(dataset,sequence),gref(startchar),gref(nextchar),dx,dy,anchor,bound,mref(rlmode)) + logprocess("%s: moving %s to %s cursive (%p,%p) using bound %s in %s mode",pref(dataset,sequence),gref(startchar),gref(nextchar),dx,dy,bound,mref(rlmode)) end return head,start,true end @@ -23656,11 +23665,15 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,ck,skipped) while start do if skipped then while start do - local char=getchar(start) - local class=classes[char] - if class then - if class==skipmark or class==skipligature or class==skipbase or (markclass and class=="mark" and not markclass[char]) then - start=getnext(start) + local char,id=ischar(start,currentfont) + if char then + local class=classes[char] + if class then + if class==skipmark or class==skipligature or class==skipbase or (markclass and class=="mark" and not markclass[char]) then + start=getnext(start) + else + break + end else break end @@ -24015,15 +24028,15 @@ local function chaindisk(head,start,dataset,sequence,rlmode,ck,skipped) end return head,start,done end -local function chaintrac(head,start,dataset,sequence,rlmode,ck,skipped) +local function chaintrac(head,start,dataset,sequence,rlmode,ck,skipped,match) local rule=ck[1] local lookuptype=ck[8] or ck[2] local nofseq=#ck[3] local first=ck[4] local last=ck[5] local char=getchar(start) - logwarning("%s: rule %s matches at char %s for (%s,%s,%s) chars, lookuptype %a", - cref(dataset,sequence),rule,gref(char),first-1,last-first+1,nofseq-last,lookuptype) + logwarning("%s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a", + cref(dataset,sequence),rule,match and "matches" or "nomatch",gref(char),first-1,last-first+1,nofseq-last,lookuptype) end local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) local sweepnode=sweepnode @@ -24434,7 +24447,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) end if match then if trace_contexts then - chaintrac(head,start,dataset,sequence,rlmode,ck,skipped) + chaintrac(head,start,dataset,sequence,rlmode,ck,skipped,true) end if diskseen or sweepnode then head,start,done=chaindisk(head,start,dataset,sequence,rlmode,ck,skipped) @@ -25135,7 +25148,7 @@ otf.helpers=otf.helpers or {} otf.helpers.txtdirstate=txtdirstate otf.helpers.pardirstate=pardirstate do - local fastdisc=context and LUATEXVERSION>=1.005 + local fastdisc=true directives.register("otf.fastdisc",function(v) fastdisc=v end) function otf.featuresprocessor(head,font,attr,direction,n) local sequences=sequencelists[font] diff --git a/tex/generic/context/luatex/luatex-math.tex b/tex/generic/context/luatex/luatex-math.tex index 6669b5ffc..0ed8992d4 100644 --- a/tex/generic/context/luatex/luatex-math.tex +++ b/tex/generic/context/luatex/luatex-math.tex @@ -2298,17 +2298,43 @@ \def\*{\discretionary{\thinspace\the\textfont0\char"00D7}{}{}} -\def\t#1% bruno's variant: - {\iffontchar\font"0361\relax - #1^^^^0361\relax - \else\iffontchar\font"2040\relax - \accent"2040 #1\relax - \else - \begingroup - \edef\next{\the\font}% - \the\textfont0\accent"2040\next#1\relax - \endgroup - \fi\fi} +\def\t#1{% + %\quitvmode + \begingroup + \setbox0\hbox{#1}% + \setbox2\hbox\bgroup + \iffontchar\font"0361\relax + \char"0361\relax + \else + \iffontchar\font"2040\relax\else + \the\textfont0 + \fi + \char"2040 + \fi + \egroup + \dimen0\wd\ifdim\wd0>\wd2 0\else2\fi + \dimen2\dimexpr-\ht2+\ht0+.45ex\relax + \hbox to \dimen0\bgroup + \hbox to \dimen0{\hss\box0\hss}% + \hskip-\dimen0 + \hbox to \dimen0{\hss\raise\dimen2\box2\hss}% + \egroup + \endgroup} + +% Bruno's variant: +% +% \def\talign#1% +% {\leavevmode\vbox{% +% \baselineskip 0pt +% \lineskip -1ex +% \lineskiplimit 0pt +% \ialign{##\crcr#1\crcr}}} +% +% \def\t#1% +% {{\setbox0\hbox{% +% \iffontchar\font"0361\char"0361\else +% \iffontchar\font"2040\else\the\textfont0\fi\char"2040\fi}% +% \talign{\hidewidth\unhbox0\hidewidth\crcr#1}}} % for Bruno, when he tests this file with xetex: |