summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-03-01 00:20:18 +0200
committerMarius <mariausol@gmail.com>2012-03-01 00:20:18 +0200
commitb6871683618e579c3f6354e701782dd8580d01db (patch)
treec89417cfe629d08d749c38fe587834c3f768a8f5
parentc309255cd3290db1a06f9d07a30308aca788eb32 (diff)
downloadcontext-b6871683618e579c3f6354e701782dd8580d01db.tar.gz
beta 2012.02.29 22:50
-rw-r--r--context/data/textpad/textpad-context-template.txt54
-rw-r--r--metapost/context/base/mp-tool.mpiv2
-rw-r--r--tex/context/base/anch-pgr.lua85
-rw-r--r--tex/context/base/anch-pos.mkiv4
-rw-r--r--tex/context/base/char-def.lua1
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4066 -> 4074 bytes
-rw-r--r--tex/context/base/context-version.pngbin104322 -> 105525 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/font-def.lua33
-rw-r--r--tex/context/base/font-otn.lua74
-rw-r--r--tex/context/base/pack-box.mkiv223
-rw-r--r--tex/context/base/pack-lyr.mkiv162
-rw-r--r--tex/context/base/status-files.pdfbin24258 -> 24372 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin172401 -> 172398 bytes
-rw-r--r--tex/context/base/strc-con.mkvi5
-rw-r--r--tex/context/base/strc-lst.mkvi48
-rw-r--r--tex/context/base/strc-not.mkvi65
-rw-r--r--tex/context/base/typo-mar.lua27
-rw-r--r--tex/context/base/typo-mar.mkiv2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua109
23 files changed, 544 insertions, 358 deletions
diff --git a/context/data/textpad/textpad-context-template.txt b/context/data/textpad/textpad-context-template.txt
deleted file mode 100644
index 48d0b86f9..000000000
--- a/context/data/textpad/textpad-context-template.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-; TextPad syntax definitions for ConTeXt (and LaTeX, respectively)
-
-LaTeX=1
-
-[Syntax]
-Namespace1=6
-IgnoreCase=No
-InitKeyWordChars=\abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ
-KeyWordChars=A-Za-z0-9@*'`!
-BracketChars={}[]()
-OperatorChars=-+*/<>!~%^&|=
-PreprocStart=
-SyntaxStart=
-SyntaxEnd=
-CommentStart=
-CommentEnd=
-CommentStartAlt=$
-CommentEndAlt=$
-SingleComment=%
-SingleCommentCol=
-SingleCommentAlt=
-SingleCommentColAlt=
-SingleCommentEsc=\
-StringStart=
-StringEnd=
-StringAlt=
-StringEsc=
-CharStart=
-CharEnd=
-CharEsc=
-
-[Keywords 1]
-; category: tex commands
-; filename: tex-commands.txt
-
-[Keywords 2]
-; category: context commands
-; filename: context-commands-en.txt
-
-[Keywords 3]
-; category: context commands
-; filename: context-environments-en.txt
-
-[Keywords 4]
-; category: latex commands
-; filename: latex-commands-1.txt
-
-[Keywords 5]
-; category: latex commands
-; filename: latex-commands-2.txt
-
-[Keywords 6]
-; category: latex commands
-; filename: latex-commands-3.txt
diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mp-tool.mpiv
index c66a78a2c..d52820d13 100644
--- a/metapost/context/base/mp-tool.mpiv
+++ b/metapost/context/base/mp-tool.mpiv
@@ -960,7 +960,7 @@ enddef ;
def drawpoints expr c = path _c_ ; _c_ := c ; mfun_draw_points enddef ;
def drawcontrolpoints expr c = path _c_ ; _c_ := c ; mfun_draw_controlpoints enddef ;
def drawcontrollines expr c = path _c_ ; _c_ := c ; mfun_draw_controllines enddef ;
-def drawpointlabels expr c = path _c_ ; _c_ := c ; mdun_draw_pointlabels enddef ;
+def drawpointlabels expr c = path _c_ ; _c_ := c ; mfun_draw_pointlabels enddef ;
def mfun_draw_points text t =
for _i_=0 upto length(_c_) :
diff --git a/tex/context/base/anch-pgr.lua b/tex/context/base/anch-pgr.lua
index 6dffd9bf8..bf4dcbe02 100644
--- a/tex/context/base/anch-pgr.lua
+++ b/tex/context/base/anch-pgr.lua
@@ -9,6 +9,7 @@ if not modules then modules = { } end modules ['anch-pgr'] = {
-- todo: we need to clean up lists (of previous pages)
local format = string.format
+local abs = math.abs
local concat, sort = table.concat, table.sort
local splitter = lpeg.splitat(":")
local lpegmatch = lpeg.match
@@ -44,13 +45,15 @@ end
-- we can use a 'local t, n' and reuse the table
+local eps = 2
+
local function add(t,x,y,last)
local n = #t
if n == 0 then
t[n+1] = { x, y }
elseif n == 1 then
local tn = t[1]
- if tn[1] ~= x or tn[2] ~= y then
+ if abs(tn[1]-x) <= eps or abs(tn[2]-y) <= eps then
t[n+1] = { x, y }
end
else
@@ -58,12 +61,12 @@ local function add(t,x,y,last)
local tn = t[n]
local lx = tn[1]
local ly = tn[2]
- if lx == tm[1] and lx == x then
- if ly ~= y then
+ if abs(lx-tm[1]) <= eps and abs(lx-x) <= eps then
+ if abs(ly-y) > eps then
tn[2] = y
end
- elseif ly == tm[2] and ly == y then
- if lx ~= x then
+ elseif abs(ly-tm[2]) <= eps and abs(ly-y) <= eps then
+ if abs(lx-x) > eps then
tn[1] = x
end
elseif not last then
@@ -72,6 +75,17 @@ local function add(t,x,y,last)
end
end
+local function finish(t)
+ local n = #t
+ if n > 1 then
+ local first = t[1]
+ local last = t[n]
+ if abs(first[1]-last[1]) <= eps and abs(first[2]-last[2]) <= eps then
+ t[n] = nil
+ end
+ end
+end
+
local function clip(t,ytop,ybot)
local first, last = 1, #t
for i=first,last do
@@ -238,6 +252,7 @@ local function singlepart(b,e,r,left,right)
end
add(area,bx,bd-ry)
add(area,bx,bh-ry,true) -- finish last straight line (but no add as we cycle)
+ finish(area)
for i=1,#area do
local a = area[i]
area[i] = pair(a[1],a[2])
@@ -275,6 +290,7 @@ local function firstpart(b,r,left,right)
end
add(area,bx,bd-ry)
add(area,bx,bh-ry,true) -- finish last straight line (but no add as we cycle)
+ finish(area)
for i=1,#area do
local a = area[i]
area[i] = pair(a[1],a[2])
@@ -305,6 +321,7 @@ local function middlepart(r,left,right)
local ri = rightshapes[i]
add(area,ri[1],ri[2]-ry)
end
+ finish(area)
for i=1,#area do
local a = area[i]
area[i] = pair(a[1],a[2])
@@ -341,6 +358,7 @@ local function lastpart(e,r,left,right)
local li = leftshapes[i]
add(area,li[1],li[2]-ry)
end
+ finish(area)
for i=1,#area do
local a = area[i]
area[i] = pair(a[1],a[2])
@@ -527,38 +545,41 @@ function backgrounds.fetchmultipar(n,anchor,page)
-- register(data.list,n,anchor)
end
if data then
- local pagedata = data.list[page]
- if pagedata then
- local nofmultipars = #pagedata
--- report_graphics("fetching '%s' at page %s using anchor '%s' containing %s multipars",n,page,anchor,nofmultipars)
- local a = jobpositions.collected[anchor]
- if not a then
- report_graphics("missing anchor '%s'",anchor)
- else
- local trace = false
- local x, y, w, h, d = a.x, a.y, a.w, a.h, a.d
- local bpos = data.bpos
- local bh, bd = bpos.h, bpos.d
- local result = { format(template_a,nofmultipars,pair(w,h+d),point(bh),point(bd),point(bh+bd)) }
- for i=1,nofmultipars do
- local region = pagedata[i]
- result[#result+1] = format(template_b,
- i, multilocs[region.location],
- i, region.location,
- i, path(region.area), pair(x,y-region.region.y))
- if trace then
- result[#result+1] = format(template_c,
- i, path(regionarea(region.region)), offset)
+ local list = data.list
+ if list then
+ local pagedata = list[page]
+ if pagedata then
+ local nofmultipars = #pagedata
+ -- report_graphics("fetching '%s' at page %s using anchor '%s' containing %s multipars",n,page,anchor,nofmultipars)
+ local a = jobpositions.collected[anchor]
+ if not a then
+ report_graphics("missing anchor '%s'",anchor)
+ else
+ local trace = false
+ local x, y, w, h, d = a.x, a.y, a.w, a.h, a.d
+ local bpos = data.bpos
+ local bh, bd = bpos.h, bpos.d
+ local result = { format(template_a,nofmultipars,pair(w,h+d),point(bh),point(bd),point(bh+bd)) }
+ for i=1,nofmultipars do
+ local region = pagedata[i]
+ result[#result+1] = format(template_b,
+ i, multilocs[region.location],
+ i, region.location,
+ i, path(region.area), pair(x,y-region.region.y))
+ if trace then
+ result[#result+1] = format(template_c,
+ i, path(regionarea(region.region)), offset)
+ end
end
+ data[page] = nil
+ result[#result+1] = template_d
+ result = concat(result,"\n")
+ return result
end
- data[page] = nil
- result[#result+1] = template_d
- result = concat(result,"\n")
- return result
end
end
end
- return format(template_a,0,"origin")
+ return format(template_a,0,"origin",0,0,0)
end
backgrounds.point = point
diff --git a/tex/context/base/anch-pos.mkiv b/tex/context/base/anch-pos.mkiv
index a583d8165..e297369b6 100644
--- a/tex/context/base/anch-pos.mkiv
+++ b/tex/context/base/anch-pos.mkiv
@@ -197,7 +197,7 @@
\strut
\hss}}
-\def\setpositiondataplus
+\unexpanded\def\setpositiondataplus
{\iftrialtypesetting
\expandafter\gobblefivearguments
\else
@@ -213,7 +213,7 @@
\dopositionaction\currentposition
\hss}}
-\def\setpositionplus
+\unexpanded\def\setpositionplus
{\iftrialtypesetting
\expandafter\anch_positions_set_plus_nop
\else
diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua
index ba844ff9b..b76886882 100644
--- a/tex/context/base/char-def.lua
+++ b/tex/context/base/char-def.lua
@@ -384,6 +384,7 @@ characters.data={
linebreak="al",
mathclass="binary",
mathname="ast",
+ mathsymbol=0x2217,
unicodeslot=0x002A,
},
{
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index aaac7b00f..294101e35 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{2012.02.21 14:02}
+\newcontextversion{2012.02.29 22:50}
%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 29538af06..c02e88bce 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{2012.02.21 14:02}
+\newcontextversion{2012.02.29 22:50}
%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 64e210c6f..0c7d5c892 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index c7185da94..322541cdd 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index 5f56e911a..673fe3e41 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{2012.02.21 14:02}
+\edef\contextversion{2012.02.29 22:50}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 8e06a9497..4726af250 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -23,7 +23,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.02.21 14:02}
+\edef\contextversion{2012.02.29 22:50}
%D For those who want to use this:
diff --git a/tex/context/base/font-def.lua b/tex/context/base/font-def.lua
index 10958cfbc..96de480ac 100644
--- a/tex/context/base/font-def.lua
+++ b/tex/context/base/font-def.lua
@@ -258,6 +258,24 @@ end
-- return tfmdata
-- end
+local function checkembedding(tfmdata)
+ local properties = tfmdata.properties
+ local embedding
+ if directive_embedall then
+ embedding = "full"
+ elseif properties and properties.filename and constructors.dontembed[properties.filename] then
+ embedding = "no"
+ else
+ embedding = "subset"
+ end
+ if properties then
+ properties.embedding = embedding
+ else
+ tfmdata.properties = { embedding = embedding }
+ end
+ tfmdata.embedding = embedding
+end
+
function definers.loadfont(specification)
local hash = constructors.hashinstance(specification)
local tfmdata = loadedfonts[hash] -- hashes by size !
@@ -287,21 +305,8 @@ function definers.loadfont(specification)
end
end
if tfmdata then
- local properties = tfmdata.properties
- local embedding
- if directive_embedall then
- embedding = "full"
- elseif properties and properties.filename and constructors.dontembed[properties.filename] then
- embedding = "no"
- else
- embedding = "subset"
- end
- if properties then
- properties.embedding = embedding
- else
- tfmdata.properties = { embedding = embedding }
- end
tfmdata = definers.applypostprocessors(tfmdata)
+ checkembedding(tfmdata) -- todo: general postprocessor
loadedfonts[hash] = tfmdata
designsizes[specification.hash] = tfmdata.parameters.designsize
end
diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua
index 2fd910eb9..8e6759747 100644
--- a/tex/context/base/font-otn.lua
+++ b/tex/context/base/font-otn.lua
@@ -2359,55 +2359,59 @@ local function prepare_lookups(tfmdata)
local description = descriptions[unicode]
- local lookups = description.slookups
- if lookups then
- for lookupname, lookupdata in next, lookups do
- action[lookuptypes[lookupname]](lookupdata,lookupname,unicode,lookuphash)
+ if description then
+
+ local lookups = description.slookups
+ if lookups then
+ for lookupname, lookupdata in next, lookups do
+ action[lookuptypes[lookupname]](lookupdata,lookupname,unicode,lookuphash)
+ end
end
- end
- local lookups = description.mlookups
- if lookups then
- for lookupname, lookuplist in next, lookups do
- local lookuptype = lookuptypes[lookupname]
- for l=1,#lookuplist do
- local lookupdata = lookuplist[l]
- action[lookuptype](lookupdata,lookupname,unicode,lookuphash)
+ local lookups = description.mlookups
+ if lookups then
+ for lookupname, lookuplist in next, lookups do
+ local lookuptype = lookuptypes[lookupname]
+ for l=1,#lookuplist do
+ local lookupdata = lookuplist[l]
+ action[lookuptype](lookupdata,lookupname,unicode,lookuphash)
+ end
end
end
- end
- local list = description.kerns
- if list then
- for lookup, krn in next, list do -- ref to glyph, saves lookup
- local target = lookuphash[lookup]
- if target then
- target[unicode] = krn
- else
- lookuphash[lookup] = { [unicode] = krn }
+ local list = description.kerns
+ if list then
+ for lookup, krn in next, list do -- ref to glyph, saves lookup
+ local target = lookuphash[lookup]
+ if target then
+ target[unicode] = krn
+ else
+ lookuphash[lookup] = { [unicode] = krn }
+ end
end
end
- end
- local list = description.anchors
- if list then
- for typ, anchors in next, list do -- types
- if typ == "mark" or typ == "cexit" then -- or entry?
- for name, anchor in next, anchors do
- local lookups = anchor_to_lookup[name]
- if lookups then
- for lookup, _ in next, lookups do
- local target = lookuphash[lookup]
- if target then
- target[unicode] = anchors
- else
- lookuphash[lookup] = { [unicode] = anchors }
+ local list = description.anchors
+ if list then
+ for typ, anchors in next, list do -- types
+ if typ == "mark" or typ == "cexit" then -- or entry?
+ for name, anchor in next, anchors do
+ local lookups = anchor_to_lookup[name]
+ if lookups then
+ for lookup, _ in next, lookups do
+ local target = lookuphash[lookup]
+ if target then
+ target[unicode] = anchors
+ else
+ lookuphash[lookup] = { [unicode] = anchors }
+ end
end
end
end
end
end
end
+
end
end
diff --git a/tex/context/base/pack-box.mkiv b/tex/context/base/pack-box.mkiv
index f91f8a299..b0af61f05 100644
--- a/tex/context/base/pack-box.mkiv
+++ b/tex/context/base/pack-box.mkiv
@@ -23,19 +23,23 @@
\unprotect
-% \definelayer[\v!tekst-2][\c!positie=\v!ja]
-% \definelayer[\v!tekst-1][\c!positie=\v!ja]
-% \definelayer[\v!tekst+1][\c!positie=\v!ja]
-% \definelayer[\v!tekst+2][\c!positie=\v!ja]
-
% we need to set the size, else we get dimensions depending
-% on the content, which in itsel fis ok, but can lead to loops
+% on the content, which in itself is ok, but can lead to loops
% due to rounding errors (happened in demo-obv)
-\definelayer[\v!text-2][\c!position=\v!yes,\c!width=\overlaywidth,\c!height=\overlayheight]
-\definelayer[\v!text-1][\c!position=\v!yes,\c!width=\overlaywidth,\c!height=\overlayheight]
-\definelayer[\v!text+1][\c!position=\v!yes,\c!width=\overlaywidth,\c!height=\overlayheight]
-\definelayer[\v!text+2][\c!position=\v!yes,\c!width=\overlaywidth,\c!height=\overlayheight]
+\definelayer[\v!text-2][\c!position=\v!yes,\c!region=,\c!width=\overlaywidth,\c!height=\overlayheight]
+\definelayer[\v!text-1][\c!position=\v!yes,\c!region=,\c!width=\overlaywidth,\c!height=\overlayheight]
+\definelayer[\v!text+1][\c!position=\v!yes,\c!region=,\c!width=\overlaywidth,\c!height=\overlayheight]
+\definelayer[\v!text+2][\c!position=\v!yes,\c!region=,\c!width=\overlaywidth,\c!height=\overlayheight]
+
+% \unexpanded\def\positionregionlayer#1#2%
+% {\composedlayer{#2}}
+%
+% \def\internaltextoverlay#1% will become more generic and installable
+% {\startoverlay % i.e. probably an overlay by itself
+% {\positionregionoverlay\textanchor{\v!text#1}}% see later
+% {\positionregionlayer \textanchor{\v!text#1}}%
+% \stopoverlay}
\def\internaltextoverlay#1% will become more generic and installable
{\startoverlay % i.e. probably an overlay by itself
@@ -43,82 +47,163 @@
{\composedlayer {\v!text#1}}%
\stopoverlay}
-% todo: share info, so that tuo will be smaller
-
\defineoverlay[\v!text-2][\internaltextoverlay{-2}]
\defineoverlay[\v!text-1][\internaltextoverlay{-1}]
\defineoverlay[\v!text+1][\internaltextoverlay{+1}]
\defineoverlay[\v!text+2][\internaltextoverlay{+2}]
-
+
% to be documented
-\definelayer[anchor]
+% \definelayer[anchor]
+%
+% \unexpanded\def\defineanchor
+% {\doquadrupleempty\dodefineanchor}
+%
+% \def\dodefineanchor[#1][#2][#3][#4]%
+% {\setvalue{\??an#1}{\dodefinedanchor[#2][#3][#4]}}
+%
+% \def\dodefinedanchor[#1][#2][#3]%
+% {\def\docommand[##1][##2]%
+% {\ifsecondargument
+% \def\next{\dodoanchorT[#1][#2,##1][#3,##2]}%
+% \else\iffirstargument
+% \def\next{\dodoanchorT[#1][#2,##1][#2,##1]}%
+% \else
+% \def\next{\dodoanchorT[#1][#2][#3]}%
+% \fi\fi
+% \next}%
+% \dodoubleempty\docommand}
+%
+% \unexpanded\def\anchor
+% {\dosingleargument\pack_anchor}
+%
+% \def\pack_anchor[#1]%
+% {\ifcsname\??an#1\endcsname\@EA\nonoanchor\else\@EA\dodoanchor\fi[#1]}
+%
+% \def\nonoanchor[#1]%
+% {\csname\??an#1\endcsname}
+%
+% \def\dodoanchor[#1]%
+% {\dotripleempty\dododoanchor[#1]}
+%
+% \def\dododoanchor
+% {\ifthirdargument
+% \expandafter\dodoanchorT
+% \else
+% \expandafter\dodoanchorS
+% \fi}
+%
+% \def\dodoanchorS[#1][#2][#3]%
+% {\dodoanchorT[#1][#2][#2]}
+%
+% \def\dodoanchorT[#1][#2][#3]% brrr: we need to apply offset only once .. a bit messy
+% {\dowithnextbox
+% {\bgroup
+% % \checktextbackgrounds
+% \setbox\scratchbox\emptyhbox
+% \wd\scratchbox\nextboxwd
+% \ht\scratchbox\nextboxht
+% \dp\scratchbox\nextboxdp
+% \setlayer
+% [anchor]
+% [\c!width=\wd\scratchbox,
+% \c!height=\ht\scratchbox,
+% \c!offset=\!!zeropoint,
+% #2,#3]
+% {\setlayer[#1]{\flushnextbox}}%
+% \framed
+% [#2,
+% \c!background=anchor,
+% \c!offset=\v!overlay,
+% \c!frame=\v!off,
+% #3]
+% {\box\scratchbox}%
+% \egroup}%
+% \vbox}
+
+\installcorenamespace {anchor}
+
+\unexpanded\def\defineanchor
+ {\doquadrupleempty\pack_anchors_define}
-\def\anchor
- {\dosingleargument\doanchor}
+\def\pack_anchors_define[#1][#2][#3][#4]% name targetlayer layersetting framedsetting
+ {\setvalue{\??anchor#1}{\pack_anchors_process_defined{#2}{#3}{#4}}}
+
+\def\pack_anchors_process_defined#1#2#3%
+ {\def\pack_anchors_process_defined_indeed[##1][##2]%
+ {\ifsecondargument
+ \def\next{\pack_anchors_process_indeed{#1}{#2,##1}{#3,##2}}%
+ \else\iffirstargument
+ \def\next{\pack_anchors_process_indeed{#1}{#2,##1}{#2,##1}}%
+ \else
+ \def\next{\pack_anchors_process_indeed{#1}{#2}{#3}}%
+ \fi\fi
+ \next}%
+ \dodoubleempty\pack_anchors_process_defined_indeed}
-\def\doanchor[#1]%
- {\ifcsname\??an#1\endcsname\@EA\nonoanchor\else\@EA\dodoanchor\fi[#1]}
+\unexpanded\def\anchor[#1]%
+ {\begingroup
+ \edef\currentanchor{#1}%
+ \ifcsname\??anchor\currentanchor\endcsname
+ \expandafter\pack_anchor_predefined
+ \else
+ \expandafter\pack_anchor_notdefined
+ \fi}
-\def\nonoanchor[#1]%
- {\csname\??an#1\endcsname}
+\def\pack_anchor_predefined
+ {\csname\??anchor\currentanchor\endcsname}
-\def\dodoanchor[#1]%
- {\dotripleempty\dododoanchor[#1]}
+\def\pack_anchor_notdefined
+ {\dodoubleempty\pack_anchor_notdefined_indeed}
-\def\dododoanchor
- {\ifthirdargument
- \expandafter\dodoanchorT
+\def\pack_anchor_notdefined_indeed
+ {\ifsecondargument
+ \expandafter\pack_anchor_notdefined_two
\else
- \expandafter\dodoanchorS
+ \expandafter\pack_anchor_notdefined_one
\fi}
-\def\dodoanchorS[#1][#2][#3]%
- {\dodoanchorT[#1][#2][#2]}
-
-\def\dodoanchorT[#1][#2][#3]% brrr: we need to apply offset only once .. a bit messy
- {\dowithnextbox
- {\bgroup
- \checktextbackgrounds
- \setbox\scratchbox\emptyhbox
- \wd\scratchbox\nextboxwd
- \ht\scratchbox\nextboxht
- \dp\scratchbox\nextboxdp
- \setlayer
- [anchor]
- [\c!width=\wd\scratchbox,
- \c!height=\ht\scratchbox,
- \c!offset=\!!zeropoint,
- #2,#3]
- {\setlayer[#1]{\flushnextbox}}%
- \framed
- [#2,
- \c!background=anchor,
- \c!offset=\v!overlay,
- \c!frame=\v!off,
- #3]
- {\box\scratchbox}%
- \egroup}%
- \vbox}
+\def\pack_anchor_notdefined_one[#1][#2]{\pack_anchors_process_indeed\currentanchor{#1}{#1}}
+\def\pack_anchor_notdefined_two[#1][#2]{\pack_anchors_process_indeed\currentanchor{#1}{#2}}
-\unexpanded\def\defineanchor
- {\doquadrupleempty\dodefineanchor}
+\def\pack_anchors_process_indeed#1#2#3%
+ {\dowithnextbox{\pack_anchors_process_finish{#1}{#2}{#3}}\vbox}
-\def\dodefineanchor[#1][#2][#3][#4]%
- {\setvalue{\??an#1}{\dodefinedanchor[#2][#3][#4]}}
+\newbox \b_pack_anchors
+\newdimen\d_pack_anchors_width
+\newdimen\d_pack_anchors_height
+\newdimen\d_pack_anchors_depth
+
+\definelayer[anchor] % \defineoverlay[anchor][\ruledhbox{\flushlayer[anchor]}]
+
+\def\pack_anchors_process_finish#1#2#3% brrr: we need to apply offset only once .. a bit messy
+ {\checkpositionoverlays
+ % for the moment we ignore the depth
+ \setbox\b_pack_anchors\box\nextbox
+ \d_pack_anchors_width \wd\b_pack_anchors
+ \d_pack_anchors_height\ht\b_pack_anchors
+ \d_pack_anchors_depth \dp\b_pack_anchors
+ \setbox\scratchbox\emptyhbox
+ \wd\scratchbox\d_pack_anchors_width
+ \ht\scratchbox\d_pack_anchors_height
+ \dp\scratchbox\d_pack_anchors_depth
+ \setlayer
+ [anchor]
+ [\c!width=\d_pack_anchors_width,
+ \c!height=\d_pack_anchors_height,
+ \c!offset=\zeropoint,
+ #2,#3]
+ {\setlayer[#1]{\box\b_pack_anchors}}% % #1 uses ovelaywidth/height
+ \framed
+ [\c!background=anchor,
+ \c!offset=\v!overlay,
+ \c!frame=\v!off,
+ #3]
+ {\box\scratchbox}%
+ \endgroup}
+
+% collectors
-\def\dodefinedanchor[#1][#2][#3]%
- {\def\docommand[##1][##2]%
- {\ifsecondargument
- \def\next{\dodoanchorT[#1][#2,##1][#3,##2]}%
- \else\iffirstargument
- \def\next{\dodoanchorT[#1][#2,##1][#2,##1]}%
- \else
- \def\next{\dodoanchorT[#1][#2][#3]}%
- \fi\fi
- \next}%
- \dodoubleempty\docommand}
-
\def\@@collectorbox{@@collectorbox}
\unexpanded\def\definecollector
diff --git a/tex/context/base/pack-lyr.mkiv b/tex/context/base/pack-lyr.mkiv
index 05e0df6ef..f8cf577be 100644
--- a/tex/context/base/pack-lyr.mkiv
+++ b/tex/context/base/pack-lyr.mkiv
@@ -40,7 +40,7 @@
\def\pack_framed_define_overlay[#1][#2][#3]% overlay [layer] content
{\ifthirdargument
%\writestatus{BEWARE}{This (overlay definition) has changed!}% temp
- \def\pack_framed_define_overlay_indeed##1{\setvalue{\??overlay##1}{\setlayer[#2]{\executedefinedoverlay{##1}{#3}}}}
+ \def\pack_framed_define_overlay_indeed##1{\setvalue{\??overlay##1}{\setlayer[#2]{\executedefinedoverlay{##1}{#3}}}}%
\else
\def\pack_framed_define_overlay_indeed##1{\setvalue{\??overlay##1}{\executedefinedoverlay{##1}{#2}}}%
\fi
@@ -57,7 +57,7 @@
\installcorenamespace{layer}
\installcorenamespace{layerbox}
\installcorenamespace{layerpreset}
-\installcorenamespace{layerposition}
+\installcorenamespace{layerposition} % brr, unreadable
%D \macros
%D {definelayer,setuplayer}
@@ -96,7 +96,13 @@
\c!dy=\zeropoint,
\c!location=rb,
\c!sx=1,
- \c!sy=1]
+ \c!sy=1,
+ \c!region=\layeranchor]
+
+\def\layeranchor{\currentlayer:\the\realpageno}
+
+\unexpanded\def\anch_mark_anchor_box#1%
+ {\ctxcommand{markregionbox(\number#1,"\layeranchor")}} % needs an hbox
\let\p_pack_layers_doublesided\empty
\let\p_pack_layers_state \empty
@@ -121,9 +127,12 @@
\let\p_pack_layers_width \empty
\let\p_pack_layers_height \empty
\let\p_pack_layers_direction \empty
+\let\p_pack_layers_region \empty
\let\m_pack_layers_page \empty
\let\m_pack_layers_target \empty
+\let\m_pack_layers_region \empty
+\let\m_pack_layers_anchor \empty
\newconditional\c_pack_layers_repeated
\newconditional\c_pack_layers_trace
@@ -181,7 +190,7 @@
{\pack_layers_reset_box{#1}%
\pack_layers_reset_box{\v!left #1}%
\pack_layers_reset_box{\v!right#1}%
- \pack_layers_reset_box{#1:\realfolio}}
+ \pack_layers_reset_box{#1:\the\realpageno}}
%D \macros
%D {setlayer}
@@ -214,7 +223,7 @@
\def\pack_layers_set[#1][#2][#3]% #4 == box do \fi is ok
{\bgroup
\edef\currentlayer{#1}%
- \edef\p_pack_layers_state{\layerparameter{#1}\c!state}
+ \edef\p_pack_layers_state{\layerparameter{#1}\c!state}%
\ifx\p_pack_layers_state\v!stop
\dowithnextboxcs\egroup\hbox
\else\ifthirdargument
@@ -264,18 +273,42 @@
% todo left/right
-\def\pack_layers_set_last_position_yes
- {\edef\m_pack_layers_page{\MPp{\??layerposition\the\c_pack_layers_current_data}}%
- \xdef\lastlayerxpos{\the\dimexpr-\MPx{\??layerposition\m_pack_layers_target\currentlayer:\m_pack_layers_page}+\MPx{\??layerposition\the\c_pack_layers_current_data}\relax}%
- \xdef\lastlayerypos{\the\dimexpr \MPy{\??layerposition\m_pack_layers_target\currentlayer:\m_pack_layers_page}-\MPy{\??layerposition\the\c_pack_layers_current_data}\relax}%}
- \d_pack_layers_x_position\lastlayerxpos
- \d_pack_layers_y_position\lastlayerypos
- \begingroup
- \edef\currentlayer{\currentlayer\m_pack_layers_page}%
- \global\letlayerparameter\c!position\v!yes
- \endgroup
+% todo: get position data in one go
+
+% \def\pack_layers_set_last_position_yes
+% {\edef\m_pack_layers_page{\MPp{\??layerposition\the\c_pack_layers_current_data}}%
+% \xdef\lastlayerxpos{\the\dimexpr-\MPx{\??layerposition\m_pack_layers_target\currentlayer:\m_pack_layers_page}+\MPx{\??layerposition\the\c_pack_layers_current_data}\relax}%
+% \xdef\lastlayerypos{\the\dimexpr \MPy{\??layerposition\m_pack_layers_target\currentlayer:\m_pack_layers_page}-\MPy{\??layerposition\the\c_pack_layers_current_data}\relax}%}
+% \d_pack_layers_x_position\lastlayerxpos
+% \d_pack_layers_y_position\lastlayerypos
+% \begingroup
+% \edef\currentlayer{\currentlayer\m_pack_layers_page}%
+% \global\letlayerparameter\c!position\v!yes
+% \endgroup
+% \global\letlayerparameter\c!state\v!start % needed ?
+% \setbox\b_layers\vbox to \d_pack_layers_y_size{\hbox to \d_pack_layers_x_size{\xypos{\??layerposition\the\c_pack_layers_current_data}\hss}\vss}}
+
+\def\pack_layers_set_last_position_yes % target: left|right
+ {% this will become one call
+ \edef\m_pack_layers_anchor{\??layerposition\the\c_pack_layers_current_data}%
+ \edef\m_pack_layers_page {\MPp\m_pack_layers_anchor}%
+ \edef\m_pack_layers_region{\MPr\m_pack_layers_anchor}%
+ \d_pack_layers_x_position \dimexpr-\MPx\m_pack_layers_region+\MPx\m_pack_layers_anchor\relax
+ \d_pack_layers_y_position \dimexpr \MPy\m_pack_layers_region-\MPy\m_pack_layers_anchor+\MPh\m_pack_layers_region\relax
+ \xdef\lastlayerxpos{\the\d_pack_layers_x_position}%
+ \xdef\lastlayerypos{\the\d_pack_layers_y_position}%
+ % \writestatus{region}{\m_pack_layers_region -> (\MPx\m_pack_layers_region,\MPy\m_pack_layers_region)}%
+ % \writestatus{self} {\m_pack_layers_anchor -> (\MPx\m_pack_layers_anchor,\MPy\m_pack_layers_anchor)}%
+ % \writestatus{delta} {(\lastlayerxpos,\lastlayerypos)}%
+ % \begingroup
+ % \edef\currentlayer{\currentlayer\m_pack_layers_page}%
+ % \global\letlayerparameter\c!position\v!yes
+ % \endgroup
\global\letlayerparameter\c!state\v!start % needed ?
- \setbox\b_layers\vbox to \d_pack_layers_y_size{\hbox to \d_pack_layers_x_size{\xypos{\??layerposition\the\c_pack_layers_current_data}\hss}\vss}}
+ \setbox\b_layers\vbox to \d_pack_layers_y_size
+ {\hbox to \d_pack_layers_x_size
+ {\xypos\m_pack_layers_anchor\hss}%
+ \vss}}
\def\pack_layers_set_last_position_nop
{\setbox\b_layers\emptybox
@@ -520,18 +553,78 @@
\def\pack_layers_flush_single
{\startoverlay
- {\ifcsname\??layerbox \currentlayer \endcsname\pack_layers_flush_indeed\plusone \currentlayer \fi}%
- {\ifcsname\??layerbox \currentlayer:\realfolio\endcsname\pack_layers_flush_indeed\zerocount{\currentlayer:\realfolio}\fi}%
+ {\ifcsname\??layerbox \currentlayer \endcsname\pack_layers_flush_indeed\plusone \currentlayer \fi}%
+ {\ifcsname\??layerbox \currentlayer:\the\realpageno\endcsname\pack_layers_flush_indeed\zerocount{\currentlayer:\the\realpageno}\fi}%
\stopoverlay}
\def\pack_layers_flush_double#1%
{\startoverlay
- {\ifcsname\??layerbox \currentlayer \endcsname\pack_layers_flush_indeed\plusone \currentlayer \fi}%
- {\ifcsname\??layerbox \currentlayer:\realfolio\endcsname\pack_layers_flush_indeed\zerocount {\currentlayer:\realfolio}\fi}%
- {\ifcsname\??layerbox#1\currentlayer \endcsname\pack_layers_flush_indeed\plusone {#1\currentlayer }\fi}%
- {\ifcsname\??layerbox#1\currentlayer:\realfolio\endcsname\pack_layers_flush_indeed\zerocount{#1\currentlayer:\realfolio}\fi}%
+ {\ifcsname\??layerbox \currentlayer \endcsname\pack_layers_flush_indeed\plusone \currentlayer \fi}%
+ {\ifcsname\??layerbox \currentlayer:\the\realpageno\endcsname\pack_layers_flush_indeed\zerocount {\currentlayer:\the\realpageno}\fi}%
+ {\ifcsname\??layerbox#1\currentlayer \endcsname\pack_layers_flush_indeed\plusone {#1\currentlayer }\fi}%
+ {\ifcsname\??layerbox#1\currentlayer:\the\realpageno\endcsname\pack_layers_flush_indeed\zerocount{#1\currentlayer:\the\realpageno}\fi}%
\stopoverlay}
+% \def\pack_layers_flush_indeed#1#2% quite core, so optimized
+% {\begingroup % already grouped
+% \offinterlineskip
+% \edef\p_pack_layers_preset{\layerparameter\c!preset}%
+% \ifcsname\??layerpreset\p_pack_layers_preset\endcsname
+% \csname\??layerpreset\p_pack_layers_preset\endcsname
+% \fi
+% \edef\p_pack_layers_method{\layerparameter\c!method}%
+% \edef\p_pack_layers_option{\layerparameter\c!option}%
+% \ifx\p_pack_layers_option\v!test
+% \settrue\c_pack_layers_trace
+% \traceboxplacementtrue
+% \fi
+% \ifcase#1\relax
+% \setfalse\c_pack_layers_repeated
+% \else
+% \edef\p_pack_layers_position{\layerparameter\c!position}%
+% \ifx\p_pack_layers_position\v!yes
+% \setfalse\c_pack_layers_repeated
+% \else
+% \edef\p_pack_layers_repeat{\layerparameter\c!repeat}%
+% \ifx\p_pack_layers_repeat\v!yes
+% \settrue\c_pack_layers_repeated
+% \else\ifx\p_pack_layers_state\v!repeat
+% \settrue\c_pack_layers_repeated
+% \else
+% \setfalse\c_pack_layers_repeated
+% \fi\fi
+% \fi
+% \fi
+% \chardef\b_layers\csname\??layerbox#2\endcsname % trick
+% % we need to copy in order to retain the negative offsets for a next
+% % stage of additions, i.e. llx/lly accumulate in repeat mode and the
+% % compensation may differ each flush depending on added content
+% \setbox\nextbox
+% \ifx\p_pack_layers_method\v!fit
+% \pack_layers_positioned_box_yes
+% \else
+% \pack_layers_positioned_box_nop
+% \fi
+% % todo: method=offset => overlayoffset right/down (handy for backgrounds with offset)
+% \doifoverlayelse{#2}%
+% {\setlayoutcomponentattribute{\v!layer:#2}}%
+% \resetlayoutcomponentattribute
+% \ifx\p_pack_layers_option\v!test \ruledvbox \else \vbox \fi \ifx\p_pack_layers_method\v!overlay to \overlayheight \fi \layoutcomponentboxattribute
+% {\hbox \ifx\p_pack_layers_method\v!overlay to \overlaywidth \fi
+% {\edef\currentlayer{#2\the\realpageno}% local
+% \edef\p_pack_layers_position{\layerparameter\c!position}% local
+% \ifx\p_pack_layers_position\v!yes
+% \xypos{\??layerposition#2:\the\realpageno}%
+% \fi
+% \box\nextbox
+% \hss}%
+% \vss}%
+% \ifconditional\c_pack_layers_repeated\else
+% \gsetboxllx\b_layers\zeropoint
+% \gsetboxlly\b_layers\zeropoint
+% \fi
+% \endgroup}
+
\def\pack_layers_flush_indeed#1#2% quite core, so optimized
{\begingroup % already grouped
\offinterlineskip
@@ -576,16 +669,25 @@
\doifoverlayelse{#2}%
{\setlayoutcomponentattribute{\v!layer:#2}}%
\resetlayoutcomponentattribute
+ % from now on bottom up
+ \setbox\nextbox
\ifx\p_pack_layers_option\v!test \ruledvbox \else \vbox \fi \ifx\p_pack_layers_method\v!overlay to \overlayheight \fi \layoutcomponentboxattribute
- {\hbox \ifx\p_pack_layers_method\v!overlay to \overlaywidth \fi
- {\edef\currentlayer{#2\realfolio}% local
- \edef\p_pack_layers_position{\layerparameter\c!position}% local
- \ifx\p_pack_layers_position\v!yes
- \xypos{\??layerposition#2:\realfolio}%
- \fi
- \box\nextbox
+ {\vss
+ \hbox \ifx\p_pack_layers_method\v!overlay to \overlaywidth \fi
+ {\box\nextbox
\hss}%
- \vss}%
+ }%\vss}%
+ %
+ % \edef\currentlayer{#2}% :\the\realpageno}% local .. check \anchor
+ % \edef\p_pack_layers_position{\layerparameter\c!position}% local
+ \ifx\p_pack_layers_position\v!yes
+ \edef\p_pack_layers_region{\layerparameter\c!region}%
+ \ifx\p_pack_layers_region\empty \else
+ \anch_mark_anchor_box\nextbox
+ \fi
+ \fi
+ \box\nextbox
+ %
\ifconditional\c_pack_layers_repeated\else
\gsetboxllx\b_layers\zeropoint
\gsetboxlly\b_layers\zeropoint
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index b32a31aff..033d76aeb 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index ae40d3333..ebdd12822 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-con.mkvi b/tex/context/base/strc-con.mkvi
index 0e9b458d9..80feef962 100644
--- a/tex/context/base/strc-con.mkvi
+++ b/tex/context/base/strc-con.mkvi
@@ -574,6 +574,8 @@
\ignorespaces
\stopsetups
+% why copy? historic reason?
+
\startsetups[\??constructionrenderings:\v!margin]
\let\\=\crlf
\noindent
@@ -627,7 +629,7 @@
\stopsetups
\startsetups[\??constructionrenderings:\v!serried]
- \edef\p_width{\constructionlocationparameter\c!width}% CHECK ! ! ! wrong parameter namespace
+ \edef\p_width{\constructionparameter\c!width}% CHECK ! ! ! wrong parameter namespace
\doifsetupselse{\??constructionrenderings:\v!serried:\p_width} {
\directsetup{\??constructionrenderings:\v!serried:\p_width}
} {
@@ -670,6 +672,7 @@
\stopsetups
\startsetups[\??constructionrenderings:\v!hanging]
+ % tricky: leftskipadaption is somewhat unpredictable
\let\\=\crlf
\noindent
\advance\leftskip-\leftskipadaption\relax
diff --git a/tex/context/base/strc-lst.mkvi b/tex/context/base/strc-lst.mkvi
index a814bdae4..4b428454f 100644
--- a/tex/context/base/strc-lst.mkvi
+++ b/tex/context/base/strc-lst.mkvi
@@ -161,45 +161,49 @@
\unexpanded\def\writedatatolist {\dotripleargument\strc_lists_write_data_to}
\unexpanded\def\writetolist {\dodoubleempty \strc_lists_write_to}
-\def\strc_lists_write_between[#tag][#settings]#command% we can overload location
- {\doif{\namedlistparameter{#tag}\c!state}\v!start
- {\strc_lists_inject_yes[#tag][#settings,\c!type=\s!command][\s!command={#command}]}}
-
-% \def\strc_lists_write_data_to[#tag][#settings][#userdata]% we can overload location
-% {\doif{\namedlistparameter{#tag}\c!state}\v!start
-% {\ifthirdargument
-% \strc_lists_inject[#tag][#settings,\c!type=\s!userdata][#userdata]%
-% \else
-% \strc_lists_inject[#tag][\c!type=\s!userdata][#settings]%
-% \fi}}
-
-\def\strc_lists_write_data_to[#tag]% we can overload location
+\def\strc_lists_write_between[#tag]%
{\begingroup
\edef\currentlist{#tag}%
- \doifelse{\namedlistparameter{#tag}\c!state}\v!start\strc_lists_write_data_to_yes\gobbletwooptionals}
+ \doifelse{\namedlistparameter{#tag}\c!state}\v!start
+ \strc_lists_write_between_yes
+ \strc_lists_write_between_nop}
-\def\strc_lists_write_data_to_yes[#settings][#userdata]% we can overload location
+\def\strc_lists_write_between_yes[#settings]#command%
+ {\strc_lists_inject_yes[#settings,\c!type=\s!command][command={#command}]}
+
+\def\strc_lists_write_between_nop[#settings]#command%
+ {\endgroup}
+
+\def\strc_lists_write_data_to[#tag]%
+ {\begingroup
+ \edef\currentlist{#tag}%
+ \doifelse{\namedlistparameter{#tag}\c!state}\v!start
+ \strc_lists_write_data_to_yes
+ \strc_lists_write_data_to_nop}
+
+\def\strc_lists_write_data_to_yes[#settings][#userdata]%
{\ifthirdargument % no need to have an extra step ... used seldom
\strc_lists_inject_yes[#settings,\c!type=\s!userdata][#userdata]%
\else
\strc_lists_inject_yes[\c!type=\s!userdata][#settings]%
\fi}
-% \def\strc_lists_write_to[#tag][#settings]#first#second% we can overload location
-% {\doif{\namedlistparameter{#tag}\c!state}\v!start
-% {\strc_lists_inject[#tag][\c!location=\v!here,#settings,\c!type=\s!simple][\s!first={#first},\s!second={#second}]}}
+\def\strc_lists_write_data_to_nop[#settings][#userdata]%
+ {\endgroup}
\def\strc_lists_write_to[#tag]%
{\begingroup
\edef\currentlist{#tag}%
- \doifelse{\namedlistparameter{#tag}\c!state}\v!start\strc_lists_write_to_yes\strc_lists_write_to_nop}
+ \doifelse{\namedlistparameter{#tag}\c!state}\v!start
+ \strc_lists_write_to_yes
+ \strc_lists_write_to_nop}
+
+\def\strc_lists_write_to_yes[#settings]#first#second% no \s!first because we don't expand user settings
+ {\strc_lists_inject_yes[\c!location=\v!here,#settings,\c!type=\s!simple][first={#first},second={#second}]}
\def\strc_lists_write_to_nop[#settings]#first#second%
{\endgroup} % \strc_lists_inject_nop[][]
-\def\strc_lists_write_to_yes[#settings]#first#second%
- {\strc_lists_inject_yes[\c!location=\v!here,#settings,\c!type=\s!simple][\s!first={#first},\s!second={#second}]}
-
%D When placing a list either one or a set can be giving. This makes
%D it possible to flush for instance an nested (or merged) table of
%D contents. Keep in mind that placing a list is what we do most (think
diff --git a/tex/context/base/strc-not.mkvi b/tex/context/base/strc-not.mkvi
index 4bfcc291d..d5a4ee865 100644
--- a/tex/context/base/strc-not.mkvi
+++ b/tex/context/base/strc-not.mkvi
@@ -77,7 +77,7 @@
\definesymbol[\v!note:\v!nextpage ][\llap{\low{\symbol[\v!nextpage ]}}]
\setupnotations % check with old
- [\c!alternative=\v!inleft,
+ [\c!alternative=\v!note,
%\c!headstyle=,
%\c!titlestyle=,
%\c!style=,
@@ -87,8 +87,8 @@
\c!numbercommand=\high,
%\c!symbolcommand=\lowllap, % experiment
\c!width=\v!fit,
- \c!titledistance=0.5em,
- \c!distance=0pt,
+ \c!titledistance=.5em,
+ \c!distance=.5em,
%\c!hang=,
%\c!sample=,
%\c!align=,
@@ -273,6 +273,19 @@
\setvalue{\??constructionnotehandler\v!notation:}% empty case
{[\currentconstructionhandler:\currentconstruction]}
+%D Here is a simple renderer for notes
+
+\defineconstructionalternative
+ [\v!note]
+ [\c!renderingsetup=\??constructionrenderings:\v!note]
+
+\startsetups[\??constructionrenderings:\v!note]
+ \noindent
+ \llap{\box\constructionheadbox\hskip\constructionparameter\c!distance}%
+ \useconstructionstyleandcolor\c!style\c!color
+ \ignorespaces
+\stopsetups
+
%D We now implement the note definer.
\installcorenamespace{note}
@@ -298,7 +311,7 @@
\c!frame=\v!off,
\c!distance=.125em, % in the text between symbols
\c!columndistance=1em,
- \c!margindistance=.5em,
+% \c!margindistance=.5em,
\c!align=, % also use instead of \c!tolerance
\c!split=\v!tolerant,
\c!width=\makeupwidth, % \ifdim\hsize<\makeupwidth\hsize\else\makeupwidth\fi
@@ -344,10 +357,14 @@
\fi
\to \everydefinenote
-\expandafter\let\csname\??constructionstarthandler \v!notation\expandafter\endcsname\csname\??constructionstarthandler \v!enumeration\endcsname
-\expandafter\let\csname\??constructionstophandler \v!notation\expandafter\endcsname\csname\??constructionstophandler \v!enumeration\endcsname
-\expandafter\let\csname\??constructioncommandhandler\v!notation\expandafter\endcsname\csname\??constructioncommandhandler\v!enumeration\endcsname
-\expandafter\let\csname\??constructiontexthandler \v!notation\expandafter\endcsname\csname\??constructiontexthandler \v!enumeration\endcsname
+% \setvalue{\??constructionstarthandler\v!notation}%
+% {\csname\??constructionstarthandler\v!construction\endcsname}
+
+%expandafter\let\csname\??constructionstarthandler \v!notation\expandafter\endcsname\csname\??constructionstarthandler \v!enumeration\endcsname
+\expandafter\let\csname\??constructionstarthandler \v!notation\expandafter\endcsname\csname\??constructionstarthandler \v!construction\endcsname % no par mess
+\expandafter\let\csname\??constructionstophandler \v!notation\expandafter\endcsname\csname\??constructionstophandler \v!enumeration \endcsname
+\expandafter\let\csname\??constructioncommandhandler\v!notation\expandafter\endcsname\csname\??constructioncommandhandler\v!enumeration \endcsname
+\expandafter\let\csname\??constructiontexthandler \v!notation\expandafter\endcsname\csname\??constructiontexthandler \v!enumeration \endcsname
\setvalue{\??constructionmainhandler\v!notation}#1%
{\iftrialtypesetting \else
@@ -985,34 +1002,6 @@
%D merge this functionality with the existing \type {\note}
%D functionality.
-%D The next implementation runs on top of enumerations (only in \MKIV).
-%D
-%D \starttyping
-%D \setupenumerations
-%D [footnote]
-%D [ style=\type{(es)},
-%D headstyle=\type{(hs)}]
-%D
-%D \setupnote
-%D [footnote]
-%D [ style=\type{(s)},
-%D command=\type{(c)},
-%D textcommand=\type{(tc)},
-%D textstyle=\type{(ts)},
-%D numberstyle=\type{(ns)},
-%D numbercommand=\type{(nc)}]
-%D
-%D \setuplayout[backspace=6cm,marginwidth=cm,width=middle]
-%D
-%D \starttext
-%D \dorecurse{9}{This\footnote{Hello World #1} is a test.\par }
-%D \stoptext
-%D \stoptyping
-
-% check what is called at the lua end
-
-% ugly ...
-
\newconditional\c_strc_notes_symbol \settrue\c_strc_notes_symbol % not used
\newconditional\c_strc_notes_skip
@@ -1096,8 +1085,8 @@
\splittopskip\strutht % not actually needed here
\splitmaxdepth\strutdp % not actually needed here
% brrr
- \leftmargindistance \noteparameter\c!margindistance
- \rightmargindistance\leftmargindistance
+% \leftmargindistance \noteparameter\c!margindistance
+% \rightmargindistance\leftmargindistance
% \ifnum\noteparameter\c!n=\zerocount % no ifcase new 31-07-99 ; always ?
% \doifnotinset{\noteparameter\c!width}{\v!fit,\v!broad}\setnotehsize % ?
% \fi
diff --git a/tex/context/base/typo-mar.lua b/tex/context/base/typo-mar.lua
index 45cab0f71..a21d9b70a 100644
--- a/tex/context/base/typo-mar.lua
+++ b/tex/context/base/typo-mar.lua
@@ -307,7 +307,7 @@ function margins.save(t)
t.strutheight = texbox.strutbox.height
t.leftskip = tex.leftskip.width -- we're not in forgetall
t.rightskip = tex.rightskip.width -- we're not in forgetall
- t.leftmargindistance = leftmargindistance
+ t.leftmargindistance = leftmargindistance -- todo:layoutstatus table
t.rightmargindistance = rightmargindistance
t.leftedgedistance = texdimen.naturalleftedgedistance
+ texdimen.leftmarginwidth
@@ -451,7 +451,7 @@ local function realigned(current,a)
end
-- Stacking is done in two ways: the v_yes option stacks per paragraph (or line,
--- depending on what gets by) and mostly concerns margin data dat got ste at more or
+-- depending on what gets by) and mostly concerns margin data dat got set at more or
-- less the same time. The v_continue option uses position tracking and works on
-- larger range. However, crossing pages is not part of it. Anyway, when you have
-- such messed up margin data you'd better think twice.
@@ -514,6 +514,8 @@ local function inject(parent,head,candidate)
local voffset = candidate.voffset
local line = candidate.line
local baseline = candidate.baseline
+ local strutheight = candidate.strutheight
+ local strutdepth = candidate.strutdepth
local offset = stacked[location]
local firstonstack = offset == false or offset == nil
nofstatus = nofstatus + 1
@@ -527,6 +529,12 @@ local function inject(parent,head,candidate)
--~ baseline = h.height
--~ break
--~ end
+ else
+ baseline = tonumber(baseline)
+ if not baseline or baseline <= 0 then
+ -- in case we have a box of width 0 that is not analyzed
+ baseline = false -- strutheight -- actually a hack
+ end
end
candidate.width = width
candidate.hsize = parent.width -- we can also pass textwidth
@@ -568,24 +576,33 @@ local function inject(parent,head,candidate)
else
shift = shift + voffset -- normal
end
+ if trace_margindata then
+ report_margindata("first aligned")
+ end
elseif method == v_depth then
- local delta = candidate.strutdepth
+ local delta = strutdepth
if trace_margindata then
report_margindata("depth aligned, amount: %s",delta)
end
shift = shift + voffset + delta
elseif method == v_height then
- local delta = - candidate.strutheight
+ local delta = - strutheight
if trace_margindata then
report_margindata("height aligned, amount: %s",delta)
end
shift = shift + voffset + delta
elseif voffset ~= 0 then
+ if trace_margindata then
+ report_margindata("voffset applied: %s",voffset)
+ end
shift = shift + voffset
end
-- -- --
if line ~= 0 then
local delta = line * candidate.lineheight
+ if trace_margindata then
+ report_margindata("line offset applied: %s (%s)",line,delta)
+ end
shift = shift + delta
offset = offset + delta
end
@@ -614,7 +631,7 @@ local function inject(parent,head,candidate)
height = height,
depth = offset,
slack = candidate.bottomspace, -- todo: 'depth' => strutdepth
- lineheight = candidate.lineheight, -- only for tracing
+ lineheight = candidate.lineheight, -- only for tracing
}
offset = offset + height
stacked[location] = offset -- weird, no table ?
diff --git a/tex/context/base/typo-mar.mkiv b/tex/context/base/typo-mar.mkiv
index 225f73cbb..5a8f7d250 100644
--- a/tex/context/base/typo-mar.mkiv
+++ b/tex/context/base/typo-mar.mkiv
@@ -263,7 +263,7 @@
% \fi
scope = "\margindataparameter\c!scope",
align = "\margindataparameter\c!align",
- line = "\margindataparameter\c!line",
+ line = \number\margindataparameter\c!line,
stack = "\margindataparameter\c!stack",
number = \number\nextbox,
}}%
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index ec7cdb8ff..d3a2049cf 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 : 02/21/12 14:02:23
+-- merge date : 02/29/12 22:50:46
do -- begin closure to overcome local limits and interference
@@ -10928,55 +10928,59 @@ local function prepare_lookups(tfmdata)
local description = descriptions[unicode]
- local lookups = description.slookups
- if lookups then
- for lookupname, lookupdata in next, lookups do
- action[lookuptypes[lookupname]](lookupdata,lookupname,unicode,lookuphash)
+ if description then
+
+ local lookups = description.slookups
+ if lookups then
+ for lookupname, lookupdata in next, lookups do
+ action[lookuptypes[lookupname]](lookupdata,lookupname,unicode,lookuphash)
+ end
end
- end
- local lookups = description.mlookups
- if lookups then
- for lookupname, lookuplist in next, lookups do
- local lookuptype = lookuptypes[lookupname]
- for l=1,#lookuplist do
- local lookupdata = lookuplist[l]
- action[lookuptype](lookupdata,lookupname,unicode,lookuphash)
+ local lookups = description.mlookups
+ if lookups then
+ for lookupname, lookuplist in next, lookups do
+ local lookuptype = lookuptypes[lookupname]
+ for l=1,#lookuplist do
+ local lookupdata = lookuplist[l]
+ action[lookuptype](lookupdata,lookupname,unicode,lookuphash)
+ end
end
end
- end
- local list = description.kerns
- if list then
- for lookup, krn in next, list do -- ref to glyph, saves lookup
- local target = lookuphash[lookup]
- if target then
- target[unicode] = krn
- else
- lookuphash[lookup] = { [unicode] = krn }
+ local list = description.kerns
+ if list then
+ for lookup, krn in next, list do -- ref to glyph, saves lookup
+ local target = lookuphash[lookup]
+ if target then
+ target[unicode] = krn
+ else
+ lookuphash[lookup] = { [unicode] = krn }
+ end
end
end
- end
- local list = description.anchors
- if list then
- for typ, anchors in next, list do -- types
- if typ == "mark" or typ == "cexit" then -- or entry?
- for name, anchor in next, anchors do
- local lookups = anchor_to_lookup[name]
- if lookups then
- for lookup, _ in next, lookups do
- local target = lookuphash[lookup]
- if target then
- target[unicode] = anchors
- else
- lookuphash[lookup] = { [unicode] = anchors }
+ local list = description.anchors
+ if list then
+ for typ, anchors in next, list do -- types
+ if typ == "mark" or typ == "cexit" then -- or entry?
+ for name, anchor in next, anchors do
+ local lookups = anchor_to_lookup[name]
+ if lookups then
+ for lookup, _ in next, lookups do
+ local target = lookuphash[lookup]
+ if target then
+ target[unicode] = anchors
+ else
+ lookuphash[lookup] = { [unicode] = anchors }
+ end
end
end
end
end
end
end
+
end
end
@@ -12579,6 +12583,24 @@ end
-- return tfmdata
-- end
+local function checkembedding(tfmdata)
+ local properties = tfmdata.properties
+ local embedding
+ if directive_embedall then
+ embedding = "full"
+ elseif properties and properties.filename and constructors.dontembed[properties.filename] then
+ embedding = "no"
+ else
+ embedding = "subset"
+ end
+ if properties then
+ properties.embedding = embedding
+ else
+ tfmdata.properties = { embedding = embedding }
+ end
+ tfmdata.embedding = embedding
+end
+
function definers.loadfont(specification)
local hash = constructors.hashinstance(specification)
local tfmdata = loadedfonts[hash] -- hashes by size !
@@ -12608,21 +12630,8 @@ function definers.loadfont(specification)
end
end
if tfmdata then
- local properties = tfmdata.properties
- local embedding
- if directive_embedall then
- embedding = "full"
- elseif properties and properties.filename and constructors.dontembed[properties.filename] then
- embedding = "no"
- else
- embedding = "subset"
- end
- if properties then
- properties.embedding = embedding
- else
- tfmdata.properties = { embedding = embedding }
- end
tfmdata = definers.applypostprocessors(tfmdata)
+ checkembedding(tfmdata) -- todo: general postprocessor
loadedfonts[hash] = tfmdata
designsizes[specification.hash] = tfmdata.parameters.designsize
end