summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-08-30 19:50:57 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2018-08-30 19:50:57 +0200
commit2106beefbc854f77a92264c815d3cf2b3460f0b6 (patch)
tree87e03bf8309b94bfad813eb755d7b0ab0d2717f5 /tex
parent5794d8b0c845aad2ab4cf36dc14201b21ef5a784 (diff)
downloadcontext-2106beefbc854f77a92264c815d3cf2b3460f0b6.tar.gz
2018-08-30 18:50:00
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/anch-pos.lua17
-rw-r--r--tex/context/base/mkiv/anch-pos.mkiv2
-rw-r--r--tex/context/base/mkiv/anch-snc.lua271
-rw-r--r--tex/context/base/mkiv/anch-snc.mkiv278
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-imp-quality.lua4
-rw-r--r--tex/context/base/mkiv/mlib-int.lua178
-rw-r--r--tex/context/base/mkiv/mlib-lua.lua165
-rw-r--r--tex/context/base/mkiv/pack-rul.mkiv55
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26302 -> 26301 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin267612 -> 267692 bytes
-rw-r--r--tex/context/base/mkiv/util-soc-imp-http.lua2
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin853699 -> 853853 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin61221 -> 61222 bytes
-rw-r--r--tex/context/modules/mkiv/s-evohome.mkiv16
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
19 files changed, 651 insertions, 347 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 364702cad..9fc06651d 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{2018.08.28 17:21}
+\newcontextversion{2018.08.30 18:41}
%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 956cd702b..d07e196e7 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{2018.08.28 17:21}
+\edef\contextversion{2018.08.30 18:41}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/anch-pos.lua b/tex/context/base/mkiv/anch-pos.lua
index 11883ba59..4767aa259 100644
--- a/tex/context/base/mkiv/anch-pos.lua
+++ b/tex/context/base/mkiv/anch-pos.lua
@@ -535,6 +535,8 @@ end
jobpositions.b_region = b_region
jobpositions.e_region = e_region
+local lastregion
+
local function setregionbox(n,tag,k,lo,ro,to,bo) -- kind
if not tag or tag == "" then
nofregions = nofregions + 1
@@ -556,6 +558,7 @@ local function setregionbox(n,tag,k,lo,ro,to,bo) -- kind
to = to ~= 0 and to or nil,
bo = bo ~= 0 and bo or nil,
}
+ lastregion = tag
return tag, box
end
@@ -566,10 +569,11 @@ local function markregionbox(n,tag,correct,...) -- correct needs checking
local pop = new_latelua(function() e_region(correct) end)
-- maybe we should construct a hbox first (needs experimenting) so that we can avoid some at the tex end
local head = getlist(box)
- if getid(box) ~= hlist_code then
- -- report("mark region box assumes a hlist, fix this for %a",tag)
- head = hpack(head)
- end
+ -- no, this fails with \framed[region=...] .. needs thinking
+ -- if getid(box) ~= hlist_code then
+ -- -- report("mark region box assumes a hlist, fix this for %a",tag)
+ -- head = hpack(head)
+ -- end
if head then
local tail = find_tail(head)
setlink(push,head)
@@ -1398,6 +1402,11 @@ scanners.markregionboxtaggedkind = function() -- box tag kind
scaninteger(),scandimen(),scandimen(),scandimen(),scandimen())
end
+scanners.reservedautoregiontag = function()
+ nofregions = nofregions + 1
+ context(f_region(nofregions))
+end
+
-- statistics (at least for the moment, when testing)
-- statistics.register("positions", function()
diff --git a/tex/context/base/mkiv/anch-pos.mkiv b/tex/context/base/mkiv/anch-pos.mkiv
index dd24bdb08..fbebb5f17 100644
--- a/tex/context/base/mkiv/anch-pos.mkiv
+++ b/tex/context/base/mkiv/anch-pos.mkiv
@@ -330,6 +330,8 @@
#6\relax % bottomoffset
\fi}
+\def\reservedautoregiontag{\clf_reservedautoregiontag}
+
%D We can copy a position with:
%D
%D \starttyping
diff --git a/tex/context/base/mkiv/anch-snc.lua b/tex/context/base/mkiv/anch-snc.lua
new file mode 100644
index 000000000..8006f3bd6
--- /dev/null
+++ b/tex/context/base/mkiv/anch-snc.lua
@@ -0,0 +1,271 @@
+if not modules then modules = { } end modules ['anch-snc'] = {
+ version = 1.001,
+ comment = "companion to anch-snc.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+
+function mp.xxOverlayRegion()
+ local r = tokens.getters.macro("m_overlay_region")
+ mp.quoted('"'.. r .. '"')
+-- mp.print('"'.. r .. '"')
+end
+
+-- use factors as in mlib-int.lua
+
+local tonumber, next, setmetatable = tonumber, next, setmetatable
+local concat, sort, remove, copy = table.concat, table.sort, table.remove, table.copy
+local match, find = string.match, string.find
+local lpegmatch = lpeg.match
+
+local setmetatableindex = table.setmetatableindex
+
+local factor = number.dimenfactors.bp
+local mpprint = mp.print
+local mpnumeric = mp.numeric
+local mppoints = mp.points
+local texgetdimen = tex.getdimen
+
+local p_number = lpeg.patterns.cardinal/tonumber
+local p_space = lpeg.patterns.whitespace^0
+local p_tag = lpeg.P("syncpos:") * p_number * lpeg.P(":") * p_number
+local p_option = p_number -- for now
+ * ((lpeg.P(",") * p_space * lpeg.P("reset") * lpeg.Cc(true)) + lpeg.Cc(false))
+
+local list = { }
+local colors = setmetatableindex("table")
+
+local kinds = {
+ above = 1,
+ continue = 2,
+ nothing = 3,
+ normal = 4,
+ below = 5,
+}
+
+local allentries = setmetatableindex(function(t,category)
+ setmetatable(t,nil)
+ for tag, pos in next, job.positions.collected do
+ local c, n = lpegmatch(p_tag,tag)
+ if c then
+ local tc = t[c]
+ if tc then
+ tc[n] = pos
+ else
+ t[c] = { [n] = pos }
+ end
+ end
+ end
+ for k, list in next, t do
+ sort(list,function(a,b)
+ local ap = a.p
+ local bp = b.p
+ if ap == bp then
+ return b.y < a.y
+ else
+ return ap < bp
+ end
+ end)
+ list.start = 1
+ end
+ setmetatableindex(t,"table")
+ return t[category]
+end)
+
+local lastdone = { }
+
+function mp.sync_collect(category,realpage,useregion)
+ local all = allentries[category]
+ local m = 0
+ local n = #all
+ list = { }
+ if useregion then
+ -- successive can be optimized when we sort by region
+ local start = 1
+ local done = false
+ local last, rtop, rbot
+ for i=start,n do
+ local pos = all[i]
+ local p = pos.p
+ local r = pos.r
+ if r == useregion then
+ if not done then
+ local region = job.positions.collected[r]
+ list.region = region
+ list.page = region
+ rtop = (region.y or 0) + (region.h or 0)
+ rbot = (region.y or 0) - (region.d or 0)
+ last = { kind = "nothing", top = rtop, bottom = 0, task = 0 }
+ m = m + 1 ; list[m] = last
+ done = true
+ end
+ local top = pos.y + pos.h
+ last.bottom = top
+ local task, reset = lpegmatch(p_option,pos.e)
+ last = { kind = "normal", top = top, bottom = 0, task = task }
+ m = m + 1 ; list[m] = last
+ end
+ end
+ if done then
+ last.bottom = rbot
+ end
+ else
+ local start = all.start or 1
+ local done = false
+ local last, rtop, rbot, ptop, pbot
+ for i=start,n do
+ local pos = all[i]
+ local p = pos.p
+ if p == realpage then
+ if not done then
+ local region = job.positions.collected[pos.r]
+ local page = job.positions.collected["page:"..realpage] or region
+ list.region = region
+ list.page = page
+ rtop = (region.y or 0) + (region.h or 0)
+ rbot = (region.y or 0) - (region.d or 0)
+ ptop = (page .y or 0) + (page .h or 0)
+ pbot = (page .y or 0) - (page .d or 0)
+ last = { kind = "above", top = ptop, bottom = rtop, task = 0 }
+ m = m + 1 ; list[m] = last
+ if i > 1 then
+ local task, reset = lpegmatch(p_option,all[i-1].e)
+ last = { kind = "continue", top = rtop, bottom = 0, task = task }
+ m = m + 1 ; list[m] = last
+ else
+ last = { kind = "nothing", top = rtop, bottom = 0, task = 0 }
+ m = m + 1 ; list[m] = last
+ end
+ done = true
+ end
+ local top = pos.y + pos.h
+ last.bottom = top
+ local task, reset = lpegmatch(p_option,pos.e)
+ if reset then
+ local l = list[2]
+ l.kind = "nothing"
+ l.task = 0
+ end
+ last = { kind = "normal", top = top, bottom = 0, task = task }
+ m = m + 1 ; list[m] = last
+ elseif p > realpage then
+ all.start = i -- tricky, only for page
+ break
+ end
+ end
+ if done then
+ last.bottom = rbot
+ last = { kind = "below", top = rbot, bottom = pbot, task = 0 }
+ m = m + 1 ; list[m] = last
+ lastdone[category] = {
+ { kind = "above", top = ptop, bottom = rtop, task = 0 },
+ { kind = "continue", top = rtop, bottom = rbot, task = list[#list-1].task }, -- lasttask
+ { kind = "below", top = rbot, bottom = pbot, task = 0 },
+ region = list.region,
+ page = list.page,
+ }
+ else
+ local l = lastdone[category]
+ if l then
+ list = copy(l) -- inefficient, mayb emetatable for region/page
+ m = 3
+ end
+ end
+ end
+ mpnumeric(m)
+end
+
+function mp.sync_extend()
+ local n = #list
+ if n > 0 then
+ for i=1,n do
+ local l = list[i]
+ local k = l.kind
+ if k == "nothing" then
+ local ll = list[i+1]
+ if ll and ll.kind == "normal" then
+ ll.top = l.top
+ remove(list,i)
+ n = #list
+ break
+ end
+ end
+ end
+ end
+ mpnumeric(n)
+end
+
+function mp.sync_prune()
+ local n = #list
+ if n > 0 then
+ if list[1].kind == "above" then
+ remove(list,1)
+ end
+ if list[1].kind == "nothing" then
+ remove(list,1)
+ end
+ if list[#list].kind == "below" then
+ remove(list,#list)
+ end
+ n = #list
+ end
+ mpnumeric(n)
+end
+
+function mp.sync_collapse()
+ local n = #list
+ if n > 0 then
+ local m = 0
+ local p = nil
+ for i=1,n do
+ local l = list[i]
+ local t = l.task
+ if p == t then
+ list[m].bottom = l.bottom
+ else
+ m = m + 1
+ list[m] = l
+ end
+ p = t
+ end
+ for i=n,m+1,-1 do
+ list[i] = nil
+ end
+ n = m
+ end
+ mpnumeric(n)
+end
+
+function mp.sync_set_color(category,n,v)
+ colors[category][n] = v
+end
+
+function mp.sync_get_color(category,n)
+ mpprint(colors[category][n])
+end
+
+-- function mp.sync_get_size () mpnumeric(#list) end
+-- function mp.sync_get_top (n) mppoints (list[n].top) end
+-- function mp.sync_get_bottom(n) mppoints (list[n].bottom) end
+-- function mp.sync_get_kind (n) mpnumeric(kinds[list[n].kind]) end
+-- function mp.sync_get_task (n) mpnumeric(list[n].task) end
+
+-- function mp.sync_get_x() mppoints(list.page.x or 0) end
+-- function mp.sync_get_y() mppoints(list.page.y or 0) end
+-- function mp.sync_get_w() mppoints(list.page.w or 0) end
+-- function mp.sync_get_h() mppoints(list.page.h or 0) end
+-- function mp.sync_get_d() mppoints(list.page.d or 0) end
+
+function mp.sync_get_size () mpnumeric(#list) end
+function mp.sync_get_top (n) mpnumeric(list[n].top * factor) end
+function mp.sync_get_bottom(n) mpnumeric(list[n].bottom * factor) end
+function mp.sync_get_kind (n) mpnumeric(kinds[list[n].kind]) end
+function mp.sync_get_task (n) mpnumeric(list[n].task) end
+
+function mp.sync_get_x() mpnumeric((list.page.x or 0)*factor) end
+function mp.sync_get_y() mpnumeric((list.page.y or 0)*factor) end
+function mp.sync_get_w() mpnumeric((list.page.w or 0)*factor) end
+function mp.sync_get_h() mpnumeric((list.page.h or 0)*factor) end
+function mp.sync_get_d() mpnumeric((list.page.d or 0)*factor) end
diff --git a/tex/context/base/mkiv/anch-snc.mkiv b/tex/context/base/mkiv/anch-snc.mkiv
index fd6179bc4..5f0246155 100644
--- a/tex/context/base/mkiv/anch-snc.mkiv
+++ b/tex/context/base/mkiv/anch-snc.mkiv
@@ -1,6 +1,6 @@
%D \module
%D [ file=anch-snc,
-%D version=2003.12.01,
+%D version=2003.12.01, % actually 1999 so real old
%D title=\CONTEXT\ Anchoring Macros,
%D subtitle=Synchronization,
%D author=Hans Hagen,
@@ -11,152 +11,42 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-% this can be optimized (will do when used again)
+%D The original is in the mkii file. It does more at the \TEX\ end and
+%D has some more magic. If we really need that I'll add it. After all,
+%D in mkiv we can do things different.
+
+%D TODO: bleed : + left , minus right oro check if it touches page ... autobleed
\writestatus{loading}{ConTeXt Anchoring Macros / Synchronization}
+\registerctxluafile{anch-snc}{}
+
\unprotect
-\ifx\s!num \undefined \def\s!num {num} \fi
-\ifx\s!set \undefined \def\s!set {set} \fi
-\ifx\s!reset \undefined \def\s!reset {reset} \fi
-\ifx\s!preset \undefined \def\s!preset {preset} \fi
-\ifx\s!syncpos\undefined \def\s!syncpos{syncpos} \fi
+\ifx\??syncposcounter\undefined \installcorenamespace{syncposcounter} \fi
+\ifx\s!syncpos \undefined \def\s!syncpos {syncpos} \fi
+
+\let\c_sync_n\relax
\unexpanded\def\definesyncpositions[#1]%
- {\ifcsname\s!num:\s!syncpos:#1\endcsname \else
- \glet\flushsyncpositions\doflushsyncpositions % only when used
- \glet\flushsyncresets \doflushsyncresets
- \glet\flushsyncpresets \doflushsyncpresets
- \expandafter\newcount\csname\s!num:\s!syncpos:#1\endcsname
- \doglobal\appendtoksonce\csname\s!reset :\s!syncpos:#1\endcsname\to\resetsyncpositions
- \doglobal\appendtoksonce\csname\s!preset:\s!syncpos:#1\endcsname\to\presetsyncpositions
-% to be tested:
-% \doglobal\expandafter\appendtoksonce\csname\s!reset :\s!syncpos:#1\endcsname\to\resetsyncpositions
-% \doglobal\expandafter\appendtoksonce\csname\s!preset:\s!syncpos:#1\endcsname\to\presetsyncpositions
- \setgvalue{\s!syncpos:#1}{sync_n[#1] := 0 ;}%
- \setgvalue{\s!set:\s!syncpos:#1}{\dosetsyncpositions{#1}}%
+ {\ifcsname\??syncposcounter:#1\endcsname \else
+ \expandafter\newcount\csname\??syncposcounter:#1\endcsname
\fi}
-\def\syncposition
- {\dodoubleempty\dosyncposition}
-
-\def\dosyncposition[#1][#2]%
- {\letgvalue{\s!reset :\s!syncpos:#1}\relax
- \letgvalue{\s!preset:\s!syncpos:#1}\relax
- \dontleavehmode
- \dodosyncposition{#1}{#2}\s!set
- \ignorespaces}
-
-\def\doifelselastsyncposition#1#2%
- {\doifelse{\lastsyncclass\lastsyncposition}{#1#2}}
-
-\let\doiflastsyncpositionelse\doifelselastsyncposition
+\unexpanded\def\syncposition
+ {\dodoubleempty\anch_sync_position}
-\def\dodosyncposition#1#2#3%
- {\letgvalue{\s!reset:\s!syncpos:#1}\relax
- \letgvalue{\s!preset:\s!syncpos:#1}\relax
- \ifcsname\s!syncpos:#1\endcsname
- \global\advance\csname\s!num:\s!syncpos:#1\endcsname\plusone
- \setsyncpositions{#1}%
- % option: geen w/h, alleen p 0 0 0 data
- \setpositionplus{\s!syncpos:#1:\the\csname\s!num:\s!syncpos:#1\endcsname}{#2}\hpack{\strut}%
+\def\anch_sync_position[#1][#2]% we could actually use par positions
+ {\dontleavehmode
+ \ifcsname\??syncposcounter:#1\endcsname
+ \let\c_sync_n\lastnamedcs
+ \global\advance\c_sync_n\plusone
+ \enabletextarearegistration
+ \setpositionplus{\s!syncpos:#1:\the\c_sync_n}{#2}\hpack{\strut}%
\else
\strut
- \fi}
-
-\def\setsyncpositions#1%
- {\enabletextarearegistration
- \getvalue {\s!set:\s!syncpos:#1}%
- \letgvalue{\s!set:\s!syncpos:#1}\relax}
-
-\def\dosetsyncpositions#1%
- {\startnointerference % removing out of sync can best be done in mp
- \scratchdimenone\maxdimen
- \scratchcounterone\zerocount
- \scratchcounterthree\zerocount
- \doloop
- {\doifelseposition{\s!syncpos:#1:\recurselevel}
- {\scratchdimentwo\MPy{\s!syncpos:#1:\recurselevel}\relax
- \scratchcountertwo\MPp{\s!syncpos:#1:\recurselevel}\relax
- \ifnum\scratchcountertwo=\scratchcounterone % same page
- \ifdim\scratchdimentwo>\scratchdimenone
- \donefalse % out of order nodes
- \else
- \donetrue % nodes in order
- \fi
- \else
- \donetrue % different page
- \fi
- \ifdone
- \scratchcounterone\scratchcountertwo
- \scratchdimenone\scratchdimentwo
- \advance\scratchcounterthree\plusone
- \edef\!!stringa{[#1][\the\scratchcounterthree]:=}%
- \edef\!!stringc{\s!syncpos:#1:\the\scratchcounterthree}%
- \edef\!!stringd{\MPplus\!!stringc{1}{0}}%
- \setxvalue{\s!syncpos:#1}%
- {\getsyncpositions{#1}%
- sync_p \!!stringa \MPp \!!stringc ;
- sync_xy\!!stringa \MPxy\!!stringc ;
- sync_w \!!stringa \MPw \!!stringc ;
- sync_h \!!stringa \MPh \!!stringc ;
- sync_d \!!stringa \MPd \!!stringc ;
- \ifx\!!stringd\empty \else
- sync_t \!!stringa \!!stringd;
- \fi}%
- \fi}
- {\setxvalue{\s!syncpos:#1}%
- {\getsyncpositions{#1}%
- sync_n[#1] := \the\scratchcounterthree ;}
- \exitloop}}%
- \stopnointerference}
-
-\def\getsyncpositions#1%
- {\getvalue{\s!syncpos:#1}}
-
-\newtoks\resetsyncpositions
-\newtoks\presetsyncpositions
-
-\def\resyncposition {\dodoubleargument\doresyncposition}
-\def\presyncposition{\dodoubleargument\dopresyncposition}
-
-\def\dodoresyncposition #1#2{\dodosyncposition{#1}{#2}\s!reset}
-\def\dodopresyncposition#1#2{\dodosyncposition{#1}{#2}\s!preset}
-
-\def\doresyncposition [#1][#2]{\setxvalue{\s!reset :\s!syncpos:#1}{\noexpand\dodoresyncposition{#1}{#2}}}
-\def\dopresyncposition[#1][#2]{\setxvalue{\s!preset:\s!syncpos:#1}{\noexpand\dodopresyncposition{#1}{#2}}}
-
-\let\flushsyncpositions\relax
-
-\def\doflushsyncpositions % this order !
- {\begingroup
- \the\presetsyncpositions
- \the\resetsyncpositions
- \endgroup}
-
-\def\flushsyncxxsets#1%
- {\begingroup
- \setbox\scratchbox\hbox{\the#1}%
- \ifvoid\scratchbox\else
- \prewordbreak
- \smashbox\scratchbox
- \box\scratchbox
\fi
- \endgroup}
-
-\let\flushsyncresets \relax
-\let\flushsyncpresets\relax
-
-\def\doflushsyncresets {\flushsyncxxsets\resetsyncpositions }
-\def\doflushsyncpresets{\flushsyncxxsets\presetsyncpositions}
-
-% \appendtoks \flushsyncpositions \to \everypar
-% \appendtoks \flushsyncpositions \to \everyheadstart
-
-% \explicitneverypar -> in grid snapper, eerst testen
-%
-% \appendtoks \flushsyncpositions \to \neverypar
+ \ignorespaces}
\protect
@@ -171,47 +61,99 @@
\setupbodyfont[dejavu]
\definesyncpositions[1]
+\definesyncpositions[2]
+
+% \enabletrackers[metapost.lua]
+
+\startMPdefinitions
+ input "mp-asnc.mpiv" ;
+
+ SetSyncColor(1,0,"magenta") ;
+ SetSyncColor(1,1,"red") ;
+ SetSyncColor(1,2,"green") ;
+ SetSyncColor(1,3,"blue") ;
+ SetSyncColor(1,4,"yellow") ;
+
+ SetSyncColor(2,0,"magenta") ;
+ SetSyncColor(2,1,"red") ;
+ SetSyncColor(2,2,"green") ;
+ SetSyncColor(2,3,"blue") ;
+ SetSyncColor(2,4,"yellow") ;
+\stopMPdefinitions
+
+\startuseMPgraphic{sync1}
+ StartPage ;
+ StartSync(1) ;
+ SyncHOffset := 0 ;
+ SyncWidth := BackSpace - LeftMarginDistance;
+ CollectSyncDataPage ;
+ % ExtendSyncPaths ; % to top of text area
+ PruneSyncPaths ; % clip top / bottom
+ CollapseSyncPaths ;
+ MakeSyncPaths ;
+ % DrawSyncPaths ;
+ FillSyncPaths ;
+ StopSync ;
+ clip currentpicture to Page ;
+ setbounds currentpicture to Page ;
+ StopPage ;
+\stopuseMPgraphic
-\startMPinclusions
-% input "mp-core.mpiv";
- input "mp-asnc.mpiv";
-\stopMPinclusions
-
-\startuseMPgraphic{sync}
- StartPage ;
-vardef PlainTextArea = Field[Text][Text] enddef ;
- \getsyncpositions{1} ;
- SyncThreshold := 2LineHeight ;
- SyncLeftOffset := -.5LeftMarginDistance ;
- SetSyncThreshold(1,3,3LineHeight) ;
- SyncWidth := - (BackSpace + SyncLeftOffset) ;
- SetSyncColor(1,1,\MPcolor{red}) ;
- SetSyncColor(1,2,\MPcolor{green}) ;
- SetSyncColor(1,3,\MPcolor{blue}) ;
- SetSyncColor(1,4,\MPcolor{yellow}) ;
- PrepareSyncTasks(1,true,true,false) ;
-% PrepareSyncTasks(1,true,true,true) ;
- for i = 1 upto NOfSyncPaths :
- fill SyncPaths[i]
- withcolor TheSyncColor(CurrentSyncClass,sync_t[CurrentSyncClass][SyncTasks[i]]) ;
- endfor ;
- clip
- currentpicture to Page ;
- setbounds currentpicture to Page ;
- StopPage ;
+\startuseMPgraphic{sync2}
+ StartSync(2) ;
+ SyncHOffset := -1cm ;
+ SyncWidth := 1cm ;
+ CollectSyncDataRegion(OverlayRegion) ;
+ ExtendSyncPaths ; % to top of text area
+ MakeSyncPaths ;
+ FillSyncPaths ;
+ StopSync ;
+ clip currentpicture to OverlayBox leftenlarged 1cm;
+ setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic
-\defineoverlay[tempoverlay][\useMPgraphic{sync}]
+\defineoverlay[tempoverlay1][\useMPgraphic{sync1}]
+\defineoverlay[tempoverlay2][\useMPgraphic{sync2}]
-\setupbackgrounds[page][background=tempoverlay]
+\setupbackgrounds[page][background=tempoverlay1]
+
+\framed[region=yes,background=tempoverlay2,width=14cm,align=normal]{
+ \syncposition[2][1]\samplefile{ward}\endgraf
+ \syncposition[2][2]\samplefile{ward}\endgraf
+ \syncposition[2][3]\samplefile{ward}\endgraf
+}
+
+
+\vskip1cm \hskip1cm \framed[region=yes,background=tempoverlay2,width=16cm,align=normal]{
+ \syncposition[2][1]\samplefile{ward}\endgraf
+ \syncposition[2][2]\samplefile{ward}\endgraf
+ \syncposition[2][3]\samplefile{ward}\endgraf
+}
-\dorecurse {10} {
+\vskip1cm \hskip1cm \framed[region=yes,background=tempoverlay2,width=10cm,align=normal]{
+ \syncposition[2][1]\samplefile{ward}\endgraf
+ \syncposition[2][2]\samplefile{ward}\endgraf
+ \syncposition[2][3]\samplefile{ward}\endgraf
+}
+
+
+\dorecurse {100} {
+% \dorecurse {1} {
+ \startchapter[title={Test #1}]
+ \syncposition[1][1,reset]\dorecurse{20}{\samplefile{ward}\endgraf}
+ \syncposition[1][2]\dorecurse {4}{\samplefile{ward}\endgraf}
+ \syncposition[1][3]\dorecurse {7}{\samplefile{ward}\endgraf}
+ \syncposition[1][4]\dorecurse {3}{\samplefile{ward}\endgraf}
+ \stopchapter
+}
+\dorecurse {100} {
+% \dorecurse {1} {
\startchapter[title={Test #1}]
- \syncposition[1][1] \dorecurse{10}{\samplefile{ward}\endgraf}
- \syncposition[1][2] \dorecurse {4}{\samplefile{ward}\endgraf}
- \syncposition[1][3] \dorecurse {7}{\samplefile{ward}\endgraf}
- \syncposition[1][4] \dorecurse {3}{\samplefile{ward}\endgraf}
+ \syncposition[1][1]\dorecurse{1}{\samplefile{ward}\endgraf}
+ \syncposition[1][2]\dorecurse{1}{\samplefile{ward}\endgraf}
+ \syncposition[1][3]\dorecurse{1}{\samplefile{ward}\endgraf}
+ \syncposition[1][4]\dorecurse{1}{\samplefile{ward}\endgraf}
\stopchapter
}
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 9c6151011..ae85906d2 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{2018.08.28 17:21}
+\newcontextversion{2018.08.30 18:41}
%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 ea4327a95..51a644104 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -42,7 +42,7 @@
%D has to match \type {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.08.28 17:21}
+\edef\contextversion{2018.08.30 18:41}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-imp-quality.lua b/tex/context/base/mkiv/font-imp-quality.lua
index dc063f28a..8da011cd7 100644
--- a/tex/context/base/mkiv/font-imp-quality.lua
+++ b/tex/context/base/mkiv/font-imp-quality.lua
@@ -212,9 +212,9 @@ vectors['pure'] = {
vectors['punctuation'] = {
[0x003F] = { 0, 0.20 }, -- ?
- [0x00BF] = { 0, 0.20 }, -- ¿
+ [0x00BF] = { 0.20, 0 }, -- ¿
[0x0021] = { 0, 0.20 }, -- !
- [0x00A1] = { 0, 0.20 }, -- ¡
+ [0x00A1] = { 0.20, 0, }, -- ¡
[0x0028] = { 0.05, 0 }, -- (
[0x0029] = { 0, 0.05 }, -- )
[0x005B] = { 0.05, 0 }, -- [
diff --git a/tex/context/base/mkiv/mlib-int.lua b/tex/context/base/mkiv/mlib-int.lua
index 5abc49a52..63e7278da 100644
--- a/tex/context/base/mkiv/mlib-int.lua
+++ b/tex/context/base/mkiv/mlib-int.lua
@@ -7,11 +7,14 @@ if not modules then modules = { } end modules ['mlib-int'] = {
}
local factor = number.dimenfactors.bp
-local mpprint = mp.print
------ mpboolean = mp.boolean
------ mpquoted = mp.quoted
+----- mpprint = mp.print
+local mpnumeric = mp.numeric
+local mpboolean = mp.boolean
+local mpstring = mp.string
+local mpquoted = mp.quoted
local getdimen = tex.getdimen
local getcount = tex.getcount
+local getmacro = tokens.getters.macro
local get = tex.get
local mpcolor = attributes.colors.mpcolor
local emwidths = fonts.hashes.emwidths
@@ -19,79 +22,79 @@ local exheights = fonts.hashes.exheights
local mpgetdimen = mp.getdimen
-function mp.PaperHeight () mpprint(getdimen("paperheight") *factor) end
-function mp.PaperWidth () mpprint(getdimen("paperwidth") *factor) end
-function mp.PrintPaperHeight () mpprint(getdimen("printpaperheight") *factor) end
-function mp.PrintPaperWidth () mpprint(getdimen("printpaperwidth") *factor) end
-function mp.TopSpace () mpprint(getdimen("topspace") *factor) end
-function mp.BottomSpace () mpprint(getdimen("bottomspace") *factor) end
-function mp.BackSpace () mpprint(getdimen("backspace") *factor) end
-function mp.CutSpace () mpprint(getdimen("cutspace") *factor) end
-function mp.MakeupHeight () mpprint(getdimen("makeupheight") *factor) end
-function mp.MakeupWidth () mpprint(getdimen("makeupwidth") *factor) end
-function mp.TopHeight () mpprint(getdimen("topheight") *factor) end
-function mp.TopDistance () mpprint(getdimen("topdistance") *factor) end
-function mp.HeaderHeight () mpprint(getdimen("headerheight") *factor) end
-function mp.HeaderDistance () mpprint(getdimen("headerdistance") *factor) end
-function mp.TextHeight () mpprint(getdimen("textheight") *factor) end
-function mp.FooterDistance () mpprint(getdimen("footerdistance") *factor) end
-function mp.FooterHeight () mpprint(getdimen("footerheight") *factor) end
-function mp.BottomDistance () mpprint(getdimen("bottomdistance") *factor) end
-function mp.BottomHeight () mpprint(getdimen("bottomheight") *factor) end
-function mp.LeftEdgeWidth () mpprint(getdimen("leftedgewidth") *factor) end
-function mp.LeftEdgeDistance () mpprint(getdimen("leftedgedistance") *factor) end
-function mp.LeftMarginWidth () mpprint(getdimen("leftmarginwidth") *factor) end
-function mp.LeftMarginDistance () mpprint(getdimen("leftmargindistance") *factor) end
-function mp.TextWidth () mpprint(getdimen("textwidth") *factor) end
-function mp.RightMarginDistance () mpprint(getdimen("rightmargindistance") *factor) end
-function mp.RightMarginWidth () mpprint(getdimen("rightmarginwidth") *factor) end
-function mp.RightEdgeDistance () mpprint(getdimen("rightedgedistance") *factor) end
-function mp.RightEdgeWidth () mpprint(getdimen("rightedgewidth") *factor) end
-function mp.InnerMarginDistance () mpprint(getdimen("innermargindistance") *factor) end
-function mp.InnerMarginWidth () mpprint(getdimen("innermarginwidth") *factor) end
-function mp.OuterMarginDistance () mpprint(getdimen("outermargindistance") *factor) end
-function mp.OuterMarginWidth () mpprint(getdimen("outermarginwidth") *factor) end
-function mp.InnerEdgeDistance () mpprint(getdimen("inneredgedistance") *factor) end
-function mp.InnerEdgeWidth () mpprint(getdimen("inneredgewidth") *factor) end
-function mp.OuterEdgeDistance () mpprint(getdimen("outeredgedistance") *factor) end
-function mp.OuterEdgeWidth () mpprint(getdimen("outeredgewidth") *factor) end
-function mp.PageOffset () mpprint(getdimen("pagebackgroundoffset")*factor) end
-function mp.PageDepth () mpprint(getdimen("pagebackgrounddepth") *factor) end
-function mp.LayoutColumns () mpprint(getcount("layoutcolumns")) end
-function mp.LayoutColumnDistance() mpprint(getdimen("layoutcolumndistance")*factor) end
-function mp.LayoutColumnWidth () mpprint(getdimen("layoutcolumnwidth") *factor) end
-function mp.SpineWidth () mpprint(getdimen("spinewidth") *factor) end
-function mp.PaperBleed () mpprint(getdimen("paperbleed") *factor) end
-
-function mp.RealPageNumber () mpprint(getcount("realpageno")) end
-function mp.LastPageNumber () mpprint(getcount("lastpageno")) end
-
-function mp.PageNumber () mpprint(getcount("pageno")) end
-function mp.NOfPages () mpprint(getcount("lastpageno")) end
-
-function mp.SubPageNumber () mpprint(getcount("subpageno")) end
-function mp.NOfSubPages () mpprint(getcount("lastsubpageno")) end
-
-function mp.CurrentColumn () mpprint(getcount("mofcolumns")) end
-function mp.NOfColumns () mpprint(getcount("nofcolumns")) end
-
-function mp.BaseLineSkip () mpprint(get ("baselineskip",true) *factor) end
-function mp.LineHeight () mpprint(getdimen("lineheight") *factor) end
-function mp.BodyFontSize () mpprint(getdimen("bodyfontsize") *factor) end
-
-function mp.TopSkip () mpprint(get ("topskip",true) *factor) end
-function mp.StrutHeight () mpprint(getdimen("strutht") *factor) end
-function mp.StrutDepth () mpprint(getdimen("strutdp") *factor) end
-
-function mp.PageNumber () mpprint(getcount("pageno")) end
-function mp.RealPageNumber () mpprint(getcount("realpageno")) end
-function mp.NOfPages () mpprint(getcount("lastpageno")) end
-
-function mp.CurrentWidth () mpprint(get ("hsize") *factor) end
-function mp.CurrentHeight () mpprint(get ("vsize") *factor) end
-
-function mp.EmWidth () mpprint(emwidths [false]*factor) end
-function mp.ExHeight () mpprint(exheights[false]*factor) end
+function mp.PaperHeight () mpnumeric(getdimen("paperheight") *factor) end
+function mp.PaperWidth () mpnumeric(getdimen("paperwidth") *factor) end
+function mp.PrintPaperHeight () mpnumeric(getdimen("printpaperheight") *factor) end
+function mp.PrintPaperWidth () mpnumeric(getdimen("printpaperwidth") *factor) end
+function mp.TopSpace () mpnumeric(getdimen("topspace") *factor) end
+function mp.BottomSpace () mpnumeric(getdimen("bottomspace") *factor) end
+function mp.BackSpace () mpnumeric(getdimen("backspace") *factor) end
+function mp.CutSpace () mpnumeric(getdimen("cutspace") *factor) end
+function mp.MakeupHeight () mpnumeric(getdimen("makeupheight") *factor) end
+function mp.MakeupWidth () mpnumeric(getdimen("makeupwidth") *factor) end
+function mp.TopHeight () mpnumeric(getdimen("topheight") *factor) end
+function mp.TopDistance () mpnumeric(getdimen("topdistance") *factor) end
+function mp.HeaderHeight () mpnumeric(getdimen("headerheight") *factor) end
+function mp.HeaderDistance () mpnumeric(getdimen("headerdistance") *factor) end
+function mp.TextHeight () mpnumeric(getdimen("textheight") *factor) end
+function mp.FooterDistance () mpnumeric(getdimen("footerdistance") *factor) end
+function mp.FooterHeight () mpnumeric(getdimen("footerheight") *factor) end
+function mp.BottomDistance () mpnumeric(getdimen("bottomdistance") *factor) end
+function mp.BottomHeight () mpnumeric(getdimen("bottomheight") *factor) end
+function mp.LeftEdgeWidth () mpnumeric(getdimen("leftedgewidth") *factor) end
+function mp.LeftEdgeDistance () mpnumeric(getdimen("leftedgedistance") *factor) end
+function mp.LeftMarginWidth () mpnumeric(getdimen("leftmarginwidth") *factor) end
+function mp.LeftMarginDistance () mpnumeric(getdimen("leftmargindistance") *factor) end
+function mp.TextWidth () mpnumeric(getdimen("textwidth") *factor) end
+function mp.RightMarginDistance () mpnumeric(getdimen("rightmargindistance") *factor) end
+function mp.RightMarginWidth () mpnumeric(getdimen("rightmarginwidth") *factor) end
+function mp.RightEdgeDistance () mpnumeric(getdimen("rightedgedistance") *factor) end
+function mp.RightEdgeWidth () mpnumeric(getdimen("rightedgewidth") *factor) end
+function mp.InnerMarginDistance () mpnumeric(getdimen("innermargindistance") *factor) end
+function mp.InnerMarginWidth () mpnumeric(getdimen("innermarginwidth") *factor) end
+function mp.OuterMarginDistance () mpnumeric(getdimen("outermargindistance") *factor) end
+function mp.OuterMarginWidth () mpnumeric(getdimen("outermarginwidth") *factor) end
+function mp.InnerEdgeDistance () mpnumeric(getdimen("inneredgedistance") *factor) end
+function mp.InnerEdgeWidth () mpnumeric(getdimen("inneredgewidth") *factor) end
+function mp.OuterEdgeDistance () mpnumeric(getdimen("outeredgedistance") *factor) end
+function mp.OuterEdgeWidth () mpnumeric(getdimen("outeredgewidth") *factor) end
+function mp.PageOffset () mpnumeric(getdimen("pagebackgroundoffset")*factor) end
+function mp.PageDepth () mpnumeric(getdimen("pagebackgrounddepth") *factor) end
+function mp.LayoutColumns () mpnumeric(getcount("layoutcolumns")) end
+function mp.LayoutColumnDistance() mpnumeric(getdimen("layoutcolumndistance")*factor) end
+function mp.LayoutColumnWidth () mpnumeric(getdimen("layoutcolumnwidth") *factor) end
+function mp.SpineWidth () mpnumeric(getdimen("spinewidth") *factor) end
+function mp.PaperBleed () mpnumeric(getdimen("paperbleed") *factor) end
+
+function mp.RealPageNumber () mpnumeric(getcount("realpageno")) end
+function mp.LastPageNumber () mpnumeric(getcount("lastpageno")) end
+
+function mp.PageNumber () mpnumeric(getcount("pageno")) end
+function mp.NOfPages () mpnumeric(getcount("lastpageno")) end
+
+function mp.SubPageNumber () mpnumeric(getcount("subpageno")) end
+function mp.NOfSubPages () mpnumeric(getcount("lastsubpageno")) end
+
+function mp.CurrentColumn () mpnumeric(getcount("mofcolumns")) end
+function mp.NOfColumns () mpnumeric(getcount("nofcolumns")) end
+
+function mp.BaseLineSkip () mpnumeric(get ("baselineskip",true) *factor) end
+function mp.LineHeight () mpnumeric(getdimen("lineheight") *factor) end
+function mp.BodyFontSize () mpnumeric(getdimen("bodyfontsize") *factor) end
+
+function mp.TopSkip () mpnumeric(get ("topskip",true) *factor) end
+function mp.StrutHeight () mpnumeric(getdimen("strutht") *factor) end
+function mp.StrutDepth () mpnumeric(getdimen("strutdp") *factor) end
+
+function mp.PageNumber () mpnumeric(getcount("pageno")) end
+function mp.RealPageNumber () mpnumeric(getcount("realpageno")) end
+function mp.NOfPages () mpnumeric(getcount("lastpageno")) end
+
+function mp.CurrentWidth () mpnumeric(get ("hsize") *factor) end
+function mp.CurrentHeight () mpnumeric(get ("vsize") *factor) end
+
+function mp.EmWidth () mpnumeric(emwidths [false]*factor) end
+function mp.ExHeight () mpnumeric(exheights[false]*factor) end
mp.HSize = mp.CurrentWidth
mp.VSize = mp.CurrentHeight
@@ -100,9 +103,9 @@ mp.LastPageNumber = mp.NOfPages
function mp.PageFraction()
local lastpage = getcount("lastpageno")
if lastpage > 1 then
- mpprint((getcount("realpageno")-1)/(lastpage-1))
+ mpnumeric((getcount("realpageno")-1)/(lastpage-1))
else
- mpprint(1)
+ mpnumeric(1)
end
end
@@ -112,21 +115,22 @@ local on_right = structures.pages.on_right
local is_odd = structures.pages.is_odd
local in_body = structures.pages.in_body
-mp.OnRightPage = function() mpprint(on_right()) end -- needs checking
-mp.OnOddPage = function() mpprint(is_odd ()) end -- needs checking
-mp.InPageBody = function() mpprint(in_body ()) end -- needs checking
+mp.OnRightPage = function() mpboolean(on_right()) end -- needs checking
+mp.OnOddPage = function() mpboolean(is_odd ()) end -- needs checking
+mp.InPageBody = function() mpboolean(in_body ()) end -- needs checking
-- mp.CurrentLayout : \currentlayout
-function mp.OverlayWidth () mpprint(getdimen("d_overlay_width") *factor) end
-function mp.OverlayHeight () mpprint(getdimen("d_overlay_height") *factor) end
-function mp.OverlayDepth () mpprint(getdimen("d_overlay_depth") *factor) end
-function mp.OverlayLineWidth () mpprint(getdimen("d_overlay_linewidth")*factor) end
-function mp.OverlayOffset () mpprint(getdimen("d_overlay_offset") *factor) end
+function mp.OverlayWidth () mpnumeric(getdimen("d_overlay_width") * factor) end
+function mp.OverlayHeight () mpnumeric(getdimen("d_overlay_height") * factor) end
+function mp.OverlayDepth () mpnumeric(getdimen("d_overlay_depth") * factor) end
+function mp.OverlayLineWidth() mpnumeric(getdimen("d_overlay_linewidth") * factor) end
+function mp.OverlayOffset () mpnumeric(getdimen("d_overlay_offset") * factor) end
+function mp.OverlayRegion () mpstring(getmacro("m_overlay_region")) end
function mp.mf_default_color_model()
local colormethod = getcount("MPcolormethod")
- return mpprint((colormethod == 0 or colormethod == 1) and 1 or 3)
+ return mpnumeric((colormethod == 0 or colormethod == 1) and 1 or 3)
end
-- not much difference (10000 calls in a graphic neither as expansion seems to win
diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua
index 9a6a284d8..09169e155 100644
--- a/tex/context/base/mkiv/mlib-lua.lua
+++ b/tex/context/base/mkiv/mlib-lua.lua
@@ -148,53 +148,92 @@ do
mp.cleaned = function(s) return lpegmatch(p,s) or s end
- local function mpprint(...) -- we can optimize for n=1
- for i=1,select("#",...) do
- local value = select(i,...)
- if value ~= nil then
- n = n + 1
- local t = type(value)
- if t == "number" then
- buffer[n] = f_numeric(value)
- elseif t == "string" then
- buffer[n] = value
- elseif t == "table" then
- buffer[n] = "(" .. concat(value,",") .. ")"
- else -- boolean or whatever
- buffer[n] = tostring(value)
+ -- local function mpprint(...) -- we can optimize for n=1
+ -- for i=1,select("#",...) do
+ -- local value = (select(i,...))
+ -- if value ~= nil then
+ -- n = n + 1
+ -- local t = type(value)
+ -- if t == "number" then
+ -- buffer[n] = f_numeric(value)
+ -- elseif t == "string" then
+ -- buffer[n] = value
+ -- elseif t == "table" then
+ -- buffer[n] = "(" .. concat(value,",") .. ")"
+ -- else -- boolean or whatever
+ -- buffer[n] = tostring(value)
+ -- end
+ -- end
+ -- end
+ -- end
+
+ local function mpp(value)
+ n = n + 1
+ local t = type(value)
+ if t == "number" then
+ buffer[n] = f_numeric(value)
+ elseif t == "string" then
+ buffer[n] = value
+ elseif t == "table" then
+ buffer[n] = "(" .. concat(value,",") .. ")"
+ else -- boolean or whatever
+ buffer[n] = tostring(value)
+ end
+ end
+
+ local function mpprint(first,second,...)
+ if second == nil then
+ if first ~= nil then
+ mpp(first)
+ end
+ else
+ for i=1,select("#",first,second,...) do
+ local value = (select(i,first,second,...))
+ if value ~= nil then
+ mpp(value)
end
end
end
end
- local function mpvprint(...) -- variable print
- for i=1,select("#",...) do
- local value = select(i,...)
- if value ~= nil then
- n = n + 1
- local t = type(value)
- if t == "number" then
- buffer[n] = f_numeric(value)
- elseif t == "string" then
- buffer[n] = lpegmatch(p,value)
- elseif t == "table" then
- local m = #t
- if m == 2 then
- buffer[n] = f_pair(unpack(t))
- elseif m == 3 then
- buffer[n] = f_triplet(unpack(t))
- elseif m == 4 then
- buffer[n] = f_quadruple(unpack(t))
- else -- error
- buffer[n] = ""
- end
- else -- boolean or whatever
- buffer[n] = tostring(value)
+ local function mpp(value)
+ n = n + 1
+ local t = type(value)
+ if t == "number" then
+ buffer[n] = f_numeric(value)
+ elseif t == "string" then
+ buffer[n] = lpegmatch(p,value)
+ elseif t == "table" then
+ if #t > 4 then
+ buffer[n] = ""
+ else
+ buffer[n] = "(" .. concat(value,",") .. ")"
+ end
+ else -- boolean or whatever
+ buffer[n] = tostring(value)
+ end
+ end
+
+ local function mpvprint(first,second,...) -- variable print
+ if second == nil then
+ if first ~= nil then
+ mpp(first)
+ end
+ else
+ for i=1,select("#",first,second,...) do
+ local value = (select(i,first,second,...))
+ if value ~= nil then
+ mpp(value)
end
end
end
end
+ local function mpstring(value)
+ n = n + 1
+ buffer[n] = lpegmatch(p,value)
+ end
+
local function mpboolean(b)
n = n + 1
buffer[n] = b and "true" or "false"
@@ -202,7 +241,11 @@ do
local function mpnumeric(f)
n = n + 1
- buffer[n] = f and f_numeric(f) or "0"
+ if not f or f == 0 then
+ buffer[n] = "0"
+ else
+ buffer[n] = f_numeric(f)
+ end
end
local function mpinteger(i)
@@ -213,7 +256,11 @@ do
local function mppoints(i)
n = n + 1
- buffer[n] = i and f_points(i) or "0pt"
+ if not i or i == 0 then
+ buffer[n] = "0pt"
+ else
+ buffer[n] = f_points(i)
+ end
end
local function mppair(x,y)
@@ -366,14 +413,15 @@ do
end
local function mpquoted(fmt,s,...)
- n = n + 1
if s then
+ n = n + 1
if not find(fmt,"%",1,true) then
fmt = lpegmatch(replacer,fmt)
end
-- buffer[n] = '"' .. formatters[fmt](s,...) .. '"'
buffer[n] = lpegmatch(p,formatters[fmt](s,...))
elseif fmt then
+ n = n + 1
-- buffer[n] = '"' .. fmt .. '"'
buffer[n] = lpegmatch(p,fmt)
else
@@ -384,6 +432,7 @@ do
aux.print = mpprint
aux.vprint = mpvprint
aux.boolean = mpboolean
+ aux.string = mpstring
aux.numeric = mpnumeric
aux.number = mpnumeric
aux.integer = mpinteger
@@ -406,23 +455,9 @@ do
return runs
end
- -- there is no gain in:
- --
- -- local cache = table.makeweak()
- --
- -- f = cache[code]
- -- if not f then
- -- -- f = loadstring(f_code(code))
- -- f = loadstring(code .. " return mp._f_()")
- -- if f then
- -- cache[code] = f
- -- elseif be_tolerant then
- -- f = loadstring(code)
- -- if f then
- -- cache[code] = f
- -- end
- -- end
- -- end
+ -- sometimes we gain (e.g. .5 sec on the sync test)
+
+ local cache = table.makeweak()
function metapost.runscript(code)
nesting = nesting + 1
@@ -431,10 +466,18 @@ do
report_luarun("%i: code: %s",nesting,code)
end
runs = runs + 1
- ----- f = loadstring(f_code(code))
- local f = loadstring(code .. " return mp._f_()")
- if not f and be_tolerant then
- f = loadstring(code)
+ local f = cache[code]
+ if not f then
+ -- f = loadstring(f_code(code))
+ f = loadstring(code .. " return mp._f_()")
+ if f then
+ cache[code] = f
+ elseif be_tolerant then
+ f = loadstring(code)
+ if f then
+ cache[code] = f
+ end
+ end
end
if f then
local _buffer_, _n_ = buffer, n
diff --git a/tex/context/base/mkiv/pack-rul.mkiv b/tex/context/base/mkiv/pack-rul.mkiv
index 86edf7ed1..af93ac41d 100644
--- a/tex/context/base/mkiv/pack-rul.mkiv
+++ b/tex/context/base/mkiv/pack-rul.mkiv
@@ -239,7 +239,6 @@
\let\p_framed_backgroundcolor \empty
\let\p_framed_framecolor \empty
\let\p_framed_component \empty
-\let\p_framed_region \empty
\let\p_framed_background \empty
\let\p_framed_rulethickness \empty
\let\p_framed_foregroundcolor \empty
@@ -443,6 +442,8 @@
\newdimen\d_overlay_offset
\newdimen\d_overlay_linewidth
+\let\m_overlay_region\empty
+
% expandable ... in a future version the space will go (in my one can use Overlay*)
\def\overlaywidth {\the\d_overlay_width \space} % We preset the variables
@@ -450,6 +451,7 @@
\def\overlaydepth {\the\d_overlay_depth \space} % values.
\def\overlayoffset {\the\d_overlay_offset \space} % of the frame can be (are)
\def\overlaylinewidth {\the\d_overlay_linewidth\space} % set somewhere else.
+\def\overlayregion {\m_overlay_region}
% public but kind of protected
@@ -602,13 +604,21 @@
\def\pack_framed_background_box_content% fuzzy but needed hack, this \vss, otherwise
{\vpack to \framedbackgroundheight{\vss\box\b_framed_normal\vss}} % vertical shift \backgroundheight
-\def\pack_framed_add_region % experiment
- {\ifx\p_framed_region\v!yes
- \anch_mark_region_box\b_framed_normal
- \else
- \anch_mark_tagged_box\b_framed_normal\p_framed_region
+\def\pack_framed_set_region % experiment
+ {\ifx\m_overlay_region\v!yes
+ \edef\m_overlay_region{\reservedautoregiontag}%
\fi}
+% \def\pack_framed_add_region % experiment
+% {\ifx\m_overlay_region\v!yes
+% \anch_mark_region_box\b_framed_normal
+% \else
+% \anch_mark_tagged_box\b_framed_normal\m_overlay_region
+% \fi}
+
+\def\pack_framed_add_region % experiment
+ {\anch_mark_tagged_box\b_framed_normal\m_overlay_region}
+
\def\pack_framed_add_background
{\setbox\b_framed_normal\hpack % was vbox % see also *1*
{%\pack_framed_forgetall % can be relaxed
@@ -995,9 +1005,11 @@
\edef\currentframed{#1}%
\pack_framed_initialize
\setbox\b_framed_normal\hbox{#4}%
- \edef\p_framed_region{\framedparameter\c!region}%
- \ifx\p_framed_region\v!yes % maybe later named
- \pack_framed_add_region
+ \iftrialtypesetting \else
+ \edef\m_overlay_region{\framedparameter\c!region}%
+ \ifx\m_overlay_region\empty\else
+ \pack_framed_set_region
+ \fi
\fi
\setupcurrentframed[#3]%
\edef\p_framed_rulethickness{\framedparameter\c!rulethickness}% also used in backgrounds
@@ -1024,6 +1036,11 @@
\pack_framed_add_background
\fi
\pack_framed_restore_depth
+ \iftrialtypesetting \else
+ \ifx\m_overlay_region\empty\else
+ \pack_framed_add_region
+ \fi
+ \fi
\box\b_framed_normal
\egroup}
@@ -1032,9 +1049,9 @@
\unexpanded\def\pack_framed_process_box_indeed#1#2% component box (assumes parameters set and grouped usage)
{\setbox\b_framed_normal\box#2% could actually be \let\b_framed_normal#2
- \edef\p_framed_region{\framedparameter\c!region}%
- \ifx\p_framed_region\empty\else
- \pack_framed_add_region
+ \edef\m_overlay_region{\framedparameter\c!region}%
+ \ifx\m_overlay_region\empty\else
+ \pack_framed_set_region
\fi
\edef\p_framed_rulethickness{\framedparameter\c!rulethickness}% also used in backgrounds
\d_framed_frameoffset\framedparameter\c!frameoffset\relax % also used in backgrounds
@@ -1057,6 +1074,9 @@
\edef\p_framed_component{#1}%
\pack_framed_add_background
\fi
+ \ifx\m_overlay_region\empty\else
+ \pack_framed_add_region
+ \fi
\box\b_framed_normal
\egroup}
@@ -1605,9 +1625,9 @@
\fi
\pack_framed_stop_orientation % moved here at 2014-05-25
\iftrialtypesetting \else
- \edef\p_framed_region{\framedparameter\c!region}%
- \ifx\p_framed_region\empty\else
- \pack_framed_add_region
+ \edef\m_overlay_region{\framedparameter\c!region}%
+ \ifx\m_overlay_region\empty\else
+ \pack_framed_set_region
\fi
\fi
\d_framed_applied_offset
@@ -1645,6 +1665,11 @@
\fi
\fi
\pack_framed_locator_after\p_framed_location
+ \iftrialtypesetting \else
+ \ifx\m_overlay_region\empty\else
+ \pack_framed_add_region
+ \fi
+ \fi
\box\b_framed_normal
\global\frameddimensionstate % global so to be used directly afterwards !
\ifconditional\c_framed_has_width
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 53d29f6f6..329abcef6 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 6e81fe864..b109d4155 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/util-soc-imp-http.lua b/tex/context/base/mkiv/util-soc-imp-http.lua
index 19259321f..c3a28be82 100644
--- a/tex/context/base/mkiv/util-soc-imp-http.lua
+++ b/tex/context/base/mkiv/util-soc-imp-http.lua
@@ -34,6 +34,8 @@ local pumpall = ltn12.pump.all
local sinknull = ltn12.sink.null
local sinktable = ltn12.sink.table
+local lowerheaders = headers.lower
+
local mimeb64 = mime.b64
-- todo: localize ltn12
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index cb68e8fb6..aa9814dbc 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 9eb8ec988..771aa2c6e 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/context/modules/mkiv/s-evohome.mkiv b/tex/context/modules/mkiv/s-evohome.mkiv
index 1577517e5..06fd6fb76 100644
--- a/tex/context/modules/mkiv/s-evohome.mkiv
+++ b/tex/context/modules/mkiv/s-evohome.mkiv
@@ -198,13 +198,19 @@ function moduledata.evohome.history(specification)
local m = 0
for minute, d in next, hour do
local v = d[where]
- a = a + v
- n = n + 1
- if v > m then
- m = v
+ if v then
+ a = a + v
+ n = n + 1
+ if v > m then
+ m = v
+ end
end
end
- a = a / n
+ if n > 0 then
+ a = a / n
+ else
+ a = 0
+ end
local dx = xoffset + h
local dy = a/scale
local dm = m/scale
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 88e30479f..b9f8a6db9 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 : 08/28/18 17:21:11
+-- merge date : 08/30/18 18:41:24
do -- begin closure to overcome local limits and interference