From 4c847f6ee336bd05700e7c19f2aca91e893529de Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 5 Jan 2012 19:27:28 +0100 Subject: beta 2011.11.17 15:19 --- tex/context/base/anch-pgr.mkiv | 2 +- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4063 -> 4065 bytes tex/context/base/context-version.png | Bin 106066 -> 106386 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/core-uti.lua | 22 +++- tex/context/base/node-fin.mkiv | 3 + tex/context/base/page-imp.mkiv | 64 ++++++++---- tex/context/base/status-files.pdf | Bin 24017 -> 23993 bytes tex/context/base/status-lua.pdf | Bin 167999 -> 168036 bytes tex/context/base/tabl-xtb.lua | 115 +++++++++++++-------- tex/context/base/tabl-xtb.mkvi | 4 +- tex/context/base/task-ini.lua | 2 + tex/context/base/typo-mar.lua | 4 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 17 files changed, 148 insertions(+), 78 deletions(-) diff --git a/tex/context/base/anch-pgr.mkiv b/tex/context/base/anch-pgr.mkiv index 1901097e3..046a161e5 100644 --- a/tex/context/base/anch-pgr.mkiv +++ b/tex/context/base/anch-pgr.mkiv @@ -80,7 +80,7 @@ \setbox#1\hbox{\hpos\pageanchor{\box#1}}% \fi \else - \setbox#1\ruledhbox{\hpos\pageanchor{\box#1}}% + \setbox#1\hbox{\hpos\pageanchor{\box#1}}% \fi \fi\fi} diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 338c998fb..a8f9b11aa 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.11.17 11:19} +\newcontextversion{2011.11.17 15:19} %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/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 0cdca1ccf..db5fa9b84 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{2011.11.17 11:19} +\newcontextversion{2011.11.17 15:19} %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-version.pdf b/tex/context/base/context-version.pdf index a8b544a45..ef2dfe1bd 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 1a34834ef..fc4f24730 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.mkii b/tex/context/base/context.mkii index 6c222938a..9b1693c4d 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.11.17 11:19} +\edef\contextversion{2011.11.17 15:19} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 4241bf3ca..cab2befb6 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.11.17 11:19} +\edef\contextversion{2011.11.17 15:19} %D For those who want to use this: diff --git a/tex/context/base/core-uti.lua b/tex/context/base/core-uti.lua index febb5cebd..69b8fffe1 100644 --- a/tex/context/base/core-uti.lua +++ b/tex/context/base/core-uti.lua @@ -53,10 +53,18 @@ end job.comment(format("version: %1.2f",job.version)) +local enabled = true + +directives.register("job.save",function(v) enabled = v end) + +function job.disablesave() -- can be command + enabled = false +end + function job.initialize(loadname,savename) job.load(loadname) -- has to come after structure is defined ! luatex.registerstopactions(function() - if not status.lasterrorstring or status.lasterrorstring == "" then + if enabled and not status.lasterrorstring or status.lasterrorstring == "" then job.save(savename) end end) @@ -225,11 +233,17 @@ statistics.register("startup time", function() end) statistics.register("jobdata time",function() - if statistics.elapsedindeed(_save_) or statistics.elapsedindeed(_load_) or #_others_ > 0 then + if enabled then + if #_others_ > 0 then + return format("%s seconds saving, %s seconds loading, other files: %s",statistics.elapsedtime(_save_),statistics.elapsedtime(_load_),concat(_others_," ")) + else + return format("%s seconds saving, %s seconds loading",statistics.elapsedtime(_save_),statistics.elapsedtime(_load_)) + end + else if #_others_ > 0 then - return format("%s seconds saving, %s seconds loading, other files: %s", statistics.elapsedtime(_save_), statistics.elapsedtime(_load_),concat(_others_," ")) + return format("nothing saved, %s seconds loading, other files: %s",statistics.elapsedtime(_load_),concat(_others_," ")) else - return format("%s seconds saving, %s seconds loading", statistics.elapsedtime(_save_), statistics.elapsedtime(_load_)) + return format("nothing saved, %s seconds loading",statistics.elapsedtime(_load_)) end end end) diff --git a/tex/context/base/node-fin.mkiv b/tex/context/base/node-fin.mkiv index 3faf2e319..2f90e699b 100644 --- a/tex/context/base/node-fin.mkiv +++ b/tex/context/base/node-fin.mkiv @@ -22,6 +22,9 @@ \definesystemattribute[trigger][public] +% There will be two: (1) page i.e. before shipout cq. impose cache +% (2) at shipout + \def\finalizeobjectbox #1{\ctxlua{nodes.handlers.finalize(tex.box[\number#1])}} \def\finalizeshipoutbox#1{\ctxlua{nodes.handlers.finalize(tex.box[\number#1])}} diff --git a/tex/context/base/page-imp.mkiv b/tex/context/base/page-imp.mkiv index de11090d3..b320eae03 100644 --- a/tex/context/base/page-imp.mkiv +++ b/tex/context/base/page-imp.mkiv @@ -17,6 +17,8 @@ \unprotect +% todo: impose a la mkiv (us elua specification tables) + % sizing bug: % % \setuppapersize[A4][A4,landscape] \setuparranging[2UP] \showframe @@ -116,22 +118,46 @@ \prependtoks \flushtextdata \to \everylastshipout -\def\installpagehandler#1#2% % a handler takes one argument: something to be boxed +\def\installpagehandler#1#2% % a handler takes one argument: something to be boxed {\setgvalue{\??pp:\c!method:#1}##1{#2{##1}}} % and shipped out (don't depend on the exact package) \installpagehandler\v!normal {\ifarrangingpages\expandafter\actualarrange\else\expandafter\actualshipout\fi} +% Problem: we need to apply the finalizers to a to be shipped out page (as +% we can have positioning involved). However, we can also add stuff in the +% imposition, like cropmarks. Fortunately we do that with metapost so +% colors etc are dealt with at that end. + +% \starttypen +% \def\pagestoshipout{1,3,5} +% \stoptypen + +\newcount \shippedoutpages +\newcount \combinedpagescounter + +\let \pagestoshipout\empty % {1,3,6} +\newconstant \whichpagetoshipout % 0=all 1=odd 2=even + +\newbox \shipoutscratchbox +\newbox \postponedcontent + +\setnewconstant\shipoutfinalizemethod\plusone % this will be default (we will have two finalizers) + \def\myshipout#1% {\beforeshipout % voor de pagebody dus ! \dontshowcomposition \dontcomplain - \executeifdefined{\??pp:\c!method:\@@ppmethod}\gobbleoneargument{#1}% + \ifcase\shipoutfinalizemethod + \executeifdefined{\??pp:\c!method:\@@ppmethod}\gobbleoneargument{#1}% + \else + \setbox\shipoutscratchbox\hbox{#1}% just in case there are objects there, hook for testing (will go away) + \finalizeshipoutbox\shipoutscratchbox + \executeifdefined{\??pp:\c!method:\@@ppmethod}\gobbleoneargument{\box\shipoutscratchbox}% + \fi \setnextrealpageno \aftershipout} -\newbox\postponedcontent - \def\flushatshipout {\dowithnextbox {\global\setbox\postponedcontent\hbox to \zeropoint @@ -142,19 +168,7 @@ \global\postponedcontent\zeropoint}% \hbox} -% \starttypen -% \def\pagestoshipout{1,3,5} -% \stoptypen - -\newcount\shippedoutpages -\newcount\combinedpagescounter - -\let\pagestoshipout\empty % {1,3,6} -\newconstant\whichpagetoshipout % 0=all 1=odd 2=even - -\newbox\shipoutscratchbox - -\def\actualshipout#1% todo: less callbacks +\def\actualshipout#1% todo: less callbacks, #1 will go away {\global\advance\shippedoutpages\plusone % this is not resource safe! \ifx\pagestoshipout\empty @@ -173,8 +187,10 @@ \fi \ifdone \begingroup - \setbox\shipoutscratchbox\hbox{#1}% just in case there are objects there, hook for testing - \finalizeshipoutbox\shipoutscratchbox + \ifcase\shipoutfinalizemethod + \setbox\shipoutscratchbox\hbox{#1}% + \finalizeshipoutbox\shipoutscratchbox + \fi \setbox\scratchbox\hbox {% before the main one ! \ifcase\realfolio \or @@ -197,7 +213,11 @@ \hbox % \setbox0=\box.. is nicer {\box\scratchbox \ifvoid\postponedcontent\else\box\postponedcontent\fi % evt ver naar links ! - \box\shipoutscratchbox}}% + \ifcase\shipoutfinalizemethod + \box\shipoutscratchbox + \else + \hbox{#1}% + \fi}}% \endgroup \else \message @@ -307,6 +327,10 @@ \global\arrangingpagesfalse \fi \setuppapersize + \ifarrangingpages + \ctxlua{job.disablesave()}% + %\disabledirective[job.save]% + \fi \fi} \def\installpagearrangement #1 % will lchange, no space diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index f1fbb0258..e904eb043 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 c853d16be..3b51dc7e0 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/tabl-xtb.lua b/tex/context/base/tabl-xtb.lua index 715acab73..de52b933c 100644 --- a/tex/context/base/tabl-xtb.lua +++ b/tex/context/base/tabl-xtb.lua @@ -23,6 +23,8 @@ this mechamism will be improved so that it can replace its older cousin. ]]-- +-- todo: use linked list instead of r/c array + local texdimen = tex.dimen local texcount = tex.count local texbox = tex.box @@ -30,6 +32,7 @@ local texsetcount = tex.setcount local texsetdimen = tex.setdimen local format = string.format +local concat = table.concat local context = context local context_beginvbox = context.beginvbox @@ -54,7 +57,11 @@ local v_normal = variables.normal local v_width = variables.width local v_repeat = variables["repeat"] -xtables = { } +xtables = { } -- maybe in typesetters + +local trace_xtable = false trackers.register("xtable.construct", function(v) trace_xtable = v end) + +local report_xtable = logs.reporter("xtable") local head_mode = 1 local foot_mode = 2 @@ -150,37 +157,6 @@ function xtables.initialize_reflow_width() data.currentcolumn = c end -function xtables.initialize_reflow_height() - local r = data.currentrow - local c = data.currentcolumn + 1 - local rows = data.rows - local row = rows[r] - while row[c].span do -- can also be previous row ones - c = c + 1 - end - data.currentcolumn = c - local widths = data.widths - local w = widths[c] - local drc = row[c] - for x=1,drc.nx-1 do - w = w + widths[c+x] - end - texdimen.x_table_width = w - local dimensionstate = drc.dimensionstate or 0 - if dimensionstate == 1 or dimensionstate == 3 then - -- width was fixed so height is known - texcount.x_table_skip_mode = 1 - elseif dimensionstate == 2 then - -- height is enforced - texcount.x_table_skip_mode = 1 - elseif data.autowidths[c] then - -- width has changed so we need to recalculate the height - texcount.x_table_skip_mode = 0 - else - texcount.x_table_skip_mode = 1 - end -end - function xtables.set_reflow_width() local r = data.currentrow local c = data.currentcolumn @@ -244,14 +220,45 @@ function xtables.set_reflow_width() data.currentcolumn = c end -function xtables.set_reflow_height() +function xtables.initialize_reflow_height() local r = data.currentrow - local c = data.currentcolumn + local c = data.currentcolumn + 1 local rows = data.rows local row = rows[r] - while row[c].span do -- we could adapt drc.nx instead + while row[c].span do -- can also be previous row ones c = c + 1 end + data.currentcolumn = c + local widths = data.widths + local w = widths[c] + local drc = row[c] + for x=1,drc.nx-1 do + w = w + widths[c+x] + end + texdimen.x_table_width = w + local dimensionstate = drc.dimensionstate or 0 + if dimensionstate == 1 or dimensionstate == 3 then + -- width was fixed so height is known + texcount.x_table_skip_mode = 1 + elseif dimensionstate == 2 then + -- height is enforced + texcount.x_table_skip_mode = 1 + elseif data.autowidths[c] then + -- width has changed so we need to recalculate the height + texcount.x_table_skip_mode = 0 + else + texcount.x_table_skip_mode = 1 + end +end + +function xtables.set_reflow_height() + local r = data.currentrow + local c = data.currentcolumn + local rows = data.rows + local row = rows[r] +-- while row[c].span do -- we could adapt drc.nx instead +-- c = c + 1 +-- end local tb = texbox.x_table_box local drc = row[c] if not data.fixedrows[r] then -- and drc.dimensionstate < 2 @@ -264,8 +271,8 @@ function xtables.set_reflow_height() depths[r] = depth end end - c = c + drc.nx - 1 - data.currentcolumn = c +-- c = c + drc.nx - 1 +-- data.currentcolumn = c end function xtables.initialize_construct() @@ -301,14 +308,14 @@ function xtables.set_construct() local c = data.currentcolumn local rows = data.rows local row = rows[r] - while row[c].span do -- can also be previous row ones - c = c + 1 - end +-- while row[c].span do -- can also be previous row ones +-- c = c + 1 +-- end local drc = row[c] -- this will change as soon as in luatex we can reset a box list without freeing drc.list = copy_node_list(texbox.x_table_box) - c = c + drc.nx - 1 - data.currentcolumn = c +-- c = c + drc.nx - 1 +-- data.currentcolumn = c end function xtables.reflow_width() @@ -443,6 +450,24 @@ function xtables.construct() local leftmargindistance = settings.leftmargindistance local rightmargindistance = settings.rightmargindistance -- ranges can be mixes so we collect + + if trace_xtable then + for r=1,data.nofrows do + local line = { } + for c=1,data.nofcolumns do + local cell =rows[r][c] + if cell.list then + line[#line+1] = "list" + elseif cell.span then + line[#line+1] = "span" + else + line[#line+1] = "none" + end + end + report_xtable("%3d : %s",r,concat(line," ")) + end + end + local ranges = { [head_mode] = { }, [foot_mode] = { }, @@ -489,12 +514,14 @@ function xtables.construct() if c < nofcolumns then step = step + columndistance + distances[c] end + local kern = new_kern(step) if stop then - local kern = new_kern(step) stop.prev = kern stop.next = kern - stop = kern + else -- can be first spanning next row (ny=...) + start = kern end + stop = kern end if start then if rightmargindistance > 0 then diff --git a/tex/context/base/tabl-xtb.mkvi b/tex/context/base/tabl-xtb.mkvi index 28518d474..d29ede5a1 100644 --- a/tex/context/base/tabl-xtb.mkvi +++ b/tex/context/base/tabl-xtb.mkvi @@ -348,8 +348,8 @@ \def\before_x_cell_settings {\letxtableparameter\c!nx\plusone \letxtableparameter\c!ny\plusone - \letxtableparameter\c!nr\plusone - \letxtableparameter\c!nc\plusone} + \letxtableparameter\c!nc\plusone + \letxtableparameter\c!nr\plusone} \def\after_x_cell_settings {\x_table_nx\directxtableparameter\c!nc\relax diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua index 4021bd6f1..1ec38e181 100644 --- a/tex/context/base/task-ini.lua +++ b/tex/context/base/task-ini.lua @@ -10,6 +10,8 @@ if not modules then modules = { } end modules ['task-ini'] = { -- the load order can determine the trickery to be applied to node lists -- -- we can disable more handlers and enable then when really used (*) +-- +-- todo: two finalizers: real shipout (can be imposed page) and page shipout (individual page) local tasks = nodes.tasks local appendaction = tasks.appendaction diff --git a/tex/context/base/typo-mar.lua b/tex/context/base/typo-mar.lua index 4d9043424..533ee2c03 100644 --- a/tex/context/base/typo-mar.lua +++ b/tex/context/base/typo-mar.lua @@ -785,12 +785,12 @@ end -- go horizontal. So this needs more testing. prependaction("finalizers", "lists", "typesetters.margins.localhandler") -prependaction("vboxbuilders", "normalizers", "typesetters.margins.localhandler") +-- prependaction("vboxbuilders", "normalizers", "typesetters.margins.localhandler") prependaction("mvlbuilders", "normalizers", "typesetters.margins.globalhandler") prependaction("shipouts", "normalizers", "typesetters.margins.finalhandler") disableaction("finalizers", "typesetters.margins.localhandler") -disableaction("vboxbuilders", "typesetters.margins.localhandler") +-- disableaction("vboxbuilders", "typesetters.margins.localhandler") disableaction("mvlbuilders", "typesetters.margins.globalhandler") disableaction("shipouts", "typesetters.margins.finalhandler") diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 614d75dea..b9d60a030 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 : 11/17/11 10:54:57 +-- merge date : 11/17/11 15:19:19 do -- begin closure to overcome local limits and interference -- cgit v1.2.3