diff options
46 files changed, 234 insertions, 170 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index ae9355601..354fe6392 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -3554,8 +3554,11 @@ function unicode.utfcodes(str) end +local lpegmatch = lpeg.match +local utftype = lpeg.patterns.utftype + function unicode.filetype(data) - return data and lpeg.match(lpeg.patterns.utftype,data) or "unknown" + return data and lpegmatch(utftype,data) or "unknown" end @@ -5025,7 +5028,6 @@ function logs.new(category) end - -- nop logging (maybe use __call instead) local noplog = { } logs.nop = noplog setmetatable(logs, { __index = noplog }) @@ -5066,6 +5068,9 @@ function texlog.line(fmt,...) -- new end end + + + local real, user, sub function texlog.start_page_number() @@ -12200,8 +12205,8 @@ end function openers.helpers.textopener(tag,filename,f) return { - reader = function() return f:read () end, - close = function() return f:close() end, + reader = function() return f:read () end, + close = function() logs.show_close(filename) return f:close() end, } end @@ -12210,7 +12215,6 @@ function openers.file(specification,filetype) if filename and filename ~= "" then local f = io.open(filename,"r") if f then - logs.show_open(filename) -- todo if trace_locating then report_resolvers("file opener, '%s' opened",filename) end @@ -12634,7 +12638,6 @@ function resolvers.openers.zip(specification) end local dfile = zfile:open(queryname) if dfile then - logs.show_open(original) if trace_locating then report_resolvers("zip opener, file '%s' found",queryname) end diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index ae9355601..354fe6392 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -3554,8 +3554,11 @@ function unicode.utfcodes(str) end +local lpegmatch = lpeg.match +local utftype = lpeg.patterns.utftype + function unicode.filetype(data) - return data and lpeg.match(lpeg.patterns.utftype,data) or "unknown" + return data and lpegmatch(utftype,data) or "unknown" end @@ -5025,7 +5028,6 @@ function logs.new(category) end - -- nop logging (maybe use __call instead) local noplog = { } logs.nop = noplog setmetatable(logs, { __index = noplog }) @@ -5066,6 +5068,9 @@ function texlog.line(fmt,...) -- new end end + + + local real, user, sub function texlog.start_page_number() @@ -12200,8 +12205,8 @@ end function openers.helpers.textopener(tag,filename,f) return { - reader = function() return f:read () end, - close = function() return f:close() end, + reader = function() return f:read () end, + close = function() logs.show_close(filename) return f:close() end, } end @@ -12210,7 +12215,6 @@ function openers.file(specification,filetype) if filename and filename ~= "" then local f = io.open(filename,"r") if f then - logs.show_open(filename) -- todo if trace_locating then report_resolvers("file opener, '%s' opened",filename) end @@ -12634,7 +12638,6 @@ function resolvers.openers.zip(specification) end local dfile = zfile:open(queryname) if dfile then - logs.show_open(original) if trace_locating then report_resolvers("zip opener, file '%s' found",queryname) end diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index ae9355601..354fe6392 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -3554,8 +3554,11 @@ function unicode.utfcodes(str) end +local lpegmatch = lpeg.match +local utftype = lpeg.patterns.utftype + function unicode.filetype(data) - return data and lpeg.match(lpeg.patterns.utftype,data) or "unknown" + return data and lpegmatch(utftype,data) or "unknown" end @@ -5025,7 +5028,6 @@ function logs.new(category) end - -- nop logging (maybe use __call instead) local noplog = { } logs.nop = noplog setmetatable(logs, { __index = noplog }) @@ -5066,6 +5068,9 @@ function texlog.line(fmt,...) -- new end end + + + local real, user, sub function texlog.start_page_number() @@ -12200,8 +12205,8 @@ end function openers.helpers.textopener(tag,filename,f) return { - reader = function() return f:read () end, - close = function() return f:close() end, + reader = function() return f:read () end, + close = function() logs.show_close(filename) return f:close() end, } end @@ -12210,7 +12215,6 @@ function openers.file(specification,filetype) if filename and filename ~= "" then local f = io.open(filename,"r") if f then - logs.show_open(filename) -- todo if trace_locating then report_resolvers("file opener, '%s' opened",filename) end @@ -12634,7 +12638,6 @@ function resolvers.openers.zip(specification) end local dfile = zfile:open(queryname) if dfile then - logs.show_open(original) if trace_locating then report_resolvers("zip opener, file '%s' found",queryname) end diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 0c2bf2a49..0db8439d2 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2010.12.04 19:31} +\newcontextversion{2010.12.06 15:24} %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/context.tex b/tex/context/base/context.tex index c23e2893a..302d2f5c8 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2010.12.04 19:31} +\edef\contextversion{2010.12.06 15:24} %D For those who want to use this: diff --git a/tex/context/base/data-fil.lua b/tex/context/base/data-fil.lua index 5fad79afd..05087c9bb 100644 --- a/tex/context/base/data-fil.lua +++ b/tex/context/base/data-fil.lua @@ -63,8 +63,8 @@ end function openers.helpers.textopener(tag,filename,f) return { - reader = function() return f:read () end, - close = function() return f:close() end, + reader = function() return f:read () end, + close = function() logs.show_close(filename) return f:close() end, } end @@ -73,7 +73,6 @@ function openers.file(specification,filetype) if filename and filename ~= "" then local f = io.open(filename,"r") if f then - logs.show_open(filename) -- todo if trace_locating then report_resolvers("file opener, '%s' opened",filename) end diff --git a/tex/context/base/data-tex.lua b/tex/context/base/data-tex.lua index 84ec549ae..f8c847b22 100644 --- a/tex/context/base/data-tex.lua +++ b/tex/context/base/data-tex.lua @@ -14,6 +14,8 @@ local resolvers = resolvers local sequencers = utilities.sequencers local methodhandler = resolvers.methodhandler +local splitlines = string.splitlines +local utffiletype = unicode.filetype local fileprocessor = nil local lineprocessor = nil @@ -44,23 +46,21 @@ appendgroup(textlineactions,"before") -- user appendgroup(textlineactions,"system") -- private appendgroup(textlineactions,"after" ) -- user -function helpers.textopener(tag,filename,file_handle) +function helpers.textopener(tag,filename,filehandle) local lines - if not file_handle then + local t_filehandle = type(filehandle) + if not filehandle then lines = io.loaddata(filename) - elseif type(file_handle) == "string" then - lines = file_handle - elseif type(file_handle) == "table" then - lines = file_handle - elseif file_handle then - lines = file_handle:read("*a") - file_handle:close() + elseif t_filehandle == "string" then + lines = filehandle + elseif t_filehandle == "table" then + lines = filehandle else - report_resolvers("%s opener, weird error: filename=%s, handle=%s",tag,tostring(filename),tostring(file_handle)) - lines = "" + lines = filehandle:read("*a") + filehandle:close() end if type(lines) == "string" then - local kind = unicode.filetype(lines) + local kind = utffiletype(lines) if trace_locating then report_resolvers("%s opener, '%s' opened using method '%s'",tag,filename,kind) end @@ -77,11 +77,12 @@ function helpers.textopener(tag,filename,file_handle) fileprocessor = sequencers.compile(textfileactions) end lines = fileprocessor(lines,filename) or lines - lines = string.splitlines(lines) + lines = splitlines(lines) end elseif trace_locating then report_resolvers("%s opener, '%s' opened",tag,filename) end + logs.show_open(filename) return { filename = filename, noflines = #lines, diff --git a/tex/context/base/data-zip.lua b/tex/context/base/data-zip.lua index 9ec440723..25d31fb6b 100644 --- a/tex/context/base/data-zip.lua +++ b/tex/context/base/data-zip.lua @@ -135,7 +135,6 @@ function resolvers.openers.zip(specification) end local dfile = zfile:open(queryname) if dfile then - logs.show_open(original) if trace_locating then report_resolvers("zip opener, file '%s' found",queryname) end diff --git a/tex/context/base/font-fbk.lua b/tex/context/base/font-fbk.lua index b1556ecbf..fca9e5081 100644 --- a/tex/context/base/font-fbk.lua +++ b/tex/context/base/font-fbk.lua @@ -105,15 +105,15 @@ function vf.aux.compose_characters(g) -- todo: scaling depends on call location acc = fallbacks[acc] charsacc = acc and chars[acc] end + local chr_t = cache[chr] + if not chr_t then + chr_t = {"slot", 1, chr} + cache[chr] = chr_t + end if charsacc then if trace_combining_all then report_combining("%s (0x%05X) = %s (0x%05X) + %s (0x%05X)",utfchar(i),i,utfchar(chr),chr,utfchar(acc),acc) end - local chr_t = cache[chr] - if not chr_t then - chr_t = {"slot", 1, chr} - cache[chr] = chr_t - end local acc_t = cache[acc] if not acc_t then acc_t = {"slot", 1, acc} @@ -178,9 +178,14 @@ function vf.aux.compose_characters(g) -- todo: scaling depends on call location end end done = true + else + t.commands = { chr_t } -- else index mess + done = true end elseif trace_combining_all then - report_combining("%s (0x%05X) = %s (0x%05X)",utfchar(i),i,utfchar(chr),chr) + report_combining("%s (0x%05X) = %s (0x%05X) (simplified)",utfchar(i),i,utfchar(chr),chr) + t.commands = { chr_t } -- else index mess + done = true end chars[i] = t local d = { } @@ -196,6 +201,7 @@ function vf.aux.compose_characters(g) -- todo: scaling depends on call location end end if done then + g.type = "virtual" -- for the moment, to be sure g.virtualized = true end end diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua index 1ccb69303..1877f08c3 100644 --- a/tex/context/base/font-tfm.lua +++ b/tex/context/base/font-tfm.lua @@ -364,7 +364,10 @@ function tfm.scale(tfmtable, scaledpoints, relativeid) local sharedkerns = { } for k,v in next, characters do local chr, description, index - if ischanged then + if isvirtual then + description = descriptions[k] or v + -- no index + elseif ischanged then -- basemode hack local c = changed[k] if c then diff --git a/tex/context/base/l-unicode.lua b/tex/context/base/l-unicode.lua index 445909d88..014763b0b 100644 --- a/tex/context/base/l-unicode.lua +++ b/tex/context/base/l-unicode.lua @@ -351,6 +351,9 @@ end --~ print(unicode.utfcodes(str)) +local lpegmatch = lpeg.match +local utftype = lpeg.patterns.utftype + function unicode.filetype(data) - return data and lpeg.match(lpeg.patterns.utftype,data) or "unknown" + return data and lpegmatch(utftype,data) or "unknown" end diff --git a/tex/context/base/luat-fio.lua b/tex/context/base/luat-fio.lua index 5f65ead48..d659e05e0 100644 --- a/tex/context/base/luat-fio.lua +++ b/tex/context/base/luat-fio.lua @@ -29,13 +29,14 @@ if not resolvers.instance then -- trackers.disable("resolvers.*") local findbinfile, loadbinfile = resolvers.findbinfile, resolvers.loadbinfile + local findtexfile, opentexfile = resolvers.findtexfile, resolvers.opentexfile if callback then local register = callbacks.register - register('find_read_file' , function(id,name) return resolvers.findtexfile(name) end, true) - register('open_read_file' , function( name) return resolvers.opentexfile(name) end, true) + register('find_read_file' , function(id,name) return findtexfile(name) end, true) + register('open_read_file' , function( name) return opentexfile(name) end, true) register('find_data_file' , function(name) return findbinfile(name,"tex") end, true) register('find_enc_file' , function(name) return findbinfile(name,"enc") end, true) diff --git a/tex/context/base/math-ali.mkiv b/tex/context/base/math-ali.mkiv index a97326413..d7979a1c3 100644 --- a/tex/context/base/math-ali.mkiv +++ b/tex/context/base/math-ali.mkiv @@ -53,7 +53,7 @@ \def\textineqalign#1{$\forgetalign#1$} \def\eqalign#1% why no halign here, probably because of displaywidth - {\null\,\vcenter + {\emptyhbox\,\vcenter {\openup.25\bodyfontsize% was: \openup\jot \mathsurround\zeropoint \ialign{\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##{}}$\hfil\crcr#1\crcr}% @@ -696,7 +696,7 @@ {\begingroup \edef\currentmathmatrix{#1}% \doifassignmentelse{#2}{\setupmathmatrix[#1][#2]}\donothing - \null + \emptyhbox \executeifdefined{\??mx:\mathmatrixparameter\c!location}{\getvalue{\??mx:\v!lohi}}% \mathmatrixleft \mathmatrixbox\bgroup @@ -890,7 +890,7 @@ % \unexpanded\def\startsubstack % {\begingroup -% \null +% \emptyhbox % \vcenter\bgroup % \pushmacro\domatrixNC % \let\stopmathmode\relax diff --git a/tex/context/base/math-def.mkiv b/tex/context/base/math-def.mkiv index 4d8883c0f..58fd7d07e 100644 --- a/tex/context/base/math-def.mkiv +++ b/tex/context/base/math-def.mkiv @@ -15,6 +15,8 @@ \unprotect +% this will be done at the lua end + \startluacode mathematics.define() mathematics.xml.registerentities() @@ -234,7 +236,7 @@ \def\rootwithoutdegree {\rootradical {}} \def\PLAINmatrix#1% - {\null\,\vcenter{\normalbaselines\mathsurround\zeropoint + {\emptyhbox\,\vcenter{\normalbaselines\mathsurround\zeropoint \ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr \mathstrut\crcr\noalign{\kern-\baselineskip} #1\crcr\mathstrut\crcr\noalign{\kern-\baselineskip}}}\,} diff --git a/tex/context/base/math-ini.lua b/tex/context/base/math-ini.lua index 0c500f91f..27f66d127 100644 --- a/tex/context/base/math-ini.lua +++ b/tex/context/base/math-ini.lua @@ -27,7 +27,7 @@ mathematics.extrabase = 0xFE000 -- here we push some virtuals mathematics.privatebase = 0xFF000 -- here we push the ex local families = allocate { - tf = 0, it = 1, sl = 2, bf = 3, bi = 4, bs = 5, -- virtual fonts or unicode otf + tf = 0, it = 1, sl = 2, bf = 3, bi = 4, bs = 5, -- no longer relevant } local classes = allocate { @@ -220,7 +220,7 @@ end -- there will be a combined \(math)chardef -function mathematics.define(slots,family) +function mathematics.define(family) family = family or 0 family = families[family] or family local data = characters.data diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index ab8f72df8..af3334d16 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -426,7 +426,7 @@ %D Needed for unicode: -\def\nulloperator{\mathortext{\mathop{\null}}{\null}} +\def\nulloperator{\mathortext{\mathop{\emptyhbox}}{\emptyhbox}} %D To be dealt with ... diff --git a/tex/context/base/math-map.lua b/tex/context/base/math-map.lua index 17841bde6..47c6c88e2 100644 --- a/tex/context/base/math-map.lua +++ b/tex/context/base/math-map.lua @@ -37,7 +37,7 @@ local mathematics = mathematics -- following approach permits easier remapping of a-a, A-Z and 0-9 to -- fallbacks; symbols is currently mostly greek -mathematics.alphabets = allocate { +local alphabets = allocate { regular = { tf = { digits = 0x00030, @@ -272,7 +272,8 @@ mathematics.alphabets = allocate { }, } -local alphabets = mathematics.alphabets +mathematics.alphabets = alphabets + local mathremap = { } for alphabet, styles in next, alphabets do @@ -443,3 +444,20 @@ function mathematics.remapalphabets(char,mathalphabet,mathgreek) end return nil end + +local function checkedcopy(characters,child,parent) + for k, v in next, child do + if not characters[v] then + characters[v] = characters[parent[k]] + end + end +end + +function mathematics.addfallbacks(main) + local characters = main.characters + local regular = alphabets.regular + checkedcopy(characters,regular.bf.ucgreek,regular.tf.ucgreek) + checkedcopy(characters,regular.bf.lcgreek,regular.tf.lcgreek) + checkedcopy(characters,regular.bi.ucgreek,regular.it.ucgreek) + checkedcopy(characters,regular.bi.lcgreek,regular.it.lcgreek) +end diff --git a/tex/context/base/math-pln.mkiv b/tex/context/base/math-pln.mkiv index ab584f10a..6cabb185b 100644 --- a/tex/context/base/math-pln.mkiv +++ b/tex/context/base/math-pln.mkiv @@ -173,7 +173,7 @@ \right.} \def\matrix#1% - {\null + {\emptyhbox \,% \vcenter {\normalbaselines\mathsurround\zeropoint @@ -206,7 +206,7 @@ {$\kern\wd\plusone\kern-\mathparentwd\left(\kern-\wd\plusone \global\setbox\plusone\vbox{\box\plusone\kern2\points}% \vcenter{\kern-\ht\plusone\unvbox\zerocount\kern-\baselineskip}\,\right)$}% - \null + \emptyhbox \;% \vbox{\kern\ht\plusone\box\plustwo}% \endgroup} @@ -230,7 +230,7 @@ \def\displayopenupvalue{.25\bodyfontsize} \def\eqalign#1% - {\null + {\emptyhbox \,% \vcenter {\openup\displayopenupvalue % was \openup\jot diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua index b8c63e76b..324ba2b05 100644 --- a/tex/context/base/math-vfu.lua +++ b/tex/context/base/math-vfu.lua @@ -676,6 +676,7 @@ function vfmath.define(specification,set,variables) if mp then -- weak catch vfmath.alas(main,#lst,size,variables) end + mathematics.addfallbacks(main) if trace_virtual or trace_timings then report_virtual("loading and virtualizing font %s at size %s took %0.3f seconds",name,size,os.clock()-start) end diff --git a/tex/context/base/meta-pdh.mkiv b/tex/context/base/meta-pdh.mkiv index e953d6c25..0857182e2 100644 --- a/tex/context/base/meta-pdh.mkiv +++ b/tex/context/base/meta-pdh.mkiv @@ -597,7 +597,7 @@ % \def\handleMPhyperlink#1#2#3#4#5#6% % {\letgvalueempty{\@@MPSK#6}% % \setbox\scratchbox\hbox -% {\setbox\scratchbox\null +% {\setbox\scratchbox\emptyhbox % \wd\scratchbox\dimexpr-#1\onebasepoint+#3\onebasepoint\relax % \ht\scratchbox\dimexpr-#2\onebasepoint+#4\onebasepoint\relax % \gotobox{\box\scratchbox}[#5]}% diff --git a/tex/context/base/pack-box.mkiv b/tex/context/base/pack-box.mkiv index c0d3741ff..fa771b485 100644 --- a/tex/context/base/pack-box.mkiv +++ b/tex/context/base/pack-box.mkiv @@ -82,7 +82,7 @@ {\dowithnextbox {\bgroup \checktextbackgrounds - \setbox\scratchbox\null + \setbox\scratchbox\emptyhbox \wd\scratchbox\nextboxwd \ht\scratchbox\nextboxht \dp\scratchbox\nextboxdp @@ -904,7 +904,7 @@ [\c!width=\zeropoint,% \c!height=\zeropoint,% \c!depth=\zeropoint,#1]% - \setbox\scratchbox\null + \setbox\scratchbox\emptyhbox \wd\scratchbox\@@olwidth \ht\scratchbox\@@olheight \dp\scratchbox\@@oldepth diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index cc3a34b11..1338148ac 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -469,7 +469,7 @@ \fi\fi} \def\dostrokedlinedbox - {\setbox\scratchbox\null + {\setbox\scratchbox\emptyhbox \wd\scratchbox\frameddimenwd \ht\scratchbox\frameddimenht \dp\scratchbox\frameddimendp @@ -1217,7 +1217,7 @@ \egroup} \def\dosetfakedframebox - {\setbox\scratchbox\null + {\setbox\scratchbox\emptyhbox \wd\scratchbox\wd\framebox \ht\scratchbox\ht\framebox \dp\scratchbox\dp\framebox diff --git a/tex/context/base/page-flt.mkiv b/tex/context/base/page-flt.mkiv index 21662f30e..450e7ae0e 100644 --- a/tex/context/base/page-flt.mkiv +++ b/tex/context/base/page-flt.mkiv @@ -221,7 +221,7 @@ % \else\ifnum\dofloatsnofstacked\s!page>\zerocount % \doflushsomepagefloat\s!page % \else\ifnum\dofloatsnofstacked\s!leftpage>\zerocount -% \null\vfill\eject +% \emptyhbox\vfill\eject % %\doflushsomepagefloat\s!leftpage % \fi\fi\fi} % {\ifnum\dofloatsnofstacked\s!leftpage>\zerocount @@ -229,7 +229,7 @@ % \else\ifnum\dofloatsnofstacked\s!page>\zerocount % \doflushsomepagefloat\s!page % \else\ifnum\dofloatsnofstacked\s!rightpage>\zerocount -% \null\vfill\eject +% \emptyhbox\vfill\eject % %\doflushsomepagefloat\s!rightpage % \fi\fi\fi}} @@ -238,7 +238,7 @@ \ifx\checkedpagefloat\empty % nothing \else\ifx\checkedpagefloat\v!empty - \null\vfill\eject + \emptyhbox\vfill\eject \else \doflushsomepagefloat\checkedpagefloat \fi\fi} diff --git a/tex/context/base/page-imp.mkiv b/tex/context/base/page-imp.mkiv index ec13e240c..503768336 100644 --- a/tex/context/base/page-imp.mkiv +++ b/tex/context/base/page-imp.mkiv @@ -921,10 +921,10 @@ \dontcomplain \getfiguredimensions[#1]% \getparameters[\??ip][\c!n=\noffigurepages,\c!width=\!!zeropoint,#3]% - \doifinset0{#2}{\null\page}% + \doifinset0{#2}{\emptyhbox\page}% \dorecurse\@@ipn {\dofilterpage{#1}\recurselevel - \doifinset\recurselevel{#2}{\null\page}}% + \doifinset\recurselevel{#2}{\emptyhbox\page}}% \egroup} \def\filterpages diff --git a/tex/context/base/page-ini.mkiv b/tex/context/base/page-ini.mkiv index 1327e796b..aa646cd8d 100644 --- a/tex/context/base/page-ini.mkiv +++ b/tex/context/base/page-ini.mkiv @@ -1433,7 +1433,7 @@ \def\registeredtextarea#1#2#3% #1=lower-dp #2=correct-ht #3=box {\hbox\bgroup \ifregistertextareas \ifx\registerMPtextarea\undefined \else - \setbox\registertextbox\null + \setbox\registertextbox\emptyhbox \wd\registertextbox\wd#3% \ht\registertextbox\ht#3% \dp\registertextbox\dp#3% diff --git a/tex/context/base/page-mak.mkiv b/tex/context/base/page-mak.mkiv index 52834b2aa..4544f04e0 100644 --- a/tex/context/base/page-mak.mkiv +++ b/tex/context/base/page-mak.mkiv @@ -179,11 +179,11 @@ \ifdoublesided \ifodd\realpageno\else \processaction [\makeupparameter\c!doublesided] - [ \v!yes=>\null + [ \v!yes=>\emptyhbox \page, \v!empty=>{\setupmakeuplayout \page[\v!blank]% - \null + \emptyhbox \page}]% \fi \fi \poppagestate} % new diff --git a/tex/context/base/page-mis.mkiv b/tex/context/base/page-mis.mkiv index f7c3d529d..02083d181 100644 --- a/tex/context/base/page-mis.mkiv +++ b/tex/context/base/page-mis.mkiv @@ -105,7 +105,7 @@ \v!middle=>\doifbothsidesoverruled\rightmarginbox\leftmarginbox\rightmarginbox, \v!left=>\leftmarginbox, \v!right=>\rightmarginbox, - \s!unknown=>\setbox\preparedmarginbox\hbox{}]} + \s!unknown=>\setbox\preparedmarginbox\emptyhbox]} \def\dostartmarginblock % 2 maal \vbox ivm \unvbox elders {\global\setbox\marginbox\vtop\bgroup\vbox\bgroup diff --git a/tex/context/base/page-one.mkiv b/tex/context/base/page-one.mkiv index e150d453a..babaf4f5d 100644 --- a/tex/context/base/page-one.mkiv +++ b/tex/context/base/page-one.mkiv @@ -76,7 +76,7 @@ \endgraf \begingroup \scratchdimen\dimexpr\MPy{pbd:\realfolio:b}-\MPy{pbd:\realfolio:e}\relax - \setbox\scratchbox\null + \setbox\scratchbox\emptyhbox \wd\scratchbox\makeupwidth \ht\scratchbox\scratchdimen \vsmash{\registeredtextarea00\scratchbox}% diff --git a/tex/context/base/page-set.mkiv b/tex/context/base/page-set.mkiv index 465918449..fae15a1cc 100644 --- a/tex/context/base/page-set.mkiv +++ b/tex/context/base/page-set.mkiv @@ -200,7 +200,7 @@ \box\csname\@otr@:\!!stringb:\recurselevel\endcsname %\global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box\csname\@otr@:\!!stringb:\recurselevel\endcsname \else - \emptybox + \emptyhbox %\global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\emptybox \expandafter\newbox\csname\@otr@:\!!stringb:\recurselevel\endcsname \fi @@ -567,7 +567,7 @@ \doOTRSETsetgridcells {\copy\placeholderboxe} \plusone\plusone\nofcolumns\scratchcounter - \null + \emptybox \fi} \def\OTRSETsetvsize % snap per sectie (gap here?) diff --git a/tex/context/base/page-spr.mkiv b/tex/context/base/page-spr.mkiv index ff0561a5d..fd01e584c 100644 --- a/tex/context/base/page-spr.mkiv +++ b/tex/context/base/page-spr.mkiv @@ -43,7 +43,7 @@ \else % prevent duplicate writes in normal run \ifarrangingpages \else \ifcase\showspreadmode - \global\setbox\spreadbox\null + \global\setbox\spreadbox\emptyhbox \wd\spreadbox\makeupwidth \ht\spreadbox\textheight \fi \fi @@ -56,7 +56,7 @@ \def\doflushspread {\ifinspread \ifvoid\spreadbox\else % this page will be discarded later - \null \page + \emptyhbox \page \fi \fi } \unexpanded\def\startspread diff --git a/tex/context/base/scrn-but.mkiv b/tex/context/base/scrn-but.mkiv index 9a72a756b..569909b50 100644 --- a/tex/context/base/scrn-but.mkiv +++ b/tex/context/base/scrn-but.mkiv @@ -100,7 +100,7 @@ \def\overlayfakebox {\hbox - {\setbox\scratchbox\null + {\setbox\scratchbox\emptyhbox \wd\scratchbox\overlaywidth \ht\scratchbox\overlayheight \box\scratchbox}} diff --git a/tex/context/base/spac-grd.mkiv b/tex/context/base/spac-grd.mkiv index 0cd2b15e9..243e20817 100644 --- a/tex/context/base/spac-grd.mkiv +++ b/tex/context/base/spac-grd.mkiv @@ -126,12 +126,12 @@ {\def\dobaselinecorrection % visualization is not watertight! {\bgroup \ifdim\prevdepth>\zeropoint\kern-\prevdepth\fi - \setbox0\null - \wd0\hsize - \dp0\strutdp + \setbox\scratchbox\emptyhbox + \wd\scratchbox\hsize + \dp\scratchbox\strutdp \nointerlineskip \forgetall - \ruledvbox{\box0}% + \ruledvbox{\box\scratchbox}% \egroup \prevdepth\strutdp}% \def\dotopbaselinecorrection @@ -250,7 +250,7 @@ \unexpanded\def\startbaselinecorrection {\ifgridsnapping - \snaptogrid[v!normal]\vbox\bgroup + \snaptogrid[\v!normal]\vbox\bgroup \let\stopbaselinecorrection\egroup \else \normalstartbaselinecorrection diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index 28b889b98..fa408ec38 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -970,7 +970,7 @@ % experiment -\newbox\emptystrutbox \setbox\emptystrutbox\hbox{} +\newbox\emptystrutbox \setbox\emptystrutbox\emptyhbox \def\dosetstruthide {\setbox\strutbox\copy\emptystrutbox @@ -1067,7 +1067,7 @@ \fi \fi\fi} -\newbox\nostrutbox \setbox\nostrutbox\normalhbox{} % {\normalhbox{}} +\newbox\nostrutbox \setbox\nostrutbox\emptyhbox \def\setnostrut {\setbox\strutbox\copy\nostrutbox diff --git a/tex/context/base/strc-lst.mkiv b/tex/context/base/strc-lst.mkiv index f752051d7..526ed0409 100644 --- a/tex/context/base/strc-lst.mkiv +++ b/tex/context/base/strc-lst.mkiv @@ -96,7 +96,7 @@ % new from here \xdef\currentstructurelistattribute{\ctxlua{tex.write(structures.references.setinternalreference(nil,nil,\nextinternalreference))}}% \xdef\currentdestinationattribute{\number\lastdestinationattribute}% - %begingroup\attribute\destinationattribute\currentdestinationattribute\dontleavehmode\hbox{}\endgroup % todo + %begingroup\attribute\destinationattribute\currentdestinationattribute\dontleavehmode\emptyhbox\endgroup % todo \dontleavehmode\hbox attr \destinationattribute \currentdestinationattribute{}% todo % end of new \else @@ -702,7 +702,7 @@ \hfill}}} {\!!widtha\zeropoint \!!widthc\zeropoint - \setbox2\hbox{}}% + \setbox2\emptyhbox}% \setbox4\hbox {\doif{\listparameter\c!pagenumber}\v!yes {\doifsomething{#5} % \listwidth is new ; temp hack diff --git a/tex/context/base/strc-ref.mkiv b/tex/context/base/strc-ref.mkiv index 552f19d86..cacfe3114 100644 --- a/tex/context/base/strc-ref.mkiv +++ b/tex/context/base/strc-ref.mkiv @@ -177,7 +177,7 @@ }% % todo: optional \xdef\currentdestinationattribute{\number\lastdestinationattribute}% - \begingroup\attribute\destinationattribute\currentdestinationattribute\hbox{}\endgroup % todo + \begingroup\attribute\destinationattribute\currentdestinationattribute\emptyhbox\endgroup % todo \fi \fi} @@ -1286,7 +1286,7 @@ \attribute\referenceattribute\attributeunsetvalue \ctxlua{structures.references.doifelse("\referenceprefix","#3",\extrareferencearguments)}% {\ctxlua{structures.references.injectcurrentset(nil,nil)}% - \setbox\scratchbox\null\wd\scratchbox#1\ht\scratchbox#2% + \setbox\scratchbox\emptyhbox\wd\scratchbox#1\ht\scratchbox#2% \global\lastsavedreferenceattribute\lastreferenceattribute \hbox attr \referenceattribute \lastreferenceattribute {\box\scratchbox}}% {}% @@ -1750,7 +1750,7 @@ \def\overlayfakebox {\hbox - {\setbox\scratchbox\null + {\setbox\scratchbox\emptyhbox \wd\scratchbox\overlaywidth \ht\scratchbox\overlayheight \box\scratchbox}} diff --git a/tex/context/base/supp-ali.mkiv b/tex/context/base/supp-ali.mkiv index 8727efbb2..cfaeb213e 100644 --- a/tex/context/base/supp-ali.mkiv +++ b/tex/context/base/supp-ali.mkiv @@ -54,7 +54,7 @@ \let\\\empty \setbox\scratchbox\hbox{#1}% \edef\characterassignwidth{\the\wd\scratchbox}% - \setbox\scratchbox\null + \setbox\scratchbox\emptyhbox \docheckalignment##1#1\relax\relax \scratchdimen-\wd\scratchbox \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% @@ -99,7 +99,7 @@ \let\\\empty % beware, no grouping \setbox\scratchbox\hbox{#1}% \edef\characterassignwidth{\the\wd\scratchbox}% - \setbox\scratchbox\null + \setbox\scratchbox\emptyhbox % new 12,34 vs 10\\ where 10 aligns on 12 if #1 = , \ifcase\characteralignmentslot \docheckalignment##1#1\relax\relax diff --git a/tex/context/base/supp-box.mkiv b/tex/context/base/supp-box.mkiv index b47caca9d..2ccb29149 100644 --- a/tex/context/base/supp-box.mkiv +++ b/tex/context/base/supp-box.mkiv @@ -250,7 +250,7 @@ \def\makeph@nt#1#2#3% {\begingroup \dowithnextbox - {\setbox\scratchbox\null + {\setbox\scratchbox\emptyhbox \ht\scratchbox\ht#1% \dp\scratchbox\dp#2% \wd\scratchbox\wd#3% @@ -849,7 +849,7 @@ \def\doreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip {\global\reshapingfailedfalse \ifzeropt\ht\oldshapebox % \ifdim\ht\oldshapebox=\zeropoint - \setbox\newshapebox\normalvbox{}% + \setbox\newshapebox\emptyvbox \else \setbox\newshapebox\normalvbox {\unvcopy\oldshapebox @@ -1268,33 +1268,6 @@ %D third argument into account, which leads to a bit more %D complex macro than needed at first sight. -% \def\dodoboundtext#1% -% {\setbox0=\normalhbox{\unhcopy0 #1}% -% \ifdim\wd0>\dimen0 -% \let\dodoboundtext=\gobbleoneargument -% \else -% #1\relax -% \fi} -% -% \def\doboundtext#1#2#3% -% {\normalhbox -% {\setbox0=\normalhbox{#1}% -% \dimen0=#2\relax -% \ifdim\wd0>\dimen0 -% \setbox2=\normalhbox{#3}% -% \advance\dimen0 by -\wd2 -% \setbox0=\normalhbox{}% -% \processtokens -% {\dodoboundtext} -% {\dodoboundtext} -% {} -% {\space} -% {#1}% -% \box2 -% \else -% \box0 -% \fi}} - \def\dodoboundtext#1% {\setbox0\normalhbox{#1}% \advance\scratchdimen -\wd0 @@ -1354,7 +1327,7 @@ %D \veryraggedright %D \strut\unhcopy\nextbox}% %D \ifdim\nextboxht>\strutht \else -%D \setbox\scratchbox\null % overfull and not split +%D \setbox\scratchbox\emptyhbox % overfull and not split %D \fi %D \setbox\nextbox=\normalvbox % if omitted: missing brace reported %D {\splittopskip=\openstrutheight @@ -2057,7 +2030,7 @@ \noindent\unhbox0\par} \def\makehboxofhboxes - {\setbox0\normalhbox{}% + {\setbox0\emptyhbox \loop % \doloop { .. \exitloop .. } \setbox2\lastbox \ifhbox2 @@ -2065,7 +2038,7 @@ \repeat} % \def\makehboxofhboxes -% {\setbox0\normalhbox{}% +% {\setbox0\emptyhbox % \doloop % \doloop { .. \exitloop .. } % {% \dorecurse{3}{\unskip\unpenalty}% get rid of ... (better do this in a shapeloop) % \setbox2\lastbox @@ -2367,7 +2340,7 @@ %D specified, here being zero. \def\dofakebox - {\setbox\scratchbox\null + {\setbox\scratchbox\emptyhbox \wd\scratchbox\wd\scratchcounter \ht\scratchbox\ht\scratchcounter \dp\scratchbox\dp\scratchcounter @@ -2772,7 +2745,7 @@ % {\ifundefined{\@@stackbox#1}% % \@EA\newbox\csname\@@stackbox#1\endcsname % \else -% \global\setbox\csname\@@stackbox#1\endcsname\normalvbox{}% +% \global\setbox\csname\@@stackbox#1\endcsname\emptyvbox % \def\docommand##1{\global\letbeundefined{\@@stacktag#1:##1}}% % \processcommacommand[\getvalue{\@@stacklst#1}]\docommand % \fi diff --git a/tex/context/base/syst-ini.tex b/tex/context/base/syst-ini.tex index c4b326d96..fb3732074 100644 --- a/tex/context/base/syst-ini.tex +++ b/tex/context/base/syst-ini.tex @@ -379,10 +379,15 @@ %D We prefer the more readable variant than in plain %D \TEX. User should only use \type {\emptybox}: -\newbox\voidbox +\newbox\voidbox % public + +\let\normalhbox\hbox +\let\normalvbox\vbox -\def\emptybox {\box \voidbox} \def\unvoidbox{\unhbox\voidbox} +\def\emptybox {\box \voidbox} % used in initializations so no attributes +\def\emptyvbox{\normalvbox{}} % no copy as we need to set attributes +\def\emptyhbox{\normalhbox{}} % no copy as we need to set attributes \let\leavevmode\unvoidbox % we prefer to use \dontleavehmode diff --git a/tex/context/base/tabl-ntb.mkii b/tex/context/base/tabl-ntb.mkii index 0bfcc20c6..e243a55c2 100644 --- a/tex/context/base/tabl-ntb.mkii +++ b/tex/context/base/tabl-ntb.mkii @@ -860,8 +860,12 @@ \crcr \noalign {\nointerlineskip - \ifnum\gettblnob\tblrow=\zerocount - \allowbreak + \ifnum\tblrow>\noftblheadlines + \ifnum\gettblnob\tblrow=\zerocount + \allowbreak + \fi + \else + \allowbreak % else no proper head split off \fi \bgroup % protect local vars \@@tblsplitafter diff --git a/tex/context/base/tabl-ntb.mkiv b/tex/context/base/tabl-ntb.mkiv index 8d694fc32..4b7e2f15d 100644 --- a/tex/context/base/tabl-ntb.mkiv +++ b/tex/context/base/tabl-ntb.mkiv @@ -907,8 +907,12 @@ \crcr \noalign {\nointerlineskip - \ifnum\gettblnob\tblrow=\zerocount - \allowbreak + \ifnum\tblrow>\noftblheadlines + \ifnum\gettblnob\tblrow=\zerocount + \allowbreak + \fi + \else + \allowbreak % else no proper head split off \fi \bgroup % protect local vars \@@tblsplitafter @@ -1395,7 +1399,7 @@ \fi \fi \fi - \setbox2\null + \setbox2\emptyhbox \wd2\wd\scratchbox \ht2\ht\scratchbox \dp2\dp\scratchbox \box2 \egroup} @@ -1407,7 +1411,7 @@ [\@@tbl\@@tbl] [#4,#1,\c!frame=\v!off,\c!background=] {\bTBLCELL#5\eTBLCELL}}% - \setbox2\null + \setbox2\emptyhbox \wd2\wd\scratchbox \ht2\ht\scratchbox \dp2\dp\scratchbox \ifautoTBLrowspan \scratchcounter\numexpr\tblrow+\plusone\relax diff --git a/tex/context/base/tabl-pln.mkiv b/tex/context/base/tabl-pln.mkiv index 39bb50f23..9e65f7e40 100644 --- a/tex/context/base/tabl-pln.mkiv +++ b/tex/context/base/tabl-pln.mkiv @@ -19,11 +19,11 @@ \newdimen \@@plntabdimen \def\cleartabs % visible - {\global\setbox\@@plntabsyet\null - \setbox\@@plntabs\null} + {\global\setbox\@@plntabsyet\emptyhbox + \setbox\@@plntabs\emptyhbox} \def\settabs % visible - {\setbox\@@plntabs\null + {\setbox\@@plntabs\emptyhbox \futurelet\next\@@plnsettabs} \def\tabalign % visible @@ -61,7 +61,7 @@ \def\@@plnmaketabbox {\begingroup \global\setbox\@@plntabsyet\copy\@@plntabs - \global\setbox\@@plntabsdone\null + \global\setbox\@@plntabsdone\emptyhbox \def\cr {\@@plncrtrue\crcr\egroup\egroup \if@@plnusetab\unvbox\zerocount\lastbox\fi\endgroup diff --git a/tex/context/base/tabl-tab.mkiv b/tex/context/base/tabl-tab.mkiv index 274ae74bf..f8136360f 100644 --- a/tex/context/base/tabl-tab.mkiv +++ b/tex/context/base/tabl-tab.mkiv @@ -319,26 +319,41 @@ \fi} % \def\!tgCheckForDigit -% {\!taDigitfalse -% \ifx 0\!ttemp \!taDigittrue -% \else\ifx 1\!ttemp \!taDigittrue -% \else\ifx 2\!ttemp \!taDigittrue -% \else\ifx 3\!ttemp \!taDigittrue -% \else\ifx 4\!ttemp \!taDigittrue -% \else\ifx 5\!ttemp \!taDigittrue -% \else\ifx 6\!ttemp \!taDigittrue -% \else\ifx 7\!ttemp \!taDigittrue -% \else\ifx 8\!ttemp \!taDigittrue -% \else\ifx 9\!ttemp \!taDigittrue +% {\donefalse +% \ifx 0\!ttemp \donetrue +% \else\ifx 1\!ttemp \donetrue +% \else\ifx 2\!ttemp \donetrue +% \else\ifx 3\!ttemp \donetrue +% \else\ifx 4\!ttemp \donetrue +% \else\ifx 5\!ttemp \donetrue +% \else\ifx 6\!ttemp \donetrue +% \else\ifx 7\!ttemp \donetrue +% \else\ifx 8\!ttemp \donetrue +% \else\ifx 9\!ttemp \donetrue % \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi -% \if!taDigit +% \ifdone % \expandafter \!tgGetNumber % \else % \expandafter \!tgReturn % \fi} -\def\!tgCheckForDigit - {\doifnumberelse\!ttemp\!tgGetNumber\!tgReturn} +\def\!tgCheckForDigit % less tokens: + {\donetrue + \ifx 0\!ttemp \else \ifx 1\!ttemp \else + \ifx 2\!ttemp \else \ifx 3\!ttemp \else + \ifx 4\!ttemp \else \ifx 5\!ttemp \else + \ifx 6\!ttemp \else \ifx 7\!ttemp \else + \ifx 8\!ttemp \else \ifx 9\!ttemp \else + \donefalse + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \ifdone + \expandafter \!tgGetNumber + \else + \expandafter \!tgReturn + \fi} + +% \def\!tgCheckForDigit % does not work +% {\relax\doifnumberelse\!ttemp\!tgGetNumber\!tgReturn} \def\!tgGetNumber {\afterassignment\!tgGetNumberA\scratchcounter=} \def\!tgGetNumberA{\edef\!tgValue{\the\scratchcounter}\!tgReturn} @@ -967,7 +982,7 @@ {\omit \!ttGetHalfRuleThickness \leaders\hrule\!!height\scratchdimen\!!depth\scratchdimen\hfill - \null + \emptyhbox \ignorespaces} \def\donormaltablelongrule % was: \!ttLongHrule @@ -989,10 +1004,10 @@ \fi \divide\scratchdimen\plustwo} -% \null prevents \unskip +% \emptyhbox prevents \unskip -\def\dotableLeft #1{#1\hfill\null} -\def\dotableCenter#1{\hfill#1\hfill\null} +\def\dotableLeft #1{#1\hfill\emptyhbox} +\def\dotableCenter#1{\hfill#1\hfill\emptyhbox} \def\dotableRight #1{\hfill#1} \def\dotableOpenUp#1#2% @@ -1018,8 +1033,8 @@ \dotableExpand} \def\dotableJustLeft {\omit\let\!ttRightGlue\hfill} -\def\dotableJustCenter{\omit\hfill\null\let\!ttRightGlue\hfill} -\def\dotableJustRight {\omit\hfill\null} +\def\dotableJustCenter{\omit\hfill\emptyhbox\let\!ttRightGlue\hfill} +\def\dotableJustRight {\omit\hfill\emptyhbox} \def\dotableSmash {\relax diff --git a/tex/context/base/tabl-tsp.mkiv b/tex/context/base/tabl-tsp.mkiv index 4471147ff..af14e00f6 100644 --- a/tex/context/base/tabl-tsp.mkiv +++ b/tex/context/base/tabl-tsp.mkiv @@ -201,21 +201,25 @@ \newbox\tsplitnext \newbox\tsplittail -\def\resettsplit{% only \def's starting a a new line are seen by the dep checker +\newtoks\everyresettsplit + +\def\resettsplit{\the\everyresettsplit} + +\appendtoks \def\tsplitminimumfreelines{0}% \def\tsplitminimumfreespace{0pt}% - \setbox\tsplitcontent \vbox{}% - \setbox\tsplitresult \vbox{}% - \setbox\tsplithead \vbox{}% - \setbox\tsplitnext \vbox{}% - \setbox\tsplittail \vbox{}% + \setbox\tsplitcontent\emptyvbox + \setbox\tsplitresult \emptyvbox + \setbox\tsplithead \emptyvbox + \setbox\tsplitnext \emptyvbox + \setbox\tsplittail \emptyvbox \let\tsplitbeforeresult\donothing \let\tsplitafterresult \donothing \let\tsplitinbetween \donothing \let\tsplitbefore \donothing \let\tsplitafter \donothing \let\postprocesstsplit \donothing -} +\to \everyresettsplit \resettsplit diff --git a/tex/context/base/trac-log.lua b/tex/context/base/trac-log.lua index 4a77087f5..6160e1b0f 100644 --- a/tex/context/base/trac-log.lua +++ b/tex/context/base/trac-log.lua @@ -78,7 +78,6 @@ end --~ local report = logs.new("fonts") - -- nop logging (maybe use __call instead) local noplog = { } logs.nop = noplog setmetatable(logs, { __index = noplog }) @@ -120,6 +119,20 @@ function texlog.line(fmt,...) -- new end end +--~ local hasscheme = url.hasscheme + +--~ function texlog.show_open(name) +--~ if hasscheme(name) ~= "virtual" then +--~ write(format("(",name)) -- tex adds a space +--~ end +--~ end + +--~ function texlog.show_close(name) +--~ if hasscheme(name) ~= "virtual" then +--~ write(")") -- tex adds a space +--~ end +--~ end + local real, user, sub function texlog.start_page_number() diff --git a/tex/context/bib/sample.bib b/tex/context/bib/sample.bib index 70df38940..3f8df623e 100644 --- a/tex/context/bib/sample.bib +++ b/tex/context/bib/sample.bib @@ -24,7 +24,7 @@ year = {2010}, volume = {40}, pages = {67-71}, - timestamp = {2010.10.28} + keywords = {context}, } @BOOK{Eijkhout1991, @@ -35,3 +35,4 @@ address = {London}, keywords = {general}, } + diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index dfba66938..268498c32 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 12/04/10 19:31:58 +-- merge date : 12/06/10 15:24:44 do -- begin closure to overcome local limits and interference @@ -3780,7 +3780,10 @@ function tfm.scale(tfmtable, scaledpoints, relativeid) local sharedkerns = { } for k,v in next, characters do local chr, description, index - if ischanged then + if isvirtual then + description = descriptions[k] or v + -- no index + elseif ischanged then -- basemode hack local c = changed[k] if c then |