From 66f653890a45d1275826d56798071a97468d88be Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Sun, 22 May 2016 16:41:11 +0200 Subject: 2016-05-22 15:23:00 --- doc/context/documents/general/manuals/luatex.pdf | Bin 995323 -> 995962 bytes .../general/manuals/luatex/luatex-enhancements.tex | 7 ++ .../sources/general/manuals/luatex/luatex.tex | 2 +- tex/context/base/context-version.pdf | Bin 4250 -> 4259 bytes tex/context/base/mkiv/anch-pos.lua | 112 +++++++++++---------- tex/context/base/mkiv/anch-tab.mkiv | 6 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/node-nut.lua | 5 +- tex/context/base/mkiv/page-mix.lua | 82 ++++++++------- tex/context/base/mkiv/page-mix.mkiv | 5 +- tex/context/base/mkiv/status-files.pdf | Bin 9124 -> 9121 bytes tex/context/base/mkiv/status-lua.pdf | Bin 268230 -> 268230 bytes tex/context/interface/mkiv/i-context.pdf | Bin 820584 -> 820585 bytes tex/context/interface/mkiv/i-readme.pdf | Bin 60793 -> 60792 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 16 files changed, 130 insertions(+), 95 deletions(-) diff --git a/doc/context/documents/general/manuals/luatex.pdf b/doc/context/documents/general/manuals/luatex.pdf index 3f3825252..23464f212 100644 Binary files a/doc/context/documents/general/manuals/luatex.pdf and b/doc/context/documents/general/manuals/luatex.pdf differ diff --git a/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex b/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex index 35c27cfb6..96774815d 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex @@ -759,6 +759,13 @@ the acceptable range is from 0 to 65535. These three primitives are like \type {\vbox}, \type {\hbox} and \type {\vtop} but don't apply the related callbacks. +\subsection{\type {\vsplit}} + +The \type {\vsplit} primitive has to be followed by a specification of the +required height. As alternative for the \type {to} keyword you can use \type +{upto} to get a split of the given size but result has the natural dimensions +then. + \subsection{Images and Forms} These two concepts are now core concepts and no longer whatsits. They are in fact diff --git a/doc/context/sources/general/manuals/luatex/luatex.tex b/doc/context/sources/general/manuals/luatex/luatex.tex index 59a969396..c997835c5 100644 --- a/doc/context/sources/general/manuals/luatex/luatex.tex +++ b/doc/context/sources/general/manuals/luatex/luatex.tex @@ -11,7 +11,7 @@ \dontcomplain \startdocument - [version=0.95.0, + [version=0.96.0, status=Pre-release] \component luatex-titlepage diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 44a38d269..3f6357149 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/mkiv/anch-pos.lua b/tex/context/base/mkiv/anch-pos.lua index 7109f2592..d59a91cad 100644 --- a/tex/context/base/mkiv/anch-pos.lua +++ b/tex/context/base/mkiv/anch-pos.lua @@ -211,42 +211,28 @@ local getvpos = function() getvpos = backends.codeinjections.getvpos return getv local function setdim(name,w,h,d,extra) -- will be used when we move to sp allover local x, y = getpos() - if x == 0 then x = nil end - if y == 0 then y = nil end - if w == 0 then w = nil end - if h == 0 then h = nil end - if d == 0 then d = nil end - if extra == "" then extra = nil end - -- todo: sparse tobesaved[name] = { p = texgetcount("realpageno"), - x = x, - y = y, - w = w, - h = h, - d = d, - e = extra, + x = x ~= 0 and x or nil, + y = y ~= 0 and y or nil, + w = w ~= 0 and w or nil, + h = h ~= 0 and h or nil, + d = d ~= 0 and d or nil, + e = extra ~= "" and extra or nil, r = region, c = column, } end local function setall(name,p,x,y,w,h,d,extra) - if x == 0 then x = nil end - if y == 0 then y = nil end - if w == 0 then w = nil end - if h == 0 then h = nil end - if d == 0 then d = nil end - if extra == "" then extra = nil end - -- todo: sparse tobesaved[name] = { p = p, - x = x, - y = y, - w = w, - h = h, - d = d, - e = extra, + x = x ~= 0 and x or nil, + y = y ~= 0 and y or nil, + w = w ~= 0 and w or nil, + h = h ~= 0 and h or nil, + d = d ~= 0 and d or nil, + e = extra ~= "" and extra or nil, r = region, c = column, } @@ -261,12 +247,16 @@ local function enhance(data) end if data.x == true then if data.y == true then - data.x, data.y = getpos() + local x, y = getpos() + data.x = x ~= 0 and x or nil + data.y = y ~= 0 and y or nil else - data.x = gethpos() + local x = gethpos() + data.x = x ~= 0 and x or nil end elseif data.y == true then - data.y = getvpos() + local y = getvpos() + data.y = y ~= 0 and y or nil end if data.p == true then data.p = texgetcount("realpageno") -- we should use a variable set in otr @@ -274,12 +264,15 @@ local function enhance(data) if data.c == true then data.c = column end + -- if rawget(data,"w") == 0 then if data.w == 0 then data.w = nil end + -- if rawget(data,"h") == 0 then if data.h == 0 then data.h = nil end + -- if rawget(data,"d") == 0 then if data.d == 0 then data.d = nil end @@ -349,10 +342,11 @@ scanners.dosavepositionplus = compilescanner { -- not much gain in keeping stack (inc/dec instead of insert/remove) local function b_column(tag) + local x = gethpos() tobesaved[tag] = { r = true, - x = gethpos(), - w = 0, + x = x ~= 0 and x or nil, + -- w = 0, } insert(columns,tag) column = tag @@ -363,7 +357,8 @@ local function e_column(tag) if not t then -- something's wrong else - t.w = gethpos() - t.x + local x = gethpos() - t.x + t.w = x ~= 0 and x or nil t.r = region end remove(columns) @@ -403,7 +398,9 @@ end local function b_region(tag) local last = tobesaved[tag] - last.x, last.y = getpos() + local x, y = getpos() + last.x = x ~= 0 and x or nil + last.y = y ~= 0 and y or nil last.p = texgetcount("realpageno") insert(regions,tag) region = tag @@ -411,11 +408,12 @@ end local function e_region(correct) local last = tobesaved[region] - local v = getvpos() + local y = getvpos() if correct then - last.h = last.y - v + local h = (last.y or 0) - y + last.h = h ~= 0 and h or nil end - last.y = v + last.y = y ~= 0 and y or nil remove(regions) region = regions[#regions] end @@ -432,10 +430,11 @@ local function setregionbox(n,tag) local w = getfield(box,"width") local h = getfield(box,"height") local d = getfield(box,"depth") + local y = getvpos() tobesaved[tag] = { p = true, -- not enhanced x = true, -- not enhanced - y = getvpos(), -- true, + y = y ~= 0 and y or nil, w = w ~= 0 and w or nil, h = h ~= 0 and h or nil, d = d ~= 0 and d or nil, @@ -487,9 +486,9 @@ scanners.parpos = function() -- todo: relate to localpar (so this is an intermed r = true, x = true, y = true, - h = getfield(strutbox,"height"), - d = getfield(strutbox,"depth"), - hs = texget("hsize"), + h = getfield(strutbox,"height"), -- never 0 + d = getfield(strutbox,"depth"), -- never 0 + hs = texget("hsize"), -- never 0 } local leftskip = getfield(getskip("leftskip"),"width") local rightskip = getfield(getskip("rightskip"),"width") @@ -537,15 +536,18 @@ end scanners.dosetpositionwhd = function() -- name w h d extra local name = scanstring() + local w = scandimen() + local h = scandimen() + local d = scandimen() tobesaved[name] = { p = true, c = column, r = true, x = true, y = true, - w = scandimen(), - h = scandimen(), - d = scandimen(), + w = w ~= 0 and w or nil, + h = h ~= 0 and h or nil, + d = d ~= 0 and d or nil, n = nofparagraphs > 0 and nofparagraphs or nil, } -- context(new_latelua_node(f_enhance(name))) @@ -555,15 +557,18 @@ end scanners.dosetpositionbox = function() -- name box local name = scanstring() local box = getbox(scaninteger()) + local w = getfield(box,"width") + local h = getfield(box,"height") + local d = getfield(box,"depth") tobesaved[name] = { p = true, c = column, r = true, x = true, y = true, - w = getfield(box,"width"), - h = getfield(box,"height"), - d = getfield(box,"depth"), + w = w ~= 0 and w or nil, + h = h ~= 0 and h or nil, + d = d ~= 0 and d or nil, n = nofparagraphs > 0 and nofparagraphs or nil, } -- context(new_latelua_node(f_enhance(name))) @@ -572,15 +577,18 @@ end scanners.dosetpositionplus = function() -- name w h d extra local name = scanstring() + local w = scandimen() + local h = scandimen() + local d = scandimen() tobesaved[name] = { p = true, c = column, r = true, x = true, y = true, - w = scandimen(), - h = scandimen(), - d = scandimen(), + w = w ~= 0 and w or nil, + h = h ~= 0 and h or nil, + d = d ~= 0 and d or nil, n = nofparagraphs > 0 and nofparagraphs or nil, e = scanstring(), } @@ -591,14 +599,16 @@ end scanners.dosetpositionstrut = function() -- name local name = scanstring() local strutbox = getbox("strutbox") + local h = getfield(strutbox,"height") + local d = getfield(strutbox,"depth") tobesaved[name] = { p = true, c = column, r = true, x = true, y = true, - h = getfield(strutbox,"height"), - d = getfield(strutbox,"depth"), + h = h ~= 0 and h or nil, + d = d ~= 0 and d or nil, n = nofparagraphs > 0 and nofparagraphs or nil, } -- context(new_latelua_node(f_enhance(name))) diff --git a/tex/context/base/mkiv/anch-tab.mkiv b/tex/context/base/mkiv/anch-tab.mkiv index 7e0116cbf..0c84fd7b5 100644 --- a/tex/context/base/mkiv/anch-tab.mkiv +++ b/tex/context/base/mkiv/anch-tab.mkiv @@ -23,22 +23,26 @@ \unexpanded\def\tabl_tabulate_hook_b {\iftrialtypesetting\else \ifpositioning +\ifconditional\tablehaspositions \ifcase\c_tabl_tabulate_noflines % \ifnum\c_tabl_tabulate_noflines=\c_tabl_tabulate_totalnoflines \tabl_tabulate_hook_b_first \else \tabl_tabulate_hook_b_next \fi +\fi \fi \fi} \unexpanded\def\tabl_tabulate_hook_e {\iftrialtypesetting\else \ifpositioning +\ifconditional\tablehaspositions \ifcase\c_tabl_tabulate_noflines % \ifnum\c_tabl_tabulate_noflines=\c_tabl_tabulate_totalnoflines \tabl_tabulate_hook_e_first \else \tabl_tabulate_hook_e_next \fi +\fi \fi \fi} @@ -98,7 +102,7 @@ \firstargumentfalse \fi} -\def\anch_tables_XC [#1]{\anch_table_check_state\iffirstargument\anch_tables_indeed_XC [#1]\else\expandafter\fi\NC} +\def\anch_tables_XC [#1]{\anch_table_check_state\iffirstargument\anch_tables_indeed_XC [#1]\else\expandafter\NC\fi} \def\anch_tables_GSC[#1]{\anch_table_check_state\iffirstargument\anch_tables_indeed_GSC[#1]\else\expandafter\NC\fi} \def\anch_tables_GFC[#1]{\anch_table_check_state\iffirstargument\anch_tables_indeed_GFC[#1]\else\expandafter\NC\fi} \def\anch_tables_GTC[#1]{\anch_table_check_state\iffirstargument\anch_tables_indeed_GTC[#1]\else\expandafter\NC\fi} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index b62ba0717..8a4d05a05 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{2016.05.20 18:42} +\newcontextversion{2016.05.22 15:18} %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 b607e53dd..c2a0d9e43 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2016.05.20 18:42} +\edef\contextversion{2016.05.22 15:18} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua index 4f89d93fc..0e63247ea 100644 --- a/tex/context/base/mkiv/node-nut.lua +++ b/tex/context/base/mkiv/node-nut.lua @@ -94,6 +94,7 @@ local direct = node.direct local fastcopy = table.fastcopy local texget = tex.get +local texgetskip = tex.getskip local nodecodes = nodes.nodecodes local hlist_code = nodecodes.hlist @@ -151,7 +152,9 @@ nuts.setattr = direct.set_attribute or setfield nuts.getbox = direct.getbox nuts.setbox = direct.setbox -nuts.getskip = direct.getskip or function(s) return tonut(texget(s)) end +nuts.getskip = function(s) + return tonut(type(s) == "number" and texgetskip(s) or texget(s)) +end -- helpers diff --git a/tex/context/base/mkiv/page-mix.lua b/tex/context/base/mkiv/page-mix.lua index 7a3b4877d..2252d365d 100644 --- a/tex/context/base/mkiv/page-mix.lua +++ b/tex/context/base/mkiv/page-mix.lua @@ -8,6 +8,8 @@ if not modules then modules = { } end modules ["page-mix"] = { -- inserts.getname(name) +-- getfield(l,"head") -> getlist + -- local node, tex = node, tex -- local nodes, interfaces, utilities = nodes, interfaces, utilities -- local trackers, logs, storage = trackers, logs, storage @@ -42,6 +44,7 @@ local vpack = nuts.vpack local freenode = nuts.free local concatnodes = nuts.concat local slidenodes = nuts.slide -- ok here as we mess with prev links intermediately +local findtail = nuts.tail local getfield = nuts.getfield local setfield = nuts.setfield @@ -60,6 +63,8 @@ local getbox = nuts.getbox local getskip = nuts.getskip local getattribute = nuts.getattribute +local texgetskip = tex.getskip + local theprop = nuts.theprop local nodepool = nuts.pool @@ -104,9 +109,14 @@ local function collectinserts(result,nxt,nxtid) local inserts, currentskips, nextskips, inserttotal = { }, 0, 0, 0 while nxt do if nxtid == insert_code then - inserttotal = inserttotal + getfield(nxt,"height") + getfield(nxt,"depth") + inserttotal = inserttotal + + getfield(nxt,"height") + + getfield(nxt,"depth") local s = getsubtype(nxt) local c = inserts[s] + if trace_detail then + report_state("insert of class %s found",s) + end if not c then c = { } inserts[s] = c @@ -117,9 +127,6 @@ local function collectinserts(result,nxt,nxtid) nextskips = nextskips + width end c[#c+1] = nxt - if trace_detail then - report_state("insert of class %s found",s) - end elseif nxtid == mark_code then if trace_detail then report_state("mark found") @@ -333,8 +340,8 @@ local function preparesplit(specification) -- a rather large function if trace_state then report_state("backtracking over %s in column %s","glue",column) end - current = getprev(current) elseif id == penalty_code then + current = getprev(current) if trace_state then report_state("backtracking over %s in column %s","penalty",column) end @@ -480,15 +487,15 @@ local function preparesplit(specification) -- a rather large function end height = height + depth + skip depth = 0 -if advance < 0 then - height = height + advance - skip = 0 - if height < 0 then - height = 0 - end -else - skip = height > 0 and advance or 0 -end + if advance < 0 then + height = height + advance + skip = 0 + if height < 0 then + height = 0 + end + else + skip = height > 0 and advance or 0 + end if trace_state then report_state("%-7s > column %s, height %p, depth %p, skip %p","glue",column,height,depth,skip) end @@ -605,7 +612,7 @@ end local function process_list(current,nxt) local nxtid = nxt and getid(nxt) line = line + 1 - local inserts, currentskips, nextskips, inserttotal = nil, 0, 0, 0 + local inserts, insertskips, nextskips, inserttotal = nil, 0, 0, 0 local advance = getfield(current,"height") if trace_state then report_state("%-7s > column %s, content: %s","line",column,listtoutf(getlist(current),true,true)) @@ -613,7 +620,7 @@ end if nxt and (nxtid == insert_code or nxtid == mark_code) then nxt, inserts, localskips, insertskips, inserttotal = collectinserts(result,nxt,nxtid) end - local state, skipped = checked(advance+inserttotal+currentskips,"line",lastlocked) + local state, skipped = checked(advance+inserttotal+insertskips,"line",lastlocked) if trace_state then report_state("%-7s > column %s, state %a, line %s, advance %p, insert %p, height %p","line",column,state,line,advance,inserttotal,height) if skipped ~= 0 then @@ -623,28 +630,28 @@ end if state == "quit" then return true end --- if state == "next" then -- only when profile --- local unprofiled = theprop(current).unprofiled --- if unprofiled then --- local h = unprofiled.height --- local s = unprofiled.strutht --- local t = s/2 --- print("profiled",h,s) --- local snapped = theprop(current).snapped --- if snapped then --- inspect(snapped) --- end --- if h < s + t then --- result.back = - (h - s) --- advance = s --- end --- end --- end + -- if state == "next" then -- only when profile + -- local unprofiled = theprop(current).unprofiled + -- if unprofiled then + -- local h = unprofiled.height + -- local s = unprofiled.strutht + -- local t = s/2 + -- print("profiled",h,s) + -- local snapped = theprop(current).snapped + -- if snapped then + -- inspect(snapped) + -- end + -- if h < s + t then + -- result.back = - (h - s) + -- advance = s + -- end + -- end + -- end height = height + depth + skip + advance + inserttotal if state == "next" then height = height + nextskips else - height = height + currentskips + height = height + insertskips end depth = getfield(current,"depth") skip = 0 @@ -659,8 +666,6 @@ end lastcontent = current end -local kept = head - while current do local id = getid(current) @@ -944,8 +949,13 @@ local function getsplit(result,n) end for c, list in next, r.inserts do + local l = concatnodes(list) +for i=1,#list-1 do + setfield(list[i],"depth",0) +end local b = vpack(l) -- multiple arguments, todo: fastvpack + -- setbox("global",c,b) setbox(c,b) r.inserts[c] = nil diff --git a/tex/context/base/mkiv/page-mix.mkiv b/tex/context/base/mkiv/page-mix.mkiv index a8610deb8..7aaac5fd3 100644 --- a/tex/context/base/mkiv/page-mix.mkiv +++ b/tex/context/base/mkiv/page-mix.mkiv @@ -667,10 +667,11 @@ % maybe intercept empty \clf_mixgetsplit\recurselevel\relax \hskip-\d_page_mix_column_width - \page_mix_hbox to \d_page_mix_column_width \bgroup + \vbox \bgroup + \hsize\d_page_mix_column_width \placenoteinserts - \hss \egroup + \hss \egroup} \unexpanded\def\page_mix_routine_continue diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index ddb38919f..528062af9 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 90f58f8d4..d7c4635ae 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 fa6f77cd2..fcb1f5bd1 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 f42b96d9d..cf4df2f98 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 9c44911d0..9e7d88910 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 : 05/20/16 18:42:08 +-- merge date : 05/22/16 15:18:33 do -- begin closure to overcome local limits and interference -- cgit v1.2.3