From e0e3ed2de96caf76d1065b834ddd4f9ba62a1e55 Mon Sep 17 00:00:00 2001 From: Marius Date: Thu, 16 Feb 2012 11:20:24 +0200 Subject: beta 2012.02.16 09:55 --- tex/context/base/anch-bar.mkiv | 7 +- tex/context/base/anch-bck.mkvi | 86 ++-- tex/context/base/anch-pgr.lua | 480 +++++++++++++++++++++ tex/context/base/anch-pgr.mkiv | 287 +++++------- tex/context/base/anch-pos.lua | 410 +++++++++--------- tex/context/base/anch-pos.mkiv | 77 ++-- tex/context/base/anch-tab.mkiv | 52 ++- tex/context/base/back-exp.mkiv | 4 +- tex/context/base/bibl-tra.mkiv | 21 +- tex/context/base/buff-ini.mkiv | 2 +- tex/context/base/colo-ini.mkiv | 7 + tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4070 -> 4074 bytes tex/context/base/context-version.png | Bin 105345 -> 105204 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 5 +- tex/context/base/font-col.mkvi | 6 +- tex/context/base/font-fil.mkvi | 8 +- tex/context/base/font-ini.mkvi | 213 +++++---- tex/context/base/font-mat.mkvi | 22 +- tex/context/base/font-var.mkvi | 53 +++ tex/context/base/lpdf-ano.lua | 2 +- tex/context/base/lxml-css.lua | 6 + tex/context/base/lxml-lpt.lua | 4 +- tex/context/base/math-ini.mkiv | 13 +- tex/context/base/pack-rul.mkiv | 67 ++- tex/context/base/page-bck.mkiv | 18 +- tex/context/base/page-box.mkvi | 45 +- tex/context/base/page-brk.mkiv | 2 +- tex/context/base/page-mul.mkiv | 50 +-- tex/context/base/page-set.mkiv | 26 +- tex/context/base/spac-ali.mkiv | 6 +- tex/context/base/status-files.pdf | Bin 24313 -> 24310 bytes tex/context/base/status-lua.pdf | Bin 171617 -> 172240 bytes tex/context/base/strc-con.mkvi | 15 +- tex/context/base/strc-flt.mkvi | 30 +- tex/context/base/strc-ini.lua | 21 +- tex/context/base/strc-lst.lua | 8 +- tex/context/base/strc-lst.mkvi | 60 ++- tex/context/base/strc-not.mkvi | 12 +- tex/context/base/syst-aux.mkiv | 8 +- tex/context/base/tabl-tbl.mkiv | 36 +- tex/context/base/type-imp-texgyre.mkiv | 136 +++--- tex/context/base/typo-cap.mkiv | 2 + tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 46 files changed, 1494 insertions(+), 821 deletions(-) create mode 100644 tex/context/base/anch-pgr.lua create mode 100644 tex/context/base/font-var.mkvi (limited to 'tex') diff --git a/tex/context/base/anch-bar.mkiv b/tex/context/base/anch-bar.mkiv index 47cd4835e..bebfaa714 100644 --- a/tex/context/base/anch-bar.mkiv +++ b/tex/context/base/anch-bar.mkiv @@ -110,13 +110,10 @@ linecolor=\getvalue{\??br#1\c!rulecolor}, distance=\the\sidebardistance}}% \stoppositionoverlay - \bpos{side:\the\currentsidebar}\ignorespaces} - -% \def\dostopsidebar#1% -% {\removelastspace\tpos{side:#1}\carryoverpar\egroup} + \bpos{side:\the\currentsidebar}} \unexpanded\def\stopsidebar - {\removelastspace\tpos{side:\the\currentsidebar}\carryoverpar\egroup} + {\removelastspace\epos{side:\the\currentsidebar}\carryoverpar\egroup} \startMPpositionmethod{mpos:bar} \startMPpositiongraphic{mpos:bar}{linecolor,linewidth,distance}% diff --git a/tex/context/base/anch-bck.mkvi b/tex/context/base/anch-bck.mkvi index bfe18a5cb..5ac1b039b 100644 --- a/tex/context/base/anch-bck.mkvi +++ b/tex/context/base/anch-bck.mkvi @@ -22,10 +22,10 @@ % This might be overloaded later on: -\defineoverlay[\v!text-2][\positionoverlay{\v!text-2}] -\defineoverlay[\v!text-1][\positionoverlay{\v!text-1}] -\defineoverlay[\v!text+1][\positionoverlay{\v!text+1}] -\defineoverlay[\v!text+2][\positionoverlay{\v!text+2}] +% \defineoverlay[\v!text-2][\positionoverlay{\v!text-2}] +% \defineoverlay[\v!text-1][\positionoverlay{\v!text-1}] +% \defineoverlay[\v!text+1][\positionoverlay{\v!text+1}] +% \defineoverlay[\v!text+2][\positionoverlay{\v!text+2}] % Paragraph positions: @@ -72,8 +72,6 @@ %D Some MP -\newcount\localpositionnumber % incremented elsewhere - \newcount\MPparcounter \def\MPself {\MPvar{self}} @@ -82,8 +80,7 @@ \def\MPwself {w:\MPvar{self}} \def\MPparanchor {p:\number\MPparcounter} -\def\textbackgroundoverlay#tag{\iflocalpositioning\v!local\else\v!text\fi#tag} -\def\MPanchornumber {\iflocalpositioning\the\localpositionnumber\else\the\realpageno\fi} +% \carryoverpar is needed for left/right floats % \definetextbackground[more][state=start,backgroundcolor=red] % location=paragraph % \definetextbackground[test][state=start,backgroundcolor=green] @@ -216,26 +213,26 @@ \unexpanded\def\stoptextbackground {\anch_backgrounds_text_stop_indeed - \carryoverpar\endgroup} + \carryoverpar\endgroup} % why doesn't this work ? \unexpanded\def\starttextbackgroundmanual {\begingroup \usetextbackgroundstyleandcolor\c!style\c!color - \fpos\v_anch_backgrounds_text_current\ignorespaces} + \bpos\v_anch_backgrounds_text_current} \unexpanded\def\stoptextbackgroundmanual - {\tpos\v_anch_backgrounds_text_current - \endgroup} + {\epos\v_anch_backgrounds_text_current + \carryoverpar\endgroup} \def\anch_backgrounds_text_start_txt {\ifvmode \dontleavehmode \fi \begingroup \usetextbackgroundstyleandcolor\c!style\c!color - \fpos\v_anch_backgrounds_text_current\ignorespaces} + \bpos\v_anch_backgrounds_text_current} \def\anch_backgrounds_text_stop_txt - {\tpos\v_anch_backgrounds_text_current - \endgroup} + {\epos\v_anch_backgrounds_text_current + \carryoverpar\endgroup} \newskip\textbackgroundskip @@ -249,12 +246,12 @@ \ifgridsnapping \spac_helpers_assign_skip\textbackgroundskip{\textbackgroundparameter\c!topoffset}% \ifdim\textbackgroundskip>\zeropoint - \struttedbox{\hbox{\raise\textbackgroundskip\hbox{\fpos\v_anch_backgrounds_text_current}}}% + \struttedbox{\hbox{\raise\textbackgroundskip\hbox{\bpos\v_anch_backgrounds_text_current}}}% \else - \fpos\v_anch_backgrounds_text_current + \bpos\v_anch_backgrounds_text_current \fi \else - \fpos\v_anch_backgrounds_text_current + \bpos\v_anch_backgrounds_text_current \fi \endgraf % we need a vertical nobreak - 29/06/2004 \endgroup @@ -303,15 +300,15 @@ \spac_helpers_assign_skip\textbackgroundskip{\textbackgroundparameter\c!bottomoffset}% \ifgridsnapping % experimental, pascal (todo: topoffset in same way) \ifdim\textbackgroundskip>\zeropoint - \struttedbox\plusone{\hbox{\lower\textbackgroundskip\hbox{\tpos\v_anch_backgrounds_text_current}}}% + \struttedbox\plusone{\hbox{\lower\textbackgroundskip\hbox{\epos\v_anch_backgrounds_text_current}}}% \else - \tpos\v_anch_backgrounds_text_current + \epos\v_anch_backgrounds_text_current \fi \else - \tpos\v_anch_backgrounds_text_current + \epos\v_anch_backgrounds_text_current \fi \endgraf - \endgroup + \carryoverpar\endgroup \endgraf % new \textbackgroundparameter\c!after} @@ -544,7 +541,7 @@ % we can flush 5 in one call (saved 4 lua calls) .. brrr wself .. will change -% \def\MPposset#1{\ctxcommand{MPposset("#1")}} +\def\MPposset#1{\ctxcommand{MPposset("#1")}} \startMPpositionmethod{mpos:par:columnset} \MPparcounter\MPn\MPbself\relax @@ -557,8 +554,8 @@ \startMPpositiongraphic{mpos:par}{fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,gridshift,lineradius} \includeMPgraphic{mpos:par:setup} ; \includeMPgraphic{mpos:par:extra} ; - prepare_multi_pars(\MPpos\MPbself,\MPpos\MPeself,\MPpos\MPwself,\MPpos\MPparanchor,\MPpardata\MPparanchor) ; - % prepare_multi_pars(\MPposset{\MPvar{self}}) ; + % prepare_multi_pars(\MPpos\MPbself,\MPpos\MPeself,\MPpos\MPwself,\MPpos\MPparanchor,\MPpardata\MPparanchor) ; + prepare_multi_pars(\MPposset{\MPvar{self}}) ; relocate_multipars(-\MPxy\MPanchorid) ; % inside layerpos \includeMPgraphic{\MPvar{mp}} ; \stopMPpositiongraphic @@ -566,6 +563,45 @@ \regionpositioningfalse \stopMPpositionmethod +% new: + +% \setuptextbackground +% [\c!mp=mpos:par:region, +% \c!method=mpos:par:region] + +\startMPpositionmethod{mpos:par:region} + \startMPpositiongraphic{mpos:par}{fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,gridshift,lineradius} + \includeMPgraphic{mpos:par:setup} ; + \includeMPgraphic{mpos:par:extra} ; + \ctxcommand{fetchmultipar("\MPvar{self}",\the\realpageno,"\MPanchorid")} + \includeMPgraphic{\MPvar{mp}} ; + setbounds currentpicture to multibox ; + \stopMPpositiongraphic + \MPpositiongraphic{mpos:par}{}% +\stopMPpositionmethod + +\startuseMPgraphic{mpos:par:region} + \iftracepositions + show_multi_pars + \else + draw_multi_pars + \fi ; +\stopuseMPgraphic + +\startuseMPgraphic{mpos:par:region:kind} + for i=1 upto nofmultipars : + fill multipars[i] %^ shifted (0,2mm) + withcolor + if multikind[i] = "single" : yellow + elseif multikind[i] = "first" : red + elseif multikind[i] = "middle" : green + elseif multikind[i] = "last" : blue + fi + withtransparency (1,.5) + ; + endfor ; +\stopuseMPgraphic + %D \starttyping %D \setupbackground %D [test] diff --git a/tex/context/base/anch-pgr.lua b/tex/context/base/anch-pgr.lua new file mode 100644 index 000000000..3d020ca64 --- /dev/null +++ b/tex/context/base/anch-pgr.lua @@ -0,0 +1,480 @@ +if not modules then modules = { } end modules ['anch-pgr'] = { + version = 1.001, + comment = "companion to anch-pgr.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local format = string.format +local concat, sort = table.concat, table.sort +local splitter = lpeg.splitat(":") +local lpegmatch = lpeg.match + +local jobpositions = job.positions + +local report_graphics = logs.reporter("graphics") + +local function pair(x,y) + return format("(%.5fpt,%.5fpt)",x/65536,y/65536) +end + +local function path(t) + return concat(t,"--") .. "--cycle" +end + +local function regionarea(r) + local rx, ry = r.x, r.y + local rw = rx + r.w + local rh = ry + r.h + local rd = ry - r.d + return { + pair(rx, rh - ry), + pair(rw, rh - ry), + pair(rw, rd - ry), + pair(rx, rd - ry), + } +end + +local function add(t,x,y) + local last = t[#t] + if not last or last[1] ~= x or last[2] ~= y then + t[#t+1] = { x, y } + end +end + +local function clip(t,ytop,ybot) + local first, last = 1, #t + for i=first,last do + local y = t[i][2] + if ytop < y then + first = i + end + if ybot > y then + last = i + break + end + end + local lp = { } + lp[#lp+1] = { t[first][1], ytop } + for i=first+1,last-1 do + lp[#lp+1] = { t[i][1], t[i][2] } + end + lp[#lp+1] = { t[last][1], ybot } + return lp +end + +local function shapes(r,rx,ry,rw,rh,rd,lytop,lybot,rytop,rybot) + -- we assume that we only hang per page and not cross pages + -- which makes sense as hanging is only uses in special cases + -- + -- we can remove data as soon as a page is done so we could + -- remember per page and discard areas after each shipout + local paragraphs = r.paragraphs + local left = { { rx, rh } } + local right = { { rw, rh } } + if paragraphs then + for i=1,#paragraphs do + local p = paragraphs[i] + local ha = p.ha + if ha and ha ~= 0 then + local py = p.y + local ph = p.h + local pd = p.d + local hi = p.hi + local hang = ha * (ph + pd) + local py_ph = py + ph + -- ha < 0 hi < 0 : right top + -- ha < 0 hi > 0 : left top + if ha < 0 then + if hi < 0 then -- right + add(right,rw , py_ph) + add(right,rw + hi, py_ph) + add(right,rw + hi, py_ph + hang) + add(right,rw , py_ph + hang) + else + -- left + add(left,rx, py_ph) + add(left,rx + hi, py_ph) + add(left,rx + hi, py_ph + hang) + add(left,rx, py_ph + hang) + end + end + end + end + end + -- we can have a simple variant when no paragraphs + add(left,rx,rd) + add(right,rw,rd) + return clip(left,lytop,lybot), clip(right,rytop,rybot) +end + +local function singlepart(b,e,r,left,right) + local bx, by = b.x, b.y + local ex, ey = e.x, e.y + local rx, ry = r.x, r.y + local rw = rx + r.w + local rh = ry + r.h + local rd = ry - r.d + if left then + rx = rx + left + rw = rw - right + end + local bh = by + b.h + local bd = by - b.d + local eh = ey + e.h + local ed = ey - e.d + local area = { } + local leftshapes, rightshapes = shapes(r,rx,ry,rw,rh,rd,bd,ed,bh,eh) + add(area,bx,bh-ry) + for i=1,#rightshapes do + local ri = rightshapes[i] + add(area,ri[1],ri[2]-ry) + end + add(area,ex,eh-ry) + add(area,ex,ed-ry) + for i=#leftshapes,1,-1 do + local li = leftshapes[i] + add(area,li[1],li[2]-ry) + end + add(area,bx,bd-ry) + for i=1,#area do + local a = area[i] + area[i] = pair(a[1],a[2]) + end + return { -- no collapsing yet + location = "single", + region = r, + area = area, + } +end + +local function firstpart(b,r,left,right) + local bx, by = b.x, b.y + local rx, ry = r.x, r.y + local rw = rx + r.w + local rh = ry + r.h + local rd = ry - r.d + if left then + rx = rx + left + rw = rw - right + end + local bh = by + b.h + local bd = by - b.d + local area = { } + local leftshapes, rightshapes = shapes(r,rx,ry,rw,rh,rd,bd,rd,bh,rd) + add(area,bx,bh-ry) + for i=1,#rightshapes do + local ri = rightshapes[i] + add(area,ri[1],ri[2]-ry) + end + for i=#leftshapes,1,-1 do + local li = leftshapes[i] + add(area,li[1],li[2]-ry) + end + add(area,bx,bd-ry) + for i=1,#area do + local a = area[i] + area[i] = pair(a[1],a[2]) + end + return { + location = "first", + region = r, + area = area, + } +end + +local function middlepart(r,left,right) + local rx, ry = r.x, r.y + local rw = rx + r.w + local rh = ry + r.h + local rd = ry - r.d + if left then + rx = rx + left + rw = rw - right + end + local area = { } + local leftshapes, rightshapes = shapes(r,rx,ry,rw,rh,rd,rh,rd,rh,rd) + for i=#leftshapes,1,-1 do + local li = leftshapes[i] + add(area,li[1],li[2]-ry) + end + for i=1,#rightshapes do + local ri = rightshapes[i] + add(area,ri[1],ri[2]-ry) + end + for i=1,#area do + local a = area[i] + area[i] = pair(a[1],a[2]) + end + return { + location = "middle", + region = r, + area = area, + } +end + +local function lastpart(e,r,left,right) + local ex, ey = e.x, e.y + local rx, ry = r.x, r.y + local rw = rx + r.w + local rh = ry + r.h + local rd = ry - r.d + if left then + rx = rx + left + rw = rw - right + end + local eh = ey + e.h + local ed = ey - e.d + local area = { } + -- two cases: till end and halfway e line + local leftshapes, rightshapes = shapes(r,rx,ry,rw,rh,rd,rh,ed,rh,eh) + for i=1,#rightshapes do + local ri = rightshapes[i] + add(area,ri[1],ri[2]-ry) + end + add(area,ex,eh-ry) + add(area,ex,ed-ry) + for i=#leftshapes,1,-1 do + local li = leftshapes[i] + add(area,li[1],li[2]-ry) + end + for i=1,#area do + local a = area[i] + area[i] = pair(a[1],a[2]) + end + return { + location = "last", + region = r, + area = area, + } +end + +graphics = graphics or { } +local backgrounds = { } + +graphics.backgrounds = backgrounds + +local function calculate(tag) + local collected = jobpositions.collected + local b = collected[format("b:%s",tag)] + local e = collected[format("e:%s",tag)] + if not b or not e then + report_graphics("invalid tag '%s'",tag) + return { } + end + local br = b.r + local er = e.r + if not br or not er then + report_graphics("invalid region for '%s'",tag) + return { } + end + local btag, bindex = lpegmatch(splitter,br) + local etag, eindex = lpegmatch(splitter,er) + if not bindex or not eindex or btag ~= etag then + report_graphics("invalid indices for '%s'",tag) + return { } + end + local bindex = tonumber(bindex) + local eindex = tonumber(eindex) + -- Here we compensate for columns (in tables): a table can have a set of column + -- entries and these are shared. We compensate left/right based on the columns + -- x and w but need to take the region into acount where the specification was + -- flushed and not the begin pos's region, because otherwise we get the wrong + -- compensation for assymetrical doublesided layouts. + local left = 0 + local right = 0 + local rc = b.c + if rc then + rc = collected[rc] + if rc then + local tb = collected[rc.r] + if tb then + left = -(tb.x - rc.x) + right = (tb.w - rc.w - left) -- tb.x - rc.x + end + end + end + -- Obeying intermediate changes of left/rightskip makes no sense as it will + -- look bad, so we only look at the begin situation. + -- + local bn = b.n + if bn then + local bp = collected[format("p:%s",bn)] + if bp then + left = left + bp.ls + right = right + bp.rs + end + end + -- + if bindex == eindex then + return { + [b.p] = { singlepart(b,e,collected[br],left,right) } + } + else + local pars = { + [b.p] = { firstpart(b,collected[br],left,right) } + } + for i=bindex+1,eindex-1 do + br = format("%s:%s",btag,i) + local r = collected[br] + if not r then + report_graphics("invalid middle for '%s'",br) + else + local p = r.p + local pp = pars[p] + if pp then + pp[#pp+1] = middlepart(r,left,right) + else + pars[p] = { middlepart(r,left,right) } + end + end + end + local p = e.p + local pp = pars[p] + if pp then + pp[#pp+1] = lastpart(e,collected[er],left,right) + else + pars[p] = { lastpart(e,collected[er],left,right) } + end + return pars + end +end + +local pending = { } -- needs gc + +local function register(data,n,anchor) + local pa = pending[anchor] + if not pa then + pa = { } + pending[anchor] = pa + end + for page, pagedata in next, data do + local pap = pa[page] + if pap then + pap[#pap+1] = n + else + pa[page] = { n } + end + end +end + +function graphics.backgrounds.registered(anchor,page) + local pa = pending[anchor] + if pa then + concat(pa,",") + else + return "" + end +end + +local pbg = { } -- will move to pending + +function graphics.backgrounds.calculate(n) + if not pbg[n] then + pbg[n] = calculate("pbg",n) or { } + end +end + +local multilocs = { + single = 1, -- maybe 0 + first = 1, + middle = 2, + last = 3, +} + +local template_a = [[ +path multiregs[], multipars[], multibox ; +string multikind[] ; +numeric multilocs[], nofmultipars ; +nofmultipars := %s ; +multibox := unitsquare xyscaled %s ; +]] + +local template_b = [[ +multilocs[%s] := %s ; +multikind[%s] := "%s" ; +multipars[%s] := (%s) shifted - %s ; +]] + +local template_c = [[ +multiregs[%s] := (%s) shifted - %s ; +]] + +local template_d = [[ +setbounds currentpicture to multibox ; +]] + +function graphics.backgrounds.fetch(n,page,anchor) + local data = pbg[n] + if not data then + data = calculate(n) + pbg[n] = data -- can be replaced by register + register(data,n,anchor) + end + if data then + local pagedata = data[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 result = { format(template_a,nofmultipars,pair(w,h+d)) } + 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 + end + end + return format(template_a,0,"origin") +end + +function commands.fetchmultipar(n,page,anchor) + context(graphics.backgrounds.fetch(n,page,anchor)) +end + +local doifelse = commands.doifelse + +function commands.doifelsemultipar(n,page) + local data = pbg[n] + if not data then + data = calculate(n) + pbg[n] = data + end + if page then + doifelse(data and data[page] and true) + else + doifelse(data and next(data) and true) + end +end + +function commands.doifelserangeonpage(first,last,page) + local collected = jobpositions.collected + local f = collected[first] + if not f then + doifelse(false) + return + end + local l = collected[last] + if not l then + doifelse(false) + return + end + doifelse(page >= f.p and page <= l.p) +end diff --git a/tex/context/base/anch-pgr.mkiv b/tex/context/base/anch-pgr.mkiv index 8b586c5b2..e882dba41 100644 --- a/tex/context/base/anch-pgr.mkiv +++ b/tex/context/base/anch-pgr.mkiv @@ -17,23 +17,14 @@ %D the reference point on the page. The next macros do so and %D are hooked into the page building routine. -\unprotect - -%D Here we implement position actions (was a dummy). +\registerctxluafile{anch-pgr}{1.001} -\unexpanded\def\showanchor#1% - {\normalexpanded{\writestatus{#1} - {\MPp{#1}\string|\MPx{#1}\string|\MPy{#1}\string|\MPw{#1}\string|\MPh{#1}\string|\MPd{#1}}}} +\unprotect -%D A few more low level macros take care of defining and -%D recalling actions. We could save this information in the -%D position containers themselves, this would save hash -%D entries, but at the cost of much more time consuming -%D expansion. Actions are saved globally! -%D -%D The lists can become quite long (also because there can -%D be lots of parameters passed on) so we provide a hook -%D to clean up the list afterwards. +%D A few more low level macros take care of defining and recalling +%D actions. Actions are saved globally! The lists can become quite +%D long because there can be lots of parameters passed on so we +%D clean up the list afterwards. \newtoks\everypositionaction \newtoks\everyinsertpositionaction @@ -43,41 +34,46 @@ \installcorenamespace{positioncleanup} \unexpanded\def\dosetpositionaction#1% - {\setgvalue{\??positionaction#1}} + {\expandafter\gdef\csname\??positionaction#1\endcsname} % nicely gobbles spaces -\def\doifpositionaction#1% +\unexpanded\def\doifpositionaction#1% {\ifcsname\??positionaction#1\endcsname \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\def\doifpositionactionelse#1% +\unexpanded\def\doifpositionactionelse#1% {\ifcsname\??positionaction#1\endcsname \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\def\dopositionaction#1% test saves hash entry in etex - {\ifcsname\??positionaction#1\endcsname - \anch_positions_action_indeed{#1}% +\unexpanded\def\dopositionaction#1% + {\edef\currentpositionaction{#1}% + \ifcsname\??positionaction\currentpositionaction\endcsname + \anch_positions_action_indeed \fi} -\def\anch_positions_action_indeed#1% - {\ifcase\MPp{#1}\relax - \traceposstring\clap\cyan{<#1>}% shouldn't happen too often - \else - \begingroup - \setbox\scratchbox\hbox - {\traceposstring\clap\red{<#1>}% - \the\everyinsertpositionaction - \the\everypositionaction - \csname\??positionaction#1\endcsname - \anch_positions_cleanup_action{#1}}% - \smashedbox\scratchbox % smashing is really needed else we get problems with too big overlays - \endgroup - \fi} +\def\anch_positions_action_indeed + {\doifpositionelse\currentpositionaction + \anch_positions_action_indeed_yes + \anch_positions_action_indeed_nop} + +\def\anch_positions_action_indeed_nop + {\traceposstring\clap\cyan{<\currentpositionaction>}} + +\def\anch_positions_action_indeed_yes % we need a way to figure out if we have actions + {\begingroup + \setbox\scratchbox\hbox + {\traceposstring\clap\red{<\currentpositionaction>}% + \the\everyinsertpositionaction + \the\everypositionaction + \csname\??positionaction\currentpositionaction\endcsname + \anch_positions_cleanup_action}% + \smashedbox\scratchbox % smashing is really needed else we get problems with too big overlays + \endgroup} %D Here the complication has to do with collecting actions %D for later execution. This collection is especially handy @@ -85,79 +81,38 @@ %D series of actions are stored in a macro that is cleaned up %D after each invocation. -% this can probably be done better - -% \def\anch_positions_cleanup_action#1% not in trialtypesetting -% {\ifcsname\??positioncleanup#1\endcsname -% \the\everycleanpositionaction -% \iflocalpositioning -% \letgvalue{\??positioncleanup#1}\empty -% \else -% \setxvalue{\??positioncleanup#1}{\getvalue{\??positioncleanup#1}}% -% \fi -% \fi} - -\def\anch_positions_cleanup_action#1% not in trialtypesetting - {\ifcsname\??positioncleanup#1\endcsname +\def\anch_positions_cleanup_action % not in trialtypesetting + {\ifcsname\??positioncleanup\currentpositionaction\endcsname \the\everycleanpositionaction \iflocalpositioning % erase - \expandafter\let\csname\??positioncleanup#1\endcsname\empty + \expandafter\let\csname\??positioncleanup\currentpositionaction\endcsname\empty \else - % globalize - \global\expandafter\let\csname\??positioncleanup#1\expandafter\endcsname\csname\??positioncleanup#1\endcsname + % globalize expansion cleans up + \setxvalue{\??positioncleanup\currentpositionaction}{\csname\??positioncleanup\currentpositionaction\endcsname}% \fi \fi} \def\handlepositionaction#1\with#2\on#3% ugly {\begingroup - \edef\!!stringa{\ifx\currentpositionoverlay\empty#3\else\currentpositionoverlay::\MPanchoridentifier\fi}% - \edef\!!stringc{\??positioncleanup\!!stringa}% - \normalexpanded{\dosetpositionaction{\!!stringa}{\noexpand\getvalue{\!!stringc}}}% - \global\let#1\relax - \edef\!!stringb{\ifcsname\!!stringc\endcsname\csname\!!stringc\endcsname\fi}% why ... - \setxvalue\!!stringc{\!!stringb#1#2}% + \edef\currentpositionanchor + {\ifx\currentpositionoverlay\empty#3\else\currentpositionoverlay::\MPanchoridentifier\fi}% + \normalexpanded{\dosetpositionaction{\currentpositionanchor}{\noexpand\getvalue{\??positioncleanup\currentpositionanchor}}}% + \let#1\relax + \ifcsname\??positioncleanup\currentpositionanchor\endcsname + \setxvalue{\??positioncleanup\currentpositionanchor}% + {\csname\??positioncleanup\currentpositionanchor\endcsname#1#2}% + \else + \setxvalue{\??positioncleanup\currentpositionanchor}% + {#1#2}% + \fi \endgroup} -%D The next macros do some housekeeping. - -\def\pageanchor {page:0} % for the moment only one pagesize -\def\textanchor {text:\the\realpageno} -\def\regionanchor{region:0} % placeholder - %D The first version of this module implemented head and tail %D anchors. Currently we stick to just one anchor and derive %D the head and tail anchors from this one. We set these %D anchors before and after each page. -% FOR THE MOMENT DISABLED (was downward compatibity issue) -% -% \def\headanchor{head:\the\realpageno} % virtual position -% \def\tailanchor{tail:\the\realpageno} % virtual position -% -% \def\presetpositionanchors % is this still needed? -% {\ifpositioning -% \anch_positions_preset_anchors -% \fi} -% -% \def\anch_positions_preset_anchors -% {\begingroup -% \!!dimena\ifdim\topskip>\strutht\topskip\else\strutht\fi -% \!!dimenb\dimexpr\MPy\textanchor+\MPh\textanchor-\!!dimena\relax -% \!!dimenc\dimexpr\MPy\textanchor+\strutdp\relax -% \!!dimend\MPx\textanchor -% \!!dimene\MPw\textanchor -% \replacepospxywhd\headanchor\realfolio\!!dimend\!!dimenb\!!dimene\!!dimena\strutdp -% \replacepospxywhd\tailanchor\realfolio\!!dimend\!!dimenc\!!dimene\strutht \strutdp -% \endgroup} -% -% \appendtoks \presetpositionanchors \to \beforeeverypage -% \appendtoks \presetpositionanchors \to \aftereverypage - -% todo: change with each page size change .. can be made more efficient -% as some values are the same .. this one can (at some point) be used -% to provide correction for imposition - \unexpanded\def\anch_positions_register_page#1% this one is flushed first ! ... can't we avoid this one {\ifpositioning\ifcase\realpageno\or \ifdim\printpaperheight=\paperheight @@ -171,8 +126,12 @@ \fi \fi\fi} -\def\anch_positions_register_page_indeed#1% - {\setbox#1\hbox{\hpos\pageanchor{\box#1}}} +% \def\anch_positions_register_page_indeed#1% +% {\setbox#1\hbox{\hpos\pageanchor{\box#1}}} + +\def\anch_positions_register_page_indeed#1% maybe like text + {\ifvbox#1\setbox#1\hbox{\box#1}\fi + \anch_make_page_box{#1}} \unexpanded\def\anch_positions_place_anchors {\ifpositioning @@ -181,32 +140,19 @@ \anch_positions_place_anchors_nop \fi} -% FOR THE MOMENT DISABLED -% -% \def\anch_positions_place_anchors_yes % todo : depth pagebox -% {\begingroup -% \setbox\scratchbox\vbox to \textheight -% {\simpletopskipcorrection -% \hbox{\strut\dopositionaction\headanchor}% ! actions on a virtual position -% \vfill -% \hbox{\strut\dopositionaction\tailanchor}}% ! actions on a virtual position -% \dp\scratchbox\zeropoint -% \wd\scratchbox\makeupwidth % not \zeropoint, else wrong text backgrounds -% \hpos\textanchor{\box\scratchbox}% -% \endgroup} - \def\anch_positions_place_anchors_yes % todo : depth pagebox {\begingroup - \setbox\scratchbox\emptyvbox + \setbox\scratchbox\emptyhbox \ht\scratchbox\textheight \dp\scratchbox\zeropoint \wd\scratchbox\makeupwidth - \hpos\textanchor{\box\scratchbox}% + \anch_mark_text_box\scratchbox + \box\scratchbox \endgroup} \def\anch_positions_place_anchors_nop {\vskip\textheight} - + %D \macros %D {positionoverlay,startpositionoverlay} %D @@ -257,8 +203,8 @@ %D %D \typebuffer[graphic] -\def\MPanchoridentifier{mpa} % {mp-anchor} -\def\MPoverlayposprefix{MO::} +\def\MPanchoridentifier{mpa} % {mp-anchor} +\def\MPoverlayposprefix{MO::} % not used %D The rest of the definitions concerning such overlays may %D look complicated, @@ -268,7 +214,10 @@ %D Position actions are automatically executed when a position %D is set. -\let\MPanchornumber\realfolio +\newcount\localpositionnumber % incremented elsewhere + +\def\textbackgroundoverlay#1{\iflocalpositioning\v!local\else\v!text\fi#1} +\def\MPanchornumber {\the\iflocalpositioning\localpositionnumber\else\realpageno\fi} \def\positionoverlay % the test prevents too many redundant positions {\ifpositioning % in (not used) text* position layers @@ -277,53 +226,50 @@ \expandafter\gobbleoneargument \fi} -% keep this for a while -% -% \def\anch_positions_overlay_indeed#1% the test prevents too many redundant positions -% {\vbox to \overlayheight -% {\doifpositionactionelse{#1::\MPanchoridentifier}% -% {\edef\MPanchorid{#1::\MPanchoridentifier:\MPanchornumber}% -% \edef\MPanchor##1{\MPpos{\MPanchorid}}% -% \the\everyinsertpositionaction -% \copyposition{#1::\MPanchoridentifier}{#1::\MPanchoridentifier:\MPanchornumber}% -% \hpos -% {#1::\MPanchoridentifier:\MPanchornumber}% -% % this is ok -% %{\hbox to \overlaywidth{\dopositionaction{#1::\MPanchoridentifier}\hss}}}% -% % but this one prevents cyclic runs due to -% % rounding errors -% {\setbox\scratchbox\hbox to \overlaywidth{\dopositionaction{#1::\MPanchoridentifier}\hss}% -% \ht\scratchbox\overlayheight -% \dp\scratchbox\zeropoint -% \box\scratchbox}}% -% {\hbox to \overlaywidth{\hss}}% -% \vfill}} - \def\anch_positions_overlay_indeed#1% - {\doifpositionactionelse{#1::\MPanchoridentifier}% - \anch_positions_overlay_yes\anch_positions_overlay_nop{#1}} + {\begingroup + \edef\currentpositionoverlay{#1}% + \ifcsname\??positionaction\currentpositionoverlay::\MPanchoridentifier\endcsname + \anch_positions_overlay_compose + \fi + \endgroup} + +\def\MPoverlayanchor#1{\MPpos\MPanchorid} -\def\anch_positions_overlay_yes#1% +\def\anch_positions_overlay_compose {\vbox to \overlayheight - {\edef\MPanchorid{#1::\MPanchoridentifier:\MPanchornumber}% - \edef\MPanchor##1{\MPpos\MPanchorid}% + {%\writestatus{!!!}{\currentpositionoverlay/\MPanchoridentifier/\MPanchornumber}% + \edef\MPanchorid{\currentpositionoverlay::\MPanchoridentifier:\MPanchornumber}% realpageno +% \edef\MPanchor##1{\MPpos\MPanchorid}% + \let\MPanchor\MPoverlayanchor % no need to fetch it already, seldom used \the\everyinsertpositionaction - \copyposition{#1::\MPanchoridentifier}\MPanchorid - \hpos \MPanchorid - %{\hbox to \overlaywidth{\dopositionaction{#1::\MPanchoridentifier}\hss}}}% oscillation due to rounding issues - {\setbox\scratchbox\hbox to \overlaywidth{\dopositionaction{#1::\MPanchoridentifier}\hss}% - \ht\scratchbox\overlayheight - \dp\scratchbox\zeropoint - \box\scratchbox}% + \copyposition{\currentpositionoverlay::\MPanchoridentifier}\MPanchorid + \setbox\scratchbox\hbox to \overlaywidth{\dopositionaction{\currentpositionoverlay::\MPanchoridentifier}\hss}% + \ht\scratchbox\overlayheight + \dp\scratchbox\zeropoint +\ctxcommand{markregionbox(\number\scratchbox,"\MPanchorid")}% needs an hbox + \box\scratchbox \vfill}} -% \def\anch_positions_overlay_nop#1% -% {\setbox\scratchbox\emptyvbox -% \ht\scratchbox\overlayheight -% \wd\scratchbox\overlaywidth -% \box\scratchbox} +\def\positionregionoverlay % shares regions + {\ifpositioning + \expandafter\anch_positions_region_overlay_indeed + \else % also \iftrialtypesetting test here? + \expandafter\gobbletwoarguments + \fi} + +\let\currentpositionregion\empty + +\def\anch_positions_region_overlay_indeed#1#2% + {\begingroup + \edef\currentpositionregion {#1}% + \edef\currentpositionoverlay{#2}% + \ifcsname\??positionaction\currentpositionoverlay::\MPanchoridentifier\endcsname + \anch_positions_region_overlay_compose + \fi + \endgroup} -\let\anch_positions_overlay_nop\gobbleoneargument +% \let\anch_positions_overlay_nop\gobbleoneargument \unexpanded\def\startpositionoverlay {\iftrialtypesetting @@ -341,15 +287,15 @@ \unexpanded\def\stoppositionoverlay {\let\currentpositionoverlay\empty} -\def\resetpositionoverlay#1% - {\dosetpositionaction{#1::\MPanchoridentifier::}{}} +% \def\resetpositionoverlay#1% +% {\dosetpositionaction{#1::\MPanchoridentifier::}{}} \def\handlepositionboxes#1#2#3% {\handlepositionaction\dohandlepositionboxes\with{#1}{#2}{#3}\on{#2}} \def\doinsertpositionboxes#1#2#3% pos tag setups {\ifnum\MPp{#1}=\realpageno\relax % can be sped up - \executeifdefined{\MPoverlayposprefix#1}\gobblethreearguments{#1}{#2}{#3}% + \executeifdefined{\MPoverlayposprefix#1}\gobblethreearguments{#1}{#2}{#3}% not used \fi} \appendtoks @@ -423,10 +369,9 @@ \setupMPvariables[#2][#3]% \edef\currentmpvariableclass{#2}% \anch_positions_meta_graphic_prepare - \obeyMPboxorigin % do we also set the size ? + \obeyMPboxorigin % do we also set the size ? when needed this must be done in mp ... might change \def\anch_positions_meta_graphic_direct{\anch_positions_meta_graphic_nested{#3}}% takes two extra arguments - \setbox\positiongraphicbox\hbox - {\ignorespaces\csname#1#2\endcsname\removelastspace}% + \setbox\positiongraphicbox\hbox{\ignorespaces\csname#1#2\endcsname\removelastspace}% \smashbox\positiongraphicbox \box\positiongraphicbox \endgroup} @@ -493,23 +438,11 @@ {\handlepositionaction\dohandleMPpositiongraphicrange\with{#1}{#2}{#3}{#4}\on{#2}} \def\doinsertMPpositiongraphicrange#1#2#3#4% pos pos tag setups - {\ifnum\MPp{#1}\MPp{#2}>\zerocount - \iflocalpositioning - \donetrue - \else - \donefalse - \ifnum\MPp{#1}=\realpageno - \donetrue - \else\ifnum\MPp{#2}=\realpageno - \donetrue - \else\ifnum\MPp{#1}<\realpageno\relax\ifnum\MPp{#2}>\realpageno - \donetrue - \fi\fi\fi\fi - \fi - \ifdone - \def\currentposition{#1}\MPpositiongraphic{#3}{#4}% - \fi - \fi} + {\ctxcommand{doifelserangeonpage("#1","#2",\number\realpageno)}% + {%\writestatus{YES}{#1/#2 => #3}% + \def\currentposition{#1}% + \MPpositiongraphic{#3}{#4}}% + {}}%\writestatus{NOP}{#1/#2 = #3}}} \appendtoks \let\dohandleMPpositiongraphicrange\doinsertMPpositiongraphicrange diff --git a/tex/context/base/anch-pos.lua b/tex/context/base/anch-pos.lua index 60fc985a2..184da3b9c 100644 --- a/tex/context/base/anch-pos.lua +++ b/tex/context/base/anch-pos.lua @@ -17,8 +17,9 @@ more efficient.

-- maybe replace texsp by our own converter (stay at the lua end) -- eventually mp will have large numbers so we can use sp there too -local tostring = tostring -local concat, format, gmatch, match = table.concat, string.format, string.gmatch, string.match +local tostring, next, rawget, setmetatable = tostring, next, rawget, setmetatable +local concat, sort = table.concat, table.sort +local format, gmatch, match = string.format, string.gmatch, string.match local rawget = rawget local lpegmatch = lpeg.match local insert, remove = table.insert, table.remove @@ -51,9 +52,59 @@ job.positions = jobpositions _plib_ = jobpositions +local default = { + __index = { + x = 0, -- x position baseline + y = 0, -- y position baseline + w = 0, -- width + h = 0, -- height + d = 0, -- depth + p = 0, -- page + ls = 0, -- leftskip + rs = 0, -- rightskip + hi = 0, -- hangindent + ha = 0, -- hangafter + hs = 0, -- hsize + pi = 0, -- parindent + } +} + +local function sorter(a,b) + return a.y > b.y +end + local function initializer() tobesaved = jobpositions.tobesaved collected = jobpositions.collected + -- enhance regions with paragraphs + for tag, data in next, collected do + local hi = data.hi + if hi and hi ~= 0 then + local region = data.r + if region then + local r = collected[region] + local paragraphs = r.paragraphs + if not paragraphs then + r.paragraphs = { data } + else + paragraphs[#paragraphs+1] = data + end + end + end + end + -- sort this data and add metatable + for tag, data in next, collected do + local region = data.r + if region then + local r = collected[region] + local paragraphs = r.paragraphs + if paragraphs and #paragraphs > 1 then + sort(paragraphs,sorter) + end + end + -- so, we can be sparse and don't need 'or 0' code + setmetatable(data,default) + end end job.register('job.positions.collected', tobesaved, initializer) @@ -61,8 +112,11 @@ job.register('job.positions.collected', tobesaved, initializer) local regions = { } local nofregions = 0 local region = nil + +local columns = { } local nofcolumns = 0 local column = nil + local nofpages = nil -- beware ... we're not sparse here as lua will reserve slots for the nilled @@ -124,10 +178,10 @@ local function enhance(data) if data.y == true then data.y = pdf.v end - if data.p == true then -- or 0 + if data.p == true then data.p = texcount.realpageno end - if data.c == true then -- or 0 + if data.c == true then data.c = column end if data.w == 0 then @@ -172,35 +226,48 @@ jobpositions.setall = setall jobpositions.set = set jobpositions.get = get --- function jobpositions.pushregion(tag,w,h,d) --- if w then --- setdim(tag,w,h,d) --- end --- insert(regions,tag) --- region = tag --- end - --- function jobpositions.popregion() --- remove(regions) --- region = regions[#regions] --- end - --- function jobpositions.markregionbox(n,tag) --- if not tag or tag == "" then --- nofregions = nofregions + 1 --- tag = nofregions --- end --- local box = texbox[n] --- local push = new_latelua(format("_plib_.pushregion(%q,%s,%s,%s)",tag,box.width,box.height,box.depth)) --- local pop = new_latelua("_plib_.popregion()") --- local head = box.list --- local tail = find_tail(head) --- head.prev = push --- push.next = head --- pop .prev = tail --- tail.next = pop --- box.list = push --- end +-- will become private table (could also become attribute driven but too nasty +-- as attributes can bleed e.g. in margin stuff) + +function jobpositions.b_col(tag) + tobesaved[tag] = { + r = true, + x = pdf.h, + w = 0, + } + insert(columns,tag) + column = tag +end + +function jobpositions.e_col(tag) + local t = tobesaved[column] + if not t then + -- something's wrong + else + t.w = pdf.h - t.x + t.r = region + end + remove(columns) + column = columns[#columns] +end + +function commands.bcolumn(tag,register) + insert(columns,tag) + column = tag + if register then + context(new_latelua(format("_plib_.b_col(%q)",tag))) + end +end + +function commands.ecolumn(register) + if register then + context(new_latelua("_plib_.e_col()")) + end + remove(columns) + column = columns[#columns] +end + +-- regions function jobpositions.b_region(tag) local last = tobesaved[tag] @@ -211,8 +278,8 @@ function jobpositions.b_region(tag) end function jobpositions.e_region() - remove(regions) tobesaved[region].y = pdf.v + remove(regions) region = regions[#regions] end @@ -222,56 +289,20 @@ function jobpositions.markregionbox(n,tag) tag = format("region:%s",nofregions) end local box = texbox[n] + local w = box.width + local h = box.height + local d = box.depth tobesaved[tag] = { p = true, x = true, y = true, - w = box.width, - h = box.height, - d = box.depth, + w = w ~= 0 and w or nil, + h = h ~= 0 and h or nil, + d = d ~= 0 and d or nil, } local push = new_latelua(format("_plib_.b_region(%q)",tag)) local pop = new_latelua("_plib_.e_region()") - local head = box.list - local tail = find_tail(head) - head.prev = push - push.next = head - pop .prev = tail - tail.next = pop - box.list = push -end - --- here the page is part of the column so we can only save when we reassign --- the table (column:* => column:*:*) - -function jobpositions.b_column(w,h,d) -- there can be multiple column ranges per page - local page = texcount.realpageno -- we could have a nice page synchronizer (saves calls) - if page ~= nofpages then - nofpages = page - nofcolumns = 1 - else - nofcolumns = nofcolumns + 1 - end - column = nofcolumns - if w then - set(format("column:%s:%s",page,column), { - x = true, - y = true, - w = w, - h = h, - d = d, - }) - end -end - -function jobpositions.e_column() - column = nil -end - -function jobpositions.markcolumnbox(n,column) - local box = texbox[n] - local push = new_latelua(format("_plib_.b_column(%s,%s,%s)",box.width,box.height,box.depth)) - local pop = new_latelua("_plib_.e_column()") + -- maybe we should construct a hbox first (needs experimenting) so that we can avoid some at the tex end local head = box.list if head then local tail = find_tail(head) @@ -303,7 +334,8 @@ function commands.parpos() -- todo: relate to localpar (so this is an intermedia local strutbox = texbox.strutbox local t = { p = true, - -- c = true, + c = true, + r = true, x = true, y = true, h = strutbox.height, @@ -338,7 +370,7 @@ end function commands.posxy(name) -- can node.write be used here? tobesaved[name] = { p = true, - -- c = true, + c = column, r = true, x = true, y = true, @@ -350,7 +382,7 @@ end function commands.poswhd(name,w,h,d) tobesaved[name] = { p = true, - -- c = true, + c = column, r = true, x = true, y = true, @@ -365,7 +397,7 @@ end function commands.posplus(name,w,h,d,extra) tobesaved[name] = { p = true, - -- c = true, + c = column, r = true, x = true, y = true, @@ -382,7 +414,7 @@ function commands.posstrut(name,w,h,d) local strutbox = texbox.strutbox tobesaved[name] = { p = true, - -- c = true, + c = column, r = true, x = true, y = true, @@ -414,22 +446,12 @@ function jobpositions.copy(target,source) end function jobpositions.replace(id,p,x,y,w,h,d) --- local t = collected[id] --- if t then --- t.p = p or t.p --- t.x = x or t.x --- t.y = y or t.y --- t.w = w or t.w --- t.h = h or t.h --- t.d = d or t.d --- else - collected[id] = { p = p, x = x, y = y, w = w, h = h, d = d } --- end + collected[id] = { p = p, x = x, y = y, w = w, h = h, d = d } -- c g end function jobpositions.page(id) local jpi = collected[id] - return jpi and jpi.p or 0 + return jpi and jpi.p end function jobpositions.region(id) @@ -444,7 +466,7 @@ end function jobpositions.paragraph(id) local jpi = collected[id] - return jpi and jpi.n or 0 + return jpi and jpi.n end jobpositions.p = jobpositions.page @@ -454,52 +476,52 @@ jobpositions.n = jobpositions.paragraph function jobpositions.x(id) local jpi = collected[id] - return jpi and jpi.x or 0 + return jpi and jpi.x end function jobpositions.y(id) local jpi = collected[id] - return jpi and jpi.y or 0 + return jpi and jpi.y end function jobpositions.width(id) local jpi = collected[id] - return jpi and jpi.w or 0 + return jpi and jpi.w end function jobpositions.height(id) local jpi = collected[id] - return jpi and jpi.h or 0 + return jpi and jpi.h end function jobpositions.depth(id) local jpi = collected[id] - return jpi and jpi.d or 0 + return jpi and jpi.d end function jobpositions.leftskip(id) local jpi = collected[id] - return jpi and jpi.ls or 0 + return jpi and jpi.ls end function jobpositions.rightskip(id) local jpi = collected[id] - return jpi and jpi.rs or 0 + return jpi and jpi.rs end function jobpositions.hsize(id) local jpi = collected[id] - return jpi and jpi.hs or 0 + return jpi and jpi.hs end function jobpositions.parindent(id) local jpi = collected[id] - return jpi and jpi.pi or 0 + return jpi and jpi.pi end function jobpositions.hangindent(id) local jpi = collected[id] - return jpi and jpi.hi or 0 + return jpi and jpi.hi end function jobpositions.hangafter(id) @@ -510,9 +532,7 @@ end function jobpositions.xy(id) local jpi = collected[id] if jpi then - local x = jpi.x or 0 - local y = jpi.y or 0 - return x, y + return jpi.x, jpi.y else return 0, 0 end @@ -521,10 +541,7 @@ end function jobpositions.lowerleft(id) local jpi = collected[id] if jpi then - local x = jpi.x or 0 - local y = jpi.y or 0 - local d = jpi.d or 0 - return x, y - d + return jpi.x, jpi.y - jpi.d else return 0, 0 end @@ -533,11 +550,7 @@ end function jobpositions.lowerright(id) local jpi = collected[id] if jpi then - local x = jpi.x or 0 - local y = jpi.y or 0 - local w = jpi.w or 0 - local d = jpi.d or 0 - return x + w, y - d + return jpi.x + jpi.w, jpi.y - jpi.d else return 0, 0 end @@ -546,11 +559,7 @@ end function jobpositions.upperright(id) local jpi = collected[id] if jpi then - local x = jpi.x or 0 - local y = jpi.y or 0 - local w = jpi.w or 0 - local h = jpi.h or 0 - return x + w, y + h + return jpi.x + jpi.w, jpi.y + jpi.h else return 0, 0 end @@ -559,10 +568,7 @@ end function jobpositions.upperleft(id) local jpi = collected[id] if jpi then - local x = jpi.x or 0 - local y = jpi.y or 0 - local h = jpi.h or 0 - return x, y + h + return jpi.x, jpi.y + jpi.h else return 0, 0 end @@ -571,7 +577,7 @@ end function jobpositions.position(id) local jpi = collected[id] if jpi then - return jpi.p or 0, jpi.x or 0, jpi.y or 0, jpi.w or 0, jpi.h or 0, jpi.d or 0 + return jpi.p, jpi.x, jpi.y, jpi.w, jpi.h, jpi.d else return 0, 0, 0, 0, 0, 0 end @@ -600,31 +606,31 @@ local function overlapping(one,two,overlappingmargin) -- hm, strings so this is if not overlappingmargin then overlappingmargin = 2 end - local x_one = one.x or 0 - local x_two = two.x or 0 - local w_two = two.w or 0 + local x_one = one.x + local x_two = two.x + local w_two = two.w local llx_one = x_one - overlappingmargin local urx_two = x_two + w_two + overlappingmargin if llx_one > urx_two then return false end - local w_one = one.w or 0 + local w_one = one.w local urx_one = x_one + w_one + overlappingmargin local llx_two = x_two - overlappingmargin if urx_one < llx_two then return false end - local y_one = one.y or 0 - local y_two = two.y or 0 - local d_one = one.d or 0 - local h_two = two.h or 0 + local y_one = one.y + local y_two = two.y + local d_one = one.d + local h_two = two.h local lly_one = y_one - d_one - overlappingmargin local ury_two = y_two + h_two + overlappingmargin if lly_one > ury_two then return false end - local h_one = one.h or 0 - local d_two = two.d or 0 + local h_one = one.h + local d_two = two.d local ury_one = y_one + h_one + overlappingmargin local lly_two = y_two - d_two - overlappingmargin if ury_one < lly_two then @@ -663,7 +669,7 @@ function commands.MPp(id) local jpi = collected[id] if jpi then local p = jpi.p - if p then + if p and p ~= true then context(p) return end @@ -675,8 +681,8 @@ function commands.MPx(id) local jpi = collected[id] if jpi then local x = jpi.x - if x then - context("%spt",x*pt) + if x and p ~= true then + context("%.5fpt",x*pt) return end end @@ -687,8 +693,8 @@ function commands.MPy(id) local jpi = collected[id] if jpi then local y = jpi.y - if y then - context("%spt",y*pt) + if y and p ~= true then + context("%.5fpt",y*pt) return end end @@ -700,7 +706,7 @@ function commands.MPw(id) if jpi then local w = jpi.w if w then - context("%spt",w*pt) + context("%.5fpt",w*pt) return end end @@ -712,7 +718,7 @@ function commands.MPh(id) if jpi then local h = jpi.h if h then - context("%spt",h*pt) + context("%.5fpt",h*pt) return end end @@ -733,9 +739,9 @@ end function commands.MPxy(id) local jpi = collected[id] if jpi then - context('(%spt,%spt)', - (jpi.x or 0)*pt, - (jpi.y or 0)*pt + context('(%.5fpt,%.5fpt)', + jpi.x*pt, + jpi.y*pt ) else context('(0,0)') @@ -745,48 +751,48 @@ end function commands.MPll(id) local jpi = collected[id] if jpi then - context('(%spt,%spt)', - (jpi.x or 0) *pt, - ((jpi.y or 0)-(jpi.d or 0))*pt + context('(%.5fpt,%.5fpt)', + jpi.x *pt, + (jpi.y-jpi.d)*pt ) else - context('(0,0)') + context('(0,0)') -- for mp only end end function commands.MPlr(id) local jpi = collected[id] if jpi then - context('(%spt,%spt)', - ((jpi.x or 0)+(jpi.w or 0))*pt, - ((jpi.y or 0)-(jpi.d or 0))*pt + context('(%.5fpt,%.5fpt)', + (jpi.x + jpi.w)*pt, + (jpi.y - jpi.d)*pt ) else - context('(0,0)') + context('(0,0)') -- for mp only end end function commands.MPur(id) local jpi = collected[id] if jpi then - context('(%spt,%spt)', - ((jpi.x or 0)+(jpi.w or 0))*pt, - ((jpi.y or 0)+(jpi.h or 0))*pt + context('(%.5fpt,%.5fpt)', + (jpi.x + jpi.w)*pt, + (jpi.y + jpi.h)*pt ) else - context('(0,0)') + context('(0,0)') -- for mp only end end function commands.MPul(id) local jpi = collected[id] if jpi then - context('(%spt,%spt)', - (jpi.x or 0) *pt, - ((jpi.y or 0)+(jpi.h or 0))*pt + context('(%.5fpt,%.5fpt)', + jpi.x *pt, + (jpi.y + jpi.h)*pt ) else - context('(0,0)') + context('(0,0)') -- for mp only end end @@ -795,18 +801,18 @@ local function MPpos(id) if jpi then local p = jpi.p if p then - context("%s,%spt,%spt,%spt,%spt,%spt", + context("%s,%.5fpt,%.5fpt,%.5fpt,%.5fpt,%.5fpt", p, - (jpi.x or 0)*pt, - (jpi.y or 0)*pt, - (jpi.w or 0)*pt, - (jpi.h or 0)*pt, - (jpi.d or 0)*pt + jpi.x*pt, + jpi.y*pt, + jpi.w*pt, + jpi.h*pt, + jpi.d*pt ) return end end - context('0,0,0,0,0,0') + context('0,0,0,0,0,0') -- for mp only end commands.MPpos = MPpos @@ -827,7 +833,7 @@ function commands.MPc(id) local jpi = collected[id] if jpi then local c = jpi.c - if c then + if c and p ~= true then context(c) return end @@ -839,12 +845,11 @@ function commands.MPr(id) local jpi = collected[id] if jpi then local r = jpi.r - if r then + if r and p ~= true then context(r) return end end - -- context("") -- empty so that we can test end local function MPpardata(n) @@ -854,33 +859,33 @@ local function MPpardata(n) t = collected[tag] end if t then - context("%spt,%spt,%spt,%spt,%s,%spt", -- can be %.5f - (t.hs or 0)*pt, - (t.ls or 0)*pt, - (t.rs or 0)*pt, - (t.hi or 0)*pt, - (t.ha or 1), - (t.pi or 0)*pt + context("%.5fpt,%.5fpt,%.5fpt,%.5fpt,%s,%.5fpt", + t.hs*pt, + t.ls*pt, + t.rs*pt, + t.hi*pt, + t.ha, + t.pi*pt ) else - context("0,0,0,0,0,0") -- meant for MP + context("0,0,0,0,0,0") -- for mp only end end commands.MPpardata = MPpardata --- function commands.MPposset(id) -- special helper, used in backgrounds --- local b = format("b:%s",id) --- local e = format("e:%s",id) --- local w = format("w:%s",id) --- local p = format("p:%s",jobpositions.n(b)) --- MPpos(b) context(",") MPpos(e) context(",") MPpos(w) context(",") MPpos(p) context(",") MPpardata(p) --- end +function commands.MPposset(id) -- special helper, used in backgrounds + local b = format("b:%s",id) + local e = format("e:%s",id) + local w = format("w:%s",id) + local p = format("p:%s",jobpositions.n(b)) + MPpos(b) context(",") MPpos(e) context(",") MPpos(w) context(",") MPpos(p) context(",") MPpardata(p) +end function commands.MPls(id) local t = collected[id] if t then - context((t.ls or 0)*pt) + context("%.5fpt",t.ls*pt) else context("0pt") end @@ -889,7 +894,7 @@ end function commands.MPrs(id) local t = collected[id] if t then - context((t.rs or 0)*pt) + context("%.5fpt",t.rs*pt) else context("0pt") end @@ -922,22 +927,31 @@ end function commands.MPxywhd(id) local t = collected[id] if t then - context("%spt,%spt,%spt,%spt,%spt", -- can be %.5f - (t.x or 0)*pt, - (t.y or 0)*pt, - (t.w or 0)*pt, - (t.h or 0)*pt, - (t.d or 0)*pt + context("%.5fpt,%.5fpt,%.5fpt,%.5fpt,%.5fpt", + t.x*pt, + t.y*pt, + t.w*pt, + t.h*pt, + t.d*pt ) else - context("0,0,0,0,0") -- meant for MP + context("0,0,0,0,0") -- for mp only end end -- is testcase already defined? if so, then local function commands.doifpositionelse(name) - commands.testcase(collected[name]) + commands.doifelse(collected[name]) +end + +function commands.doifpositionelse(name) + commands.doif(collected[name]) +end + +function commands.doifpositiononpage(name,page) -- probably always realpageno + local c = collected[name] + commands.testcase(c and c.p == page) end function commands.doifoverlappingelse(one,two,overlappingmargin) diff --git a/tex/context/base/anch-pos.mkiv b/tex/context/base/anch-pos.mkiv index c28747c46..c29c98e5b 100644 --- a/tex/context/base/anch-pos.mkiv +++ b/tex/context/base/anch-pos.mkiv @@ -27,6 +27,11 @@ \writestatus{loading}{ConTeXt Anchoring Macros / Positioning} +%D In \MKIV\ there was already a different housekeeping model +%D for positions quite early, but starting in 2012 more dramatic +%D changes started to happen, especially in relation to background +%D graphics. It will probably take some time to settle. + % saveposition : tag page x y % savepositionwhd : tag page x y w h d % savepositionplus : tag page x y w h d list @@ -181,7 +186,7 @@ \def\MPlr #1{\ctxcommand{MPlr("#1")}} \def\MPur #1{\ctxcommand{MPur("#1")}} \def\MPul #1{\ctxcommand{MPul("#1")}} -\def\MPpos#1{\ctxcommand{MPpos("#1")}} \def\MPanchor{\MPpos} +\def\MPpos#1{\ctxcommand{MPpos("#1")}} \let\MPanchor\MPpos % overloaded locally when needed \def\MPe #1{\ctxcommand{MPe("#1")}} \def\MPls #1{\ctxcommand{MPls("#1")}} \let\MPleftskip\MPls % compatible feature @@ -353,17 +358,18 @@ \let\currentposition\s!unknown -%D A few special ones: +%D A few special ones .. will be cleaned up -\unexpanded\def\anch_mark_column_box - {\ifpositioning - \expandafter\gobbleoneargument - \else - \expandafter\anch_mark_column_box_indeed - \fi} +\def\pageanchor {page:\the\realpageno} % for the moment only one pagesize +\def\textanchor {text:\the\realpageno} +\def\regionanchor{region:0} + +\newcount\c_anch_column % will be delegated to lua +\newcount\c_anch_text % will be delegated to lua \unexpanded\def\anch_mark_column_box#1% - {\ctxcommand{markcolumnbox(\number#1)}} + {\global\advance\c_anch_column\plusone + \ctxcommand{markregionbox(\number#1,"columnarea:\the\c_anch_column")}} % extra height \unexpanded\def\anch_mark_region_box {\iftrialtypesetting @@ -377,6 +383,19 @@ \unexpanded\def\anch_mark_region_box#1% {\ctxcommand{markregionbox(\number#1)}} +\unexpanded\def\anch_mark_flow_box#1% will be extended / renamed + {\hbox\bgroup + \global\advance\c_anch_text\plusone + \ctxcommand{markregionbox(\number#1,"textarea:\the\c_anch_text")}% + \box#1% + \egroup} + +\unexpanded\def\anch_make_page_box#1% maybe like text + {\ctxcommand{markregionbox(\number#1,"\pageanchor")}} % needs an hbox + +\unexpanded\def\anch_mark_text_box#1% + {\ctxcommand{markregionbox(\number#1,"\textanchor")}} % needs an hbox + %D We can copy a position with: %D %D \starttyping @@ -396,6 +415,7 @@ %D \stoptyping \def\doifpositionelse#1{\ctxcommand{doifpositionelse('#1')}} +\def\doifposition #1{\ctxcommand{doifposition('#1')}} %D We have now arrived at a few macros that would make sense as %D support macros, but ended up in the core. @@ -428,45 +448,6 @@ \unexpanded\def\bpos #1{\dontleavehmode \setpositionstrut{b:#1}\ignorespaces} \unexpanded\def\epos #1{\removeunwantedspaces\setpositionstrut{e:#1}} -%unexpanded\def\fpos #1{\dontleavehmode \setpositionstrut{b:#1}\ignorespaces} -%unexpanded\def\tpos #1{\removeunwantedspaces\setpositionstrut{e:#1}} -\unexpanded\def\ffpos#1{\dontleavehmode \setpositionstrut{b:#1}\wpos{#1}\ignorespaces} -%unexpanded\def\ttpos#1{\removeunwantedspaces\setpositionstrut{e:#1}} - -\let\fpos \bpos -\let\tpos \epos -\let\ttpos\epos - -%D Crap: - -\unexpanded\def\wpos#1% will be redone - {\dontleavehmode\vadjust % may disappear if buried - {\setbox\scratchbox\hbox{\raise\strutdp\hbox{\rawwpos{#1}}}% - \rlap{\smashedbox\scratchbox}}} - -\unexpanded\def\wwpos#1% \hsmashed{\llap{\rawwpos{#1}}} - {\rlap - {\setbox\scratchbox\hbox{\rawwpos{#1}}% - \smashedbox\scratchbox}} - -\unexpanded\def\rawwpos#1% - {\hpos{w:#1} - {\strut - \hskip\dimexpr\hsize-\leftskip-\rightskip\relax}} - -% the next macro disables par positions (in inner boxes) and -% only registers the width - -\unexpanded\def\setinnerparpositions - {\let\fpos\ffpos - \let\tpos\ttpos - \let\wpos\wwpos} - -% example of usage: (see for application "techniek") -% -% \appendtoks -% \setinnerparpositions -% \to \everytabulate %D When we want to calculate more complex backgrounds, we %D need to know what the current indentation scheme is. At diff --git a/tex/context/base/anch-tab.mkiv b/tex/context/base/anch-tab.mkiv index 75ba07796..08105ab53 100644 --- a/tex/context/base/anch-tab.mkiv +++ b/tex/context/base/anch-tab.mkiv @@ -13,11 +13,53 @@ \writestatus{loading}{ConTeXt Anchoring Macros / Table Extensions} -%D Beware, the code in this module is somewhat weird and experimental -%D and might be dropped or become a loadable module. - \unprotect +\newcount\c_anch_tabs + +\unexpanded\def\tabl_tabulate_hook_b + {\iftrialtypesetting\else + \ifpositioning + \ifcase\c_tabl_tabulate_noflines % \ifnum\c_tabl_tabulate_noflines=\c_tabl_tabulate_totalnoflines + \tabl_tabulate_hook_b_first + \else + \tabl_tabulate_hook_b_next + \fi + \fi + \fi} + +\unexpanded\def\tabl_tabulate_hook_e + {\iftrialtypesetting\else + \ifpositioning + \ifcase\c_tabl_tabulate_noflines % \ifnum\c_tabl_tabulate_noflines=\c_tabl_tabulate_totalnoflines + \tabl_tabulate_hook_e_first + \else + \tabl_tabulate_hook_e_next + \fi + \fi + \fi} + +\unexpanded\def\tabl_tabulate_hook_b_first + {\ctxcommand{bcolumn("tabulate:\the\c_anch_tabs:\the\c_tabl_tabulate_column",true)}} + +\unexpanded\def\tabl_tabulate_hook_b_next + {\ctxcommand{bcolumn("tabulate:\the\c_anch_tabs:\the\c_tabl_tabulate_column")}} + +\unexpanded\def\tabl_tabulate_hook_e_first + {\ctxcommand{ecolumn(true)}} + +\unexpanded\def\tabl_tabulate_hook_e_next + {\ctxcommand{ecolumn()}} + +% \appendtoks \registerparoptions \to \everypar + +\appendtoks + \global\advance\c_anch_tabs\plusone +\to \everytabulate + +%D Beware, the following code is somewhat weird and experimental +%D and might be dropped or become a loadable module. + %D \macros %D {GFC, GTC, GSC} %D @@ -163,8 +205,8 @@ \iftrialtypesetting\else\ifconditional\tablehaspositions\doflushtabulateepos\fi\fi} \appendtoks - \let\dotablebpos\dotabulatebpos - \let\dotableepos\dotabulateepos + \let\dotablebpos\dotabulatebpos % ? + \let\dotableepos\dotabulateepos % ? \glet\doflushtabulateepos\relax \to \everytabulate diff --git a/tex/context/base/back-exp.mkiv b/tex/context/base/back-exp.mkiv index 311ffe5d2..7811ee5ed 100644 --- a/tex/context/base/back-exp.mkiv +++ b/tex/context/base/back-exp.mkiv @@ -89,8 +89,8 @@ \to \everyenableelements \appendtoks - %\def\dotagcombination{\taggedctxcommand{settagcombination(\combinationparameter\c!nx,\combinationparameter\c!ny)}}% - \unexpanded\def\dotagcombination{\taggedctxcommand{settagcombination(\number\horcombination,\number\totcombination)}}% + \unexpanded\def\dotagcombination{\taggedctxcommand{settagcombination(\combinationparameter\c!nx,\combinationparameter\c!ny)}}% + %\unexpanded\def\dotagcombination{\taggedctxcommand{settagcombination(\number\horcombination,\number\totcombination)}}% \to \everyenableelements \appendtoks diff --git a/tex/context/base/bibl-tra.mkiv b/tex/context/base/bibl-tra.mkiv index 44afd83b8..3531703ad 100644 --- a/tex/context/base/bibl-tra.mkiv +++ b/tex/context/base/bibl-tra.mkiv @@ -188,6 +188,7 @@ [pubs] [\c!state=\v!start, \c!criterium=\@@pbcriterium, + \c!headnumber=\v!always, % needed as we provide our own and need to force \c!width=] \installstructurelistprocessor{pubs:userdata}% @@ -312,8 +313,8 @@ \def\@@pbinumbercommand{\executeifdefined{\??pb:\c!numbercommand:\@@pbnumbering}\firstofoneargument} -\letvalue{\??pb:\c!numbercommand:\v!yes }\firstofoneargument -\letvalue{\??pb:\c!numbercommand:\v!no }\gobbleoneargument +\setvalue{\??pb:\c!numbercommand:\v!yes }#1{#1}% +\setvalue{\??pb:\c!numbercommand:\v!no }#1{} \setvalue{\??pb:\c!numbercommand:\v!short}#1{\bibgetvars\currentpublicationkey} \setvalue{\??pb:\c!numbercommand:\v!bib }#1{\bibgetvarn\currentpublicationkey} @@ -742,7 +743,7 @@ \def\doprocessbibtexentry#1{\typesetapublication{#1}} -\def\typesetpubslist +\unexpanded\def\typesetpubslist {\begingroup \startpacked[\v!blank]% \preloadbiblist @@ -766,7 +767,7 @@ \newif\ifinpublist -\def\initializepubslist +\unexpanded\def\initializepubslist {\def\currentlist{pubs}% \edef\@@pbnumbering{\@@pbnumbering}% \doifelse\@@pbautohang\v!yes @@ -805,12 +806,12 @@ \doifelse{\publicationlistparameter\c!maybeyear}{\v!off}{\def\maybeyear##1{}}{\def\maybeyear##1{##1}}% \forgetall} -\def\outdented#1% move to supp-box ? +\unexpanded\def\outdented#1% move to supp-box ? {\hskip-\hangindent#1\relax} %D The full list of publications -\def\completepublications +\unexpanded\def\completepublications {\dosingleempty\docompletepublications} \def\docompletepublications[#1]% @@ -874,10 +875,10 @@ {\global\advance\bibtexcounter\plusone \def\currentpublicationkey{#1}% \ctxlua{bibtex.hacks.registerplaced("#1")}% - \def\currentlist {pubs}% - \let\currentlistentrynumber \bibtexcounter - \let\currentlistentrytitle \bibtexpubtext - \let\currentlistentrypagenumber\empty + \def \currentlist {pubs}% + \edef\currentlistentrynumber {\number\bibtexcounter}% + \let \currentlistentrytitle \bibtexpubtext + \let \currentlistentrypagenumber\empty \strc_lists_apply_renderingsetup} {}} % invalid diff --git a/tex/context/base/buff-ini.mkiv b/tex/context/base/buff-ini.mkiv index 658f54f33..239a274c0 100644 --- a/tex/context/base/buff-ini.mkiv +++ b/tex/context/base/buff-ini.mkiv @@ -148,7 +148,7 @@ [\c!before=, \c!after=] -\unexpanded\def\processTEXbuffer +\unexpanded\def\processTEXbuffer % keep case, maybe also lower {\dosingleempty\buff_process_tex} \def\buff_process_tex[#1]% diff --git a/tex/context/base/colo-ini.mkiv b/tex/context/base/colo-ini.mkiv index 522f3fd62..013946df6 100644 --- a/tex/context/base/colo-ini.mkiv +++ b/tex/context/base/colo-ini.mkiv @@ -145,6 +145,13 @@ \unexpanded\def\directcolored[#1]{\colo_basics_defined_and_activated{#1}} +\unexpanded\def\fastcolor [#1]#2{\begingroup % is this command still needed? + \colo_helpers_activate{#1}% + #2% + \endgroup} + +\unexpanded\def\directcolor [#1]{\colo_helpers_activate{#1}} + %D The following command is obsolete: diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 32a8c39ac..889bcd918 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.08 21:58} +\newcontextversion{2012.02.16 09:55} %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 9d29b2868..7c7f46cc1 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.08 21:58} +\newcontextversion{2012.02.16 09:55} %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 64f82f314..0f6482af5 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png index 1f8958f7b..7d1d1c52f 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index de0c56634..9e68e36f0 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.08 21:58} +\edef\contextversion{2012.02.16 09:55} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 240244f40..769744932 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.08 21:58} +\edef\contextversion{2012.02.16 09:55} %D For those who want to use this: @@ -332,8 +332,9 @@ \loadmkvifile{font-lib} \loadmkvifile{font-fil} +\loadmkvifile{font-var} \loadmkvifile{font-fea} -\loadmkvifile{font-mat} % might move below ini +\loadmkvifile{font-mat} \loadmkvifile{font-ini} \loadmkvifile{font-sym} \loadmkvifile{font-sty} diff --git a/tex/context/base/font-col.mkvi b/tex/context/base/font-col.mkvi index d78c082e3..030e9aef7 100644 --- a/tex/context/base/font-col.mkvi +++ b/tex/context/base/font-col.mkvi @@ -77,15 +77,15 @@ \def\font_fallbacks_clone_unique#specification#scale% kind of dododefinefont {\ctxcommand{fontcollectionreport("defining #specification (relative scale: #scale)")}% brrr - \setfalse\font_auto_font_size + \setfalse\c_font_auto_size \let\lastfontidentifier\s!dummy \def\v_font_size_relative{#scale}% \let\v_font_size_absolute\fontbody \font_helpers_low_level_define{#specification}\v_font_identifier_basic \csname\v_font_identifier_basic\endcsname - \setfalse\font_auto_font_size} % no \setfontcharacteristics and \the\everyfontswitch needed + \setfalse\c_font_auto_size} % no \setfontcharacteristics and \the\everyfontswitch needed -\def\font_fallbacks_clone_inherited#font% also a secod argument +\def\font_fallbacks_clone_inherited#font% also a second argument {\font_fallbacks_clone_unique{#font \savedfontspec}} \def\font_fallbacks_register_main #name{\ctxcommand{fontcollectionregister("#name")}} diff --git a/tex/context/base/font-fil.mkvi b/tex/context/base/font-fil.mkvi index 6548c87d8..dcb298619 100644 --- a/tex/context/base/font-fil.mkvi +++ b/tex/context/base/font-fil.mkvi @@ -290,13 +290,13 @@ % resolve \def\font_helpers_set_features_yes#name% - {\ifcsname\??fontfile\fontclass#name\s!features \endcsname\expandafter\let\expandafter\m_font_features + {\ifcsname\??fontfile\fontclass#name\s!features \endcsname\expandafter\let\expandafter\m_font_features % class + symbolic_name \csname\??fontfile\fontclass#name\s!features \endcsname\else - \ifcsname\??fontfile #name\s!features \endcsname\expandafter\let\expandafter\m_font_features + \ifcsname\??fontfile #name\s!features \endcsname\expandafter\let\expandafter\m_font_features % symbolic_name \csname\??fontfile #name\s!features \endcsname\else - \ifcsname\??fontfile\fontclass #name\endcsname\expandafter\font_helpers_set_features_yes + \ifcsname\??fontfile\fontclass #name\endcsname\expandafter\font_helpers_set_features_yes % class + parent_name \csname\??fontfile\fontclass #name\endcsname\else - \ifcsname\??fontfile #name\endcsname\expandafter\font_helpers_set_features_yes + \ifcsname\??fontfile #name\endcsname\expandafter\font_helpers_set_features_yes % parent_name \csname\??fontfile #name\endcsname\else \let\m_font_features\empty\fi\fi\fi\fi} diff --git a/tex/context/base/font-ini.mkvi b/tex/context/base/font-ini.mkvi index ea0c0dedc..f581a1685 100644 --- a/tex/context/base/font-ini.mkvi +++ b/tex/context/base/font-ini.mkvi @@ -483,25 +483,6 @@ \csname\??mappedfontsize\the\dimexpr#from\relax\endcsname\else#from% \fi} -%D \macros -%D {fontstyle,fontalternative,fontsize} -%D -%D Within a bodyfont, fonts can come in different sizes. For instance -%D \type {\tf} is accompanied by \type {\tfa}, \type {\tfb} etc. The -%D first two characters denote the alternative, while the third -%D character in these sequences represents the size. The actual size -%D is saved in a macro. The styles, being roman (\type {\rm}), sans -%D serif (\type {\ss}) etc. are also available in macros in \type {rm}, -%D \type {ss} etc. form. - -\let\defaultfontalternative\s!tf -\let\defaultfontstyle \empty -\let\defaultfontsize \empty - -\let\fontalternative \defaultfontalternative -\let\fontstyle \defaultfontstyle -\let\fontsize \defaultfontsize - \installcorenamespace{fontbodyknown} \installcorenamespace{fontclassyes} % fontclass \installcorenamespace{fontclassnop} % nofontclass @@ -743,17 +724,18 @@ {% we can now set more at the lua end \ctxcommand{definefont_one(\!!bs\luaescapestring{#specification}\!!es)}% the escapestring catches at \somedimen % sets \scaledfontmode and \somefontname and \somefontsize - % MAYBE MOVE THIS TO THE CALLER - \ifx\currentmathsize\empty % CAN BE ZERO - \else - \ifcase\currentmathsize - \or - \let\v_font_size_absolute\textface - \or - \let\v_font_size_absolute\scriptface - \or - \let\v_font_size_absolute\scriptscriptface - \fi + \ifcase\fontface\relax + % \let\v_font_size_absolute\textface % fontbody + \or + \let\v_font_size_absolute\textface + \or + \let\v_font_size_absolute\scriptface + \or + \let\v_font_size_absolute\scriptscriptface + \or + \let\v_font_size_absolute\xtextface + \or + \let\v_font_size_absolute\xxtextface \fi % \ifcase\scaledfontmode\relax @@ -798,7 +780,7 @@ \fi \font_helpers_update_font_parameters \font_helpers_update_font_class_parameters - % \writestatus{fonts}{low level define: #csname/\somefontfile/\number\d_font_scaled_font_size/\currentmathsize/\number\d_font_scaled_text_face}% + % \writestatus{fonts}{low level define: #csname/\somefontfile/\number\d_font_scaled_font_size/\fontface/\number\d_font_scaled_text_face}% \ctxcommand{definefont_two( \ifx\fontclass\empty false\else true\fi, "#csname", @@ -809,7 +791,7 @@ "\m_font_features", "\m_font_class_fallbacks", "\m_font_fallbacks", - 0\currentmathsize, + \fontface, % 1/2/3: text script scriptscript 0/4/5: body x xx \number\d_font_scaled_text_face, "\number\relativefontid", % experiment "\m_font_class_goodies", % experiment (not yet used) @@ -933,13 +915,13 @@ \let\lastfontidentifier\empty -\def\v_font_identifier_basic{\??fontinstancebasic \lastfontidentifier-\fontsize-\currentmathsize} -\def\v_font_identifier_class{\??fontinstanceclass\fontclass-\lastfontidentifier-\fontsize-\currentmathsize} +\def\v_font_identifier_basic{\??fontinstancebasic \lastfontidentifier-\fontsize-\fontface} +\def\v_font_identifier_class{\??fontinstanceclass\fontclass-\lastfontidentifier-\fontsize-\fontface} \let\v_font_identifier_basic_saved\v_font_identifier_basic \let\v_font_identifier_class_saved\v_font_identifier_class -% \def\v_font_identifier_class{\??fontinstanceclass\fontclass-\lastfontidentifier-\fontstyle-\fontsize} % no \currentmathsize +% \def\v_font_identifier_class{\??fontinstanceclass\fontclass-\lastfontidentifier-\fontstyle-\fontsize} % no \fontface \def\font_basics_define_font_without_parameters#identifier#2% {\c_font_feature_inheritance_mode\c_font_feature_inheritance_fontonly @@ -1459,20 +1441,46 @@ % the rest is a size, although in practice one will seldom define the size directly. We might even % drop that as it gives faster code. +% \unexpanded\def\font_basics_define_body_font_nop_xx[#one#two#rest=#value]% local +% {\ifcsname\m_font_asked_style#one#two#rest\endcsname\else\font_basics_check_fontname_combination\m_font_asked_style{#one#two}{#rest}\fi +% \expandafter\let\csname\??fontinstanceclass\m_font_asked_body-\m_font_asked_style-#one#two-#rest\endcsname\undefined +% \unexpanded\expandafter\normaledef\csname\??fontinstanceready\m_font_asked_body-\m_font_asked_style-#one#two-#rest\endcsname +% {\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest}{\noexpand\font_rscale_xx{\m_font_asked_style}}{\m_font_asked_body}{\normalunexpanded{#value}}}% +% } + \unexpanded\def\font_basics_define_body_font_nop_xx[#one#two#rest=#value]% local {\ifcsname\m_font_asked_style#one#two#rest\endcsname\else\font_basics_check_fontname_combination\m_font_asked_style{#one#two}{#rest}\fi - \expandafter\let\csname\??fontinstanceclass\m_font_asked_body-\m_font_asked_style-#one#two-#rest\endcsname\undefined - \unexpanded\expandafter\normaledef\csname\??fontinstanceready\m_font_asked_body-\m_font_asked_style-#one#two-#rest\endcsname + \expandafter\let\csname\??fontinstanceclass\m_font_asked_body-\m_font_asked_style-#one#two-#rest-0\endcsname\undefined + \unexpanded\expandafter\normaledef\csname\??fontinstanceready\m_font_asked_body-\m_font_asked_style-#one#two-#rest-0\endcsname + {\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest}{\noexpand\font_rscale_xx{\m_font_asked_style}}{\m_font_asked_body}{\normalunexpanded{#value}}}% + \expandafter\let\csname\??fontinstanceclass\m_font_asked_body-\m_font_asked_style-#one#two-#rest-4\endcsname\undefined + \unexpanded\expandafter\normaledef\csname\??fontinstanceready\m_font_asked_body-\m_font_asked_style-#one#two-#rest-4\endcsname + {\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest}{\noexpand\font_rscale_xx{\m_font_asked_style}}{\m_font_asked_body}{\normalunexpanded{#value}}}% + \expandafter\let\csname\??fontinstanceclass\m_font_asked_body-\m_font_asked_style-#one#two-#rest-5\endcsname\undefined + \unexpanded\expandafter\normaledef\csname\??fontinstanceready\m_font_asked_body-\m_font_asked_style-#one#two-#rest-5\endcsname {\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest}{\noexpand\font_rscale_xx{\m_font_asked_style}}{\m_font_asked_body}{\normalunexpanded{#value}}}% } % \writestatus{fonts}{define \m_asked_style\space nop: \expandafter\meaning\csname\m_font_asked_body\m_font_asked_style#one#two#rest\endcsname}% +% \unexpanded\def\font_basics_define_body_font_yes_xx[#one#two#rest=#value]% global +% {\ifcsname\m_font_asked_style#one#two#rest\endcsname\else\font_basics_check_fontname_combination\m_font_asked_style{#one#two}{#rest}\fi +% \global\expandafter\let\csname\??fontinstanceclass\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest\endcsname\undefined +% \unexpanded\expandafter\normalxdef\csname\??fontinstanceready\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest\endcsname +% {\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}% +% } + \unexpanded\def\font_basics_define_body_font_yes_xx[#one#two#rest=#value]% global {\ifcsname\m_font_asked_style#one#two#rest\endcsname\else\font_basics_check_fontname_combination\m_font_asked_style{#one#two}{#rest}\fi - \global\expandafter\let\csname\??fontinstanceclass\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest\endcsname\undefined - \unexpanded\expandafter\normalxdef\csname\??fontinstanceready\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest\endcsname - {\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}% + \global\expandafter\let\csname\??fontinstanceclass\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-1\endcsname\undefined + \unexpanded\expandafter\normalxdef\csname\??fontinstanceready\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-0\endcsname + {\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest-0}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}% + \global\expandafter\let\csname\??fontinstanceclass\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-2\endcsname\undefined + \unexpanded\expandafter\normalxdef\csname\??fontinstanceready\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-4\endcsname + {\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest-4}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}% + \global\expandafter\let\csname\??fontinstanceclass\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-3\endcsname\undefined + \unexpanded\expandafter\normalxdef\csname\??fontinstanceready\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-5\endcsname + {\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest-5}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}% } % \writestatus{fonts}{define \m_asked_style\space yes: {\expandafter\meaning\csname\fontclass\m_font_asked_body\m_font_asked_style#one#two#rest\endcsname} @@ -1692,21 +1700,6 @@ %\font_helpers_set_font_set_font_option_body_fallbacks{#method}{#body}% \fi} -% The following bunch of macros deals with the (run time) -% expansion of names onto the definitions made by \type -% {\definebodyfont}. - -% \let\fontbody \empty % ... 10pt 11pt 12pt ... -% \let\fontstyle \empty % rm ss tt mm hw cg ... -% \let\fontalternative\empty % tf bf sl it bs bi sc ... -% \let\fontsize \empty % xy-abcd ... - -\def\defaultfontbody{\normalizedbodyfontsize} - -\let\fontbody\defaultfontbody - -\let\fontclass\empty \let\globalfontclass\fontclass - % we need to check the fontclass \def\registerfontclass#class% @@ -1734,7 +1727,7 @@ %D So far for synchronisation. (We can inline the following macros.) -\unexpanded\def\setcurrentfont#body#style#alternative#size% +\unexpanded\def\setcurrentfont#body#style#alternative#size% not used {\edef\fontbody {#body}% \edef\fontstyle {#style}% \edef\fontalternative{#alternative}% @@ -1742,7 +1735,7 @@ \font_helpers_check_big_math_synchronization \font_helpers_synchronize_font} -\unexpanded\def\setcurrentfontbody#body% +\unexpanded\def\setcurrentfontbody#body% % not used {\edef\fontbody{#body}% \font_helpers_synchronize_font} @@ -1759,8 +1752,7 @@ \font_helpers_synchronize_font} \unexpanded\def\font_helpers_set_current_xsize_alternative#xsize#alternative% - {% if we want to go smaller then we can always consider a local bodyswitch - \edef\fontsize {#xsize}% + {\edef\fontface{#xsize}% \edef\fontalternative{#alternative}% \font_helpers_synchronize_font} @@ -1813,50 +1805,50 @@ %D so further optimization makes no sense. \def\font_helpers_check_strategy_class_a % --- --- --- --- % pt tt bf a - {\ifcsname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\fontalternative-\fontsize\endcsname + {\ifcsname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\fontalternative-\fontsize-\fontface\endcsname \setfalse\c_font_auto_size - \csname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\fontalternative-\fontsize\endcsname + \csname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\fontalternative-\fontsize-\fontface\endcsname \else \expandafter\font_helpers_check_strategy_class_b \fi} \def\font_helpers_check_strategy_class_b % --- --- --- def % pt tt bf - {\ifcsname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\fontalternative-\defaultfontsize\endcsname + {\ifcsname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\fontalternative-\defaultfontsize-\fontface\endcsname \settrue\c_font_auto_size - \csname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\fontalternative-\defaultfontsize\endcsname + \csname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\fontalternative-\defaultfontsize-\fontface\endcsname \else \expandafter\font_helpers_check_strategy_class_c \fi} \def\font_helpers_check_strategy_class_c % --- --- def --- % pt tt tf a - {\ifcsname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\defaultfontalternative-\fontsize\endcsname + {\ifcsname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\defaultfontalternative-\fontsize-\fontface\endcsname \settrue\c_font_auto_size - \csname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\defaultfontalternative-\fontsize\endcsname + \csname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\defaultfontalternative-\fontsize-\fontface\endcsname \else \expandafter\font_helpers_check_strategy_class_d \fi} \def\font_helpers_check_strategy_class_d % --- --- def def % pt tt tf - {\ifcsname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\defaultfontalternative-\defaultfontsize\endcsname + {\ifcsname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\defaultfontalternative-\defaultfontsize-\fontface\endcsname \settrue\c_font_auto_size - \csname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\defaultfontalternative-\defaultfontsize\endcsname + \csname\??fontinstanceready\fontclass-\fontbody-\fontstyle-\defaultfontalternative-\defaultfontsize-\fontface\endcsname \else \expandafter\font_helpers_check_strategy_class_e \fi} \def\font_helpers_check_strategy_class_e % --- def def def % pt rm tf - {\ifcsname\??fontinstanceready\fontclass-\fontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize\endcsname + {\ifcsname\??fontinstanceready\fontclass-\fontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize-\fontface\endcsname \setfalse\c_font_auto_size - \csname\??fontinstanceready\fontclass-\fontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize\endcsname + \csname\??fontinstanceready\fontclass-\fontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize-\fontface\endcsname \else \expandafter\font_helpers_check_strategy_class_f % \expandafter\font_helpers_check_strategy_a \fi} \def\font_helpers_check_strategy_class_f % def def def def % rm tf - {\ifcsname\??fontinstanceready\fontclass-\defaultfontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize\endcsname + {\ifcsname\??fontinstanceready\fontclass-\defaultfontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize-\fontface\endcsname \settrue\c_font_auto_size - \csname\??fontinstanceready\fontclass-\defaultfontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize\endcsname + \csname\??fontinstanceready\fontclass-\defaultfontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize-\fontface\endcsname \else \expandafter\font_helpers_check_strategy_a \fi} @@ -1864,49 +1856,49 @@ % no class \def\font_helpers_check_strategy_a % --- --- --- --- % pt tt bf a - {\ifcsname\??fontinstanceready\fontbody-\fontstyle-\fontalternative-\fontsize\endcsname + {\ifcsname\??fontinstanceready\fontbody-\fontstyle-\fontalternative-\fontsize-\fontface\endcsname \setfalse\c_font_auto_size - \csname\??fontinstanceready\fontbody-\fontstyle-\fontalternative-\fontsize\endcsname + \csname\??fontinstanceready\fontbody-\fontstyle-\fontalternative-\fontsize-\fontface\endcsname \else \expandafter\font_helpers_check_strategy_b \fi} \def\font_helpers_check_strategy_b % --- --- --- --- % pt tt bf a - {\ifcsname\??fontinstanceready\fontbody-\fontstyle-\fontalternative-\defaultfontsize\endcsname + {\ifcsname\??fontinstanceready\fontbody-\fontstyle-\fontalternative-\defaultfontsize-\fontface\endcsname \settrue\c_font_auto_size - \csname\??fontinstanceready\fontbody-\fontstyle-\fontalternative-\defaultfontsize\endcsname + \csname\??fontinstanceready\fontbody-\fontstyle-\fontalternative-\defaultfontsize-\fontface\endcsname \else \expandafter\font_helpers_check_strategy_c \fi} \def\font_helpers_check_strategy_c % --- --- --- --- % pt tt bf a - {\ifcsname\??fontinstanceready\fontbody-\fontstyle-\defaultfontalternative-\fontsize\endcsname + {\ifcsname\??fontinstanceready\fontbody-\fontstyle-\defaultfontalternative-\fontsize-\fontface\endcsname \settrue\c_font_auto_size - \csname\??fontinstanceready\fontbody-\fontstyle-\defaultfontalternative-\fontsize\endcsname + \csname\??fontinstanceready\fontbody-\fontstyle-\defaultfontalternative-\fontsize-\fontface\endcsname \else \expandafter\font_helpers_check_strategy_d \fi} \def\font_helpers_check_strategy_d % --- --- --- --- % pt tt bf a - {\ifcsname\??fontinstanceready\fontbody-\fontstyle-\defaultfontalternative-\defaultfontsize\endcsname + {\ifcsname\??fontinstanceready\fontbody-\fontstyle-\defaultfontalternative-\defaultfontsize-\fontface\endcsname \settrue\c_font_auto_size - \csname\??fontinstanceready\fontbody-\fontstyle-\defaultfontalternative-\defaultfontsize\endcsname + \csname\??fontinstanceready\fontbody-\fontstyle-\defaultfontalternative-\defaultfontsize-\fontface\endcsname \else \expandafter\font_helpers_check_strategy_e \fi} \def\font_helpers_check_strategy_e % --- --- --- --- % pt tt bf a - {\ifcsname\??fontinstanceready\fontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize\endcsname + {\ifcsname\??fontinstanceready\fontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize-\fontface\endcsname \setfalse\c_font_auto_size - \csname\??fontinstanceready\fontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize\endcsname + \csname\??fontinstanceready\fontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize-\fontface\endcsname \else \expandafter\font_helpers_check_strategy_f \fi} \def\font_helpers_check_strategy_f % --- --- --- --- % pt tt bf a - {\ifcsname\??fontinstanceready\defaultfontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize\endcsname + {\ifcsname\??fontinstanceready\defaultfontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize-\fontface\endcsname \settrue\c_font_auto_size - \csname\??fontinstanceready\defaultfontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize\endcsname + \csname\??fontinstanceready\defaultfontbody-\defaultfontstyle-\defaultfontalternative-\defaultfontsize-\fontface\endcsname \fi} \let\applyfontstrategies \font_helpers_check_strategy_a @@ -1938,33 +1930,41 @@ \fi} \def\font_helpers_set_current_font_x_alternative#alternative% - {\font_helpers_set_current_font_xxx_alternative{#alternative}\s!x\scriptstyle + {\font_helpers_set_current_font_xxx_alternative{#alternative}{4}\scriptstyle \currentxfontsize\plusone \let\tx\txx} \def\font_helpers_set_current_font_xx_alternative#alternative% - {\font_helpers_set_current_font_xxx_alternative{#alternative}\s!xx\scriptscriptstyle + {\font_helpers_set_current_font_xxx_alternative{#alternative}{5}\scriptscriptstyle \currentxfontsize\plustwo \let\tx\empty \let\txx\empty} -\def\font_helpers_check_nested_x_fontsize % option - {\ifcase\currentxfontsize\else\ifx\fontsize\empty\else +\def\font_helpers_reset_x_fontsize + {\ifcase\currentxfontsize\else \currentxfontsize\zerocount - \let\fontsize\empty \let\tx\normaltx \let\txx\normaltxx - \fi\fi} + \fi} + +\def\font_helpers_check_nested_x_fontsize % option +% {\ifcase\currentxfontsize\else\ifx\fontsize\empty\else +% \currentxfontsize\zerocount +% \let\fontsize\empty +% \let\tx\normaltx +% \let\txx\normaltxx +% \fi\fi} + {} \def\font_helpers_set_current_font_x_alternative#alternative% {\font_helpers_check_nested_x_fontsize - \font_helpers_set_current_font_xxx_alternative{#alternative}\s!x\scriptstyle + \font_helpers_set_current_font_xxx_alternative{#alternative}{4}\scriptstyle \currentxfontsize\plusone \let\tx\txx} \def\font_helpers_set_current_font_xx_alternative#alternative% {\font_helpers_check_nested_x_fontsize - \font_helpers_set_current_font_xxx_alternative{#alternative}\s!xx\scriptscriptstyle + \font_helpers_set_current_font_xxx_alternative{#alternative}{5}\scriptscriptstyle \currentxfontsize\plustwo \let\tx\empty \let\txx\empty} @@ -2015,13 +2015,36 @@ \def\textface {\currentbodyfontdimension\s!text } \def\scriptface {\currentbodyfontdimension\s!script } \def\scriptscriptface{\currentbodyfontdimension\s!scriptscript} +\def\xtextface {\currentbodyfontdimension\s!x } +\def\xxtextface {\currentbodyfontdimension\s!xx } + +% \unexpanded\def\font_basics_complete_switch#size% +% {\bodyfontsize#size\relax +% \normalizebodyfontsize\normalizedbodyfontsize\bodyfontsize +% \edef\textface {\currentbodyfontdimension\s!text }% +% \edef\scriptface {\currentbodyfontdimension\s!script }% +% \edef\scriptscriptface{\currentbodyfontdimension\s!scriptscript}}% + +\installcorenamespace{fontbodyfaces} \unexpanded\def\font_basics_complete_switch#size% {\bodyfontsize#size\relax \normalizebodyfontsize\normalizedbodyfontsize\bodyfontsize - \edef\textface {\currentbodyfontdimension\s!text }% - \edef\scriptface {\currentbodyfontdimension\s!script }% - \edef\scriptscriptface{\currentbodyfontdimension\s!scriptscript}}% + \expandafter\let\expandafter\font_basics_set_faces\csname\??fontbodyfaces\fontbody\endcsname + \ifx\font_basics_set_faces\relax + \font_basics_set_faces_preset + \fi + \font_basics_set_faces} + +\def\font_basics_set_faces_preset + {\edef\font_basics_set_faces{% 0.2 sec on 10K \tfa + \noexpand\edef\noexpand\textface {\currentbodyfontdimension\s!text }% + \noexpand\edef\noexpand\scriptface {\currentbodyfontdimension\s!script }% + \noexpand\edef\noexpand\scriptscriptface{\currentbodyfontdimension\s!scriptscript}% + \noexpand\edef\noexpand\xtextface {\currentbodyfontdimension\s!x }% + \noexpand\edef\noexpand\xxtextface {\currentbodyfontdimension\s!xx }% + }% + \global\expandafter\let\csname\??fontbodyfaces\fontbody\endcsname\font_basics_set_faces} \def\currentbodyfontdimension#parameter% {\the\dimexpr @@ -2190,7 +2213,7 @@ \font_basics_switch_style \fontstyle} \unexpanded\def\setsmallbodyfont{\font_helpers_set_bodyfont_step\v!small\the\everybodyfont} -\unexpanded\def\setbigbodyfont {\font_helpers_set_bodyfont_step\gg \the\everybodyfont} +\unexpanded\def\setbigbodyfont {\font_helpers_set_bodyfont_step\v!big \the\everybodyfont} \unexpanded\def\setmainbodyfont {\font_basics_switch_points\normalizedbodyfontsize diff --git a/tex/context/base/font-mat.mkvi b/tex/context/base/font-mat.mkvi index 4ecb9d082..7ef0f2b77 100644 --- a/tex/context/base/font-mat.mkvi +++ b/tex/context/base/font-mat.mkvi @@ -73,9 +73,7 @@ \def\mathscriptsuffix {-script} \def\mathscriptscriptsuffix{-scriptscript} -\let\currentmathsize\empty - -\def\mathsizesuffix{\ifcase0\currentmathsize\or\mathtextsuffix\or\mathscriptsuffix\or\mathscriptscriptsuffix\fi} +\def\mathsizesuffix{\ifcase\fontface\or\mathtextsuffix\or\mathscriptsuffix\or\mathscriptscriptsuffix\fi} % Beware: truefontname also does a fallback on defaultfontclass so there % can be some interference here, which is why we use a different method @@ -105,13 +103,13 @@ \nullfont \settrue \c_font_auto_size \fi\fi} -\def\font_helpers_set_math_family_indeed#mrtag#family% \currentmathsize etc are also used later on +\def\font_helpers_set_math_family_indeed#mrtag#family% \fontface etc are also used later on {\let\savedfontbody\fontbody \let\fontfamily#family% - \let\currentmathsize\!!plusthree\font_helpers_set_math_family_a\scriptscriptfont#mrtag\font - \let\currentmathsize\!!plustwo \font_helpers_set_math_family_a\scriptfont #mrtag\font - \let\currentmathsize\!!plusone \font_helpers_set_math_family_a\textfont #mrtag\font - \let\currentmathsize\empty + \let\fontface\!!plusthree\font_helpers_set_math_family_a\scriptscriptfont#mrtag\font + \let\fontface\!!plustwo \font_helpers_set_math_family_a\scriptfont #mrtag\font + \let\fontface\!!plusone \font_helpers_set_math_family_a\textfont #mrtag\font + \let\fontface\!!zerocount \let\fontbody\savedfontbody \setfalse\c_font_auto_size} @@ -128,10 +126,10 @@ \let\defaultfontclass\fontclass % else truefontname falls back on the wrong one \let\savedfontbody\fontbody \let\fontfamily#familytag% - \let\currentmathsize\!!plusthree\font_helpers_set_math_family_bold_a\scriptscriptfont#mbfam#mrfam% - \let\currentmathsize\!!plustwo \font_helpers_set_math_family_bold_a\scriptfont #mbfam#mrfam% - \let\currentmathsize\!!plusone \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% - \let\currentmathsize\empty + \let\fontface\!!plusthree\font_helpers_set_math_family_bold_a\scriptscriptfont#mbfam#mrfam% + \let\fontface\!!plustwo \font_helpers_set_math_family_bold_a\scriptfont #mbfam#mrfam% + \let\fontface\!!plusone \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% + \let\fontface\!!zerocount \let\fontbody\savedfontbody \let\defaultfontclass\savedfontclass \setfalse\c_font_auto_size} diff --git a/tex/context/base/font-var.mkvi b/tex/context/base/font-var.mkvi new file mode 100644 index 000000000..e50c2bad4 --- /dev/null +++ b/tex/context/base/font-var.mkvi @@ -0,0 +1,53 @@ +%D \module +%D [ file=font-var, +%D version=2011.01.13, % (copied fron font-ini) +%D title=\CONTEXT\ Font Macros, +%D subtitle=Common Variables, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Font Macros / Common Variables} + +\unprotect + +% some more will move here + +%D \macros +%D {fontstyle,fontalternative,fontsize,fontbody} +%D +%D Within a bodyfont, fonts can come in different sizes. For instance +%D \type {\tf} is accompanied by \type {\tfa}, \type {\tfb} etc. The +%D first two characters denote the alternative, while the third +%D character in these sequences represents the size. The actual size +%D is saved in a macro. The styles, being roman (\type {\rm}), sans +%D serif (\type {\ss}) etc. are also available in macros in \type {rm}, +%D \type {ss} etc. form. + +% fontclass % modern dejavu +% fontbody % ... 10pt 11pt 12pt ... +% fontstyle % rm ss tt mm hw cg ... +% fontalternative % tf bf sl it bs bi sc ... +% fontsize % a b c d ... +% fontface % 0=normal 1=text 2=script 3=scriptscript 4=x 5=xx (math are temporary) + +\def\normalizedbodyfontsize{12pt} + +\def\defaultfontbody {\normalizedbodyfontsize} +\let\defaultfontstyle \empty +\let\defaultfontalternative \s!tf +\let\defaultfontsize \empty + +\let\globalfontclass \empty +\let\fontclass \empty +\let\fontbody \defaultfontbody +\let\fontstyle \defaultfontstyle +\let\fontalternative \defaultfontalternative +\let\fontsize \defaultfontsize +\let\fontface \!!zerocount + +\protect \endinput diff --git a/tex/context/base/lpdf-ano.lua b/tex/context/base/lpdf-ano.lua index 1aebe4e64..4d0a55f80 100644 --- a/tex/context/base/lpdf-ano.lua +++ b/tex/context/base/lpdf-ano.lua @@ -355,7 +355,7 @@ runners["outer"] = function(var,actions) end runners["outer with inner"] = function(var,actions) - local file = references.checkedfile(var.f) + local file = references.checkedfile(var.outer) -- was var.f but fails ... why return link(nil,file,var.inner,var.r,actions) end diff --git a/tex/context/base/lxml-css.lua b/tex/context/base/lxml-css.lua index cf946daf7..112a5e75d 100644 --- a/tex/context/base/lxml-css.lua +++ b/tex/context/base/lxml-css.lua @@ -14,6 +14,10 @@ local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns xml.css = xml.css or { } local css = xml.css +if not number.dimenfactors then + require("util-dim.lua") +end + local dimenfactors = number.dimenfactors local bpf = 1/dimenfactors.bp local cmf = 1/dimenfactors.cm @@ -75,6 +79,8 @@ css.padding = padding -- print(padding("10pt 20pt 30pt",pixel,hsize,exheight,emwidth)) -- print(padding("10pt 20pt 30pt 40pt",pixel,hsize,exheight,emwidth)) +-- print(padding("0",pixel,hsize,exheight,emwidth)) + -- local currentfont = font.current -- local texdimen = tex.dimen -- local hashes = fonts.hashes diff --git a/tex/context/base/lxml-lpt.lua b/tex/context/base/lxml-lpt.lua index 4e53e55f9..2644abf88 100644 --- a/tex/context/base/lxml-lpt.lua +++ b/tex/context/base/lxml-lpt.lua @@ -164,8 +164,8 @@ apply_axis['child'] = function(list) c = c + 1 collected[c] = dk dk.ni = k -- refresh - en = en + 1 - dk.ei = en + en = en + 1 + dk.ei = en end end ll.en = en diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index fa29e49c2..53e1c0779 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -598,14 +598,23 @@ \unexpanded\def\math_prime_indeed {\iffontchar\textfont\zerocount"FE325\relax - ^\bgroup +% ^\bgroup \expandafter\math_prime_indeed_virtual % virtual mess (using funny signal) \else - \expandafter\math_prime_indeed_normal % gets collapsed +% \expandafter\math_prime_indeed_normal % gets collapsed + \expandafter\math_prime_indeed_crapped % gets collapsed \fi} +\def\math_prime_indeed_crapped + {{^{\math_prime_indeed_normal}}} + \let\prime\math_prime_indeed +\def\math_prime_indeed_virtual + {^\bgroup + \math_prime_indeed_normal + \futurelet\nexttoken\math_prime_indeed_choice} + \installcorenamespace{mathprime} \def\math_prime_indeed_virtual diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index 43dcef7bf..18f0db163 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -1548,15 +1548,12 @@ % \framed[width=12cm,height=3cm,orientation=-270]{\input ward\relax} \def\pack_framed_start_orientation - {\ifcase\p_framed_orientation\else + {\ifcase\p_framed_orientation \let\pack_framed_stop_orientation\relax \else \scratchcounter\p_framed_orientation % weird .. why \divide\scratchcounter\plustwo \ifodd\scratchcounter - \swapmacros\framedwidth\framedheight - \swapmacros\localwidth\localheight - \swapdimens\d_framed_height\d_framed_width \let\pack_framed_stop_orientation\pack_framed_stop_orientation_odd \else \let\pack_framed_stop_orientation\pack_framed_stop_orientation_even @@ -2184,24 +2181,50 @@ %D possible to the circumstances and act as natural as %D possible. -\def\pack_framed_vboxed_hairline - {\bgroup - \dimen2=\ifconditional\c_framed_has_offset \localoffset \else \zeropoint \fi - \dimen4=\dimexpr\dimen2+\d_framed_linewidth\relax - \setbox0\vbox - {\advance\hsize 2\dimen4 - \vskip\dimen2 - \hrule - \!!height\d_framed_linewidth - \!!depth\zeropoint - \!!width\hsize - \vskip\dimen2}% - \endgraf\obeydepth\nointerlineskip - \moveleft\dimen4\box0 - \endgraf\nointerlineskip\localbegstrut % beware, we might kill it in a style using \vskip\lineheight - \egroup} % so this must not be changed - -\def\pack_framed_hboxed_hairline % use framed dimen +% \unexpanded\def\pack_framed_vboxed_hairline +% {\bgroup +% \dimen2=\ifconditional\c_framed_has_offset \localoffset \else \zeropoint \fi +% \dimen4=\dimexpr\dimen2+\d_framed_linewidth\relax +% \setbox0\vbox +% {\advance\hsize 2\dimen4 +% \vskip\dimen2 +% \hrule +% \!!height\d_framed_linewidth +% \!!depth\zeropoint +% \!!width\hsize +% \vskip\dimen2}% +% \endgraf\obeydepth\nointerlineskip +% \moveleft\dimen4\box0 +% \endgraf\nointerlineskip\localbegstrut % beware, we might kill it in a style using \vskip\lineheight +% \egroup} % so this must not be changed + +\unexpanded\def\pack_framed_vboxed_hairline % nasty overlay mess .. needed for autowidth + {\begingroup + \scratchoffset\ifconditional\c_framed_has_offset \localoffset \else \zeropoint \fi + \scratchwidth \dimexpr\scratchoffset+\d_framed_linewidth\relax + \par + \nointerlineskip + \kern\scratchoffset + \dontleavehmode + \hrule\!!height\d_framed_linewidth\!!depth\zeropoint + \par + \kern-\d_framed_linewidth + \dontleavehmode + \hbox to \zeropoint{\normalhss\vrule\!!height\d_framed_linewidth\!!depth\zeropoint\!!width\scratchwidth}% + \hfill + \hbox to \zeropoint{\vrule\!!height\d_framed_linewidth\!!depth\zeropoint\!!width\scratchwidth\normalhss}% + \par + \nointerlineskip + \kern\scratchoffset + \nointerlineskip + \endgraf + \nointerlineskip + \localbegstrut + \endgroup} + +% todo: + +\unexpanded\def\pack_framed_hboxed_hairline % use framed dimen {\bgroup \dimen2=\ifconditional\c_framed_has_offset \localoffset \else \zeropoint \fi \ifconditional\c_framed_has_height diff --git a/tex/context/base/page-bck.mkiv b/tex/context/base/page-bck.mkiv index 42891e76e..18e0a9f4d 100644 --- a/tex/context/base/page-bck.mkiv +++ b/tex/context/base/page-bck.mkiv @@ -669,6 +669,16 @@ \def\hiddenbackgroundlist {\v!text-2,\v!text-1,\v!foreground,\v!text+1,\v!text+2} +% \defineoverlay[\v!text-2][\positionoverlay{\v!text-2}] +% \defineoverlay[\v!text-1][\positionoverlay{\v!text-1}] +% \defineoverlay[\v!text+1][\positionoverlay{\v!text+1}] +% \defineoverlay[\v!text+2][\positionoverlay{\v!text+2}] + +\defineoverlay[\v!text-2][\positionregionoverlay\textanchor{\v!text-2}] % no new anchor, we share text +\defineoverlay[\v!text-1][\positionregionoverlay\textanchor{\v!text-1}] +\defineoverlay[\v!text+1][\positionregionoverlay\textanchor{\v!text+1}] +\defineoverlay[\v!text+2][\positionregionoverlay\textanchor{\v!text+2}] + \setupbackgrounds [\v!hidden] [\c!background=\hiddenbackgroundlist] @@ -686,7 +696,7 @@ \def\localbackgroundlist {\v!local-2,\v!local-1,\v!foreground,\v!local+1,\v!local+2} -\defineoverlay[\v!local-2][\positionoverlay{\v!local-2}] +\defineoverlay[\v!local-2][\positionoverlay{\v!local-2}] % todo share \defineoverlay[\v!local-1][\positionoverlay{\v!local-1}] \defineoverlay[\v!local+1][\positionoverlay{\v!local+1}] \defineoverlay[\v!local+2][\positionoverlay{\v!local+2}] @@ -698,12 +708,8 @@ \expandafter\gobbleoneargument \fi} -% \def\page_backgrounds_add_local_to_box_indeed#1% -% {\setbox#1\hbox{\fastlocalframed[\??ma\v!local][]{\registerMPlocaltextarea{\box#1}}}% -% \global\advance\localpositionnumber\plusone} % afterwards ! - \def\page_backgrounds_add_local_to_box_indeed#1% - {\setbox#1\hbox{\registerMPlocaltextarea{\box#1}}% + {%\setbox#1\hbox{\registerMPlocaltextarea{\box#1}}% \setbox#1\hbox{\localbackgroundframed{\??ma\v!local}\v!local#1}% \global\advance\localpositionnumber\plusone} % afterwards ! diff --git a/tex/context/base/page-box.mkvi b/tex/context/base/page-box.mkvi index 746944ef3..a13f794f1 100644 --- a/tex/context/base/page-box.mkvi +++ b/tex/context/base/page-box.mkvi @@ -275,28 +275,31 @@ \def\page_areas_registered_box_forget#1#2#3% #1=lower-dp #2=correct-ht #3=box {\box#3} +% \def\page_areas_registered_box_indeed#1#2#3% #1=lower-dp #2=correct-ht #3=box +% {\hbox\bgroup +% \ifx\registerMPtextarea\undefined \else +% \setbox\b_page_areas_registered\emptyhbox +% \wd\b_page_areas_registered\wd#3% +% \ht\b_page_areas_registered\ht#3% +% \dp\b_page_areas_registered\dp#3% +% \ifcase#1\or % 1 +% \setbox\b_page_areas_registered\hbox{\lower\strutdp\box\b_page_areas_registered}% +% \fi +% \ifcase#2\or % 1 +% \setbox\b_page_areas_registered\hbox{\raise\topskip\hbox{\lower\strutht\box\b_page_areas_registered}}% +% \dp\b_page_areas_registered\strutdp +% \fi +% \dp\b_page_areas_registered\strutdp % needed +% \setbox\b_page_areas_registered\hbox +% {\registerMPtextarea{\box\b_page_areas_registered}}% +% \smashbox\b_page_areas_registered +% \box\b_page_areas_registered +% \fi +% \box#3% +% \egroup} + \def\page_areas_registered_box_indeed#1#2#3% #1=lower-dp #2=correct-ht #3=box - {\hbox\bgroup - \ifx\registerMPtextarea\undefined \else - \setbox\b_page_areas_registered\emptyhbox - \wd\b_page_areas_registered\wd#3% - \ht\b_page_areas_registered\ht#3% - \dp\b_page_areas_registered\dp#3% - \ifcase#1\or % 1 - \setbox\b_page_areas_registered\hbox{\lower\strutdp\box\b_page_areas_registered}% - \fi - \ifcase#2\or % 1 - \setbox\b_page_areas_registered\hbox{\raise\topskip\hbox{\lower\strutht\box\b_page_areas_registered}}% - \dp\b_page_areas_registered\strutdp - \fi - \dp\b_page_areas_registered\strutdp % needed - \setbox\b_page_areas_registered\hbox - {\registerMPtextarea{\box\b_page_areas_registered}}% - \smashbox\b_page_areas_registered - \box\b_page_areas_registered - \fi - \box#3% - \egroup} + {\anch_mark_flow_box{#3}} \def\page_areas_register_direct#1% {\xypos{pbd:\realfolio:b}% we could save bytes by only saving the y diff --git a/tex/context/base/page-brk.mkiv b/tex/context/base/page-brk.mkiv index 01e4beb95..82aa809e8 100644 --- a/tex/context/base/page-brk.mkiv +++ b/tex/context/base/page-brk.mkiv @@ -336,7 +336,7 @@ #1\lineheight +\pagetotal \ifdim\lastskip<\parskip+\parskip\fi - \ifthirdargument+#2\fi + \ifsecondargument+#2\fi \relax \ifcase\testpagemethod \ifdim\d_page_tests_test>.99\pagegoal diff --git a/tex/context/base/page-mul.mkiv b/tex/context/base/page-mul.mkiv index 4901c1edf..948ef0bcc 100644 --- a/tex/context/base/page-mul.mkiv +++ b/tex/context/base/page-mul.mkiv @@ -488,10 +488,12 @@ \else \@EA\dohandleallcolumns \fi - {\finishcolumnbox{\hbox - {\ifx\finishcolumnbox\relax\else\strut\fi - \anch_mark_column_box\currentcolumnbox - \box\currentcolumnbox}}% + {\finishcolumnbox + {\setbox\scratchbox\hbox + {\ifx\finishcolumnbox\relax\else\strut\fi + \strut\box\currentcolumnbox}% + \anch_mark_column_box\scratchbox + \box\scratchbox}% \hfil}% \unskip \hskip\colrightskip}}% new @@ -537,28 +539,28 @@ \or % \input tufte \startcolumns \showbaselines \input tufte \stopcolumns \input tufte \ifconditional\someprecolumncontent -% \scratchdimen\topskip -% \advance\scratchdimen -\openstrutheight -% \nointerlineskip -% \vskip-\scratchdimen + % \scratchdimen\topskip + % \advance\scratchdimen -\openstrutheight + % \nointerlineskip + % \vskip-\scratchdimen \nointerlineskip \vskip\dimexpr\openstrutheight-\topskip\relax \fi \or -% \scratchdimen\topskip -% \advance\scratchdimen -\openstrutheight -% \nointerlineskip -% \vskip-\scratchdimen + % \scratchdimen\topskip + % \advance\scratchdimen -\openstrutheight + % \nointerlineskip + % \vskip-\scratchdimen \nointerlineskip \vskip\dimexpr\openstrutheight-\topskip\relax \or % untested but maybe handy -% \scratchdimen\topskip -% \advance\scratchdimen -\openstrutheight -% \nointerlineskip -% \vskip-\scratchdimen -% \vskip-\lineheight -% \vbox{\strut}% + % \scratchdimen\topskip + % \advance\scratchdimen -\openstrutheight + % \nointerlineskip + % \vskip-\scratchdimen + % \vskip-\lineheight + % \vbox{\strut}% \nointerlineskip \vskip\dimexpr\openstrutheight-\topskip-\lineheight\relax \vbox{\strut}% @@ -580,12 +582,12 @@ \vskip-\scratchdimen}% \scratchdimen\noflines\openlineheight \advance\scratchdimen-\openstrutdepth -\ifgridsnapping - % quick hack (at least it works with itemize) -\else - \advance\scratchdimen-\openlineheight - \advance\scratchdimen\topskip -\fi + \ifgridsnapping + % quick hack (at least it works with itemize) + \else + \advance\scratchdimen-\openlineheight + \advance\scratchdimen\topskip + \fi \ht\columnpagebox\scratchdimen \dp\columnpagebox\openstrutdepth % end of mess diff --git a/tex/context/base/page-set.mkiv b/tex/context/base/page-set.mkiv index 674f54831..97ede1357 100644 --- a/tex/context/base/page-set.mkiv +++ b/tex/context/base/page-set.mkiv @@ -522,7 +522,7 @@ \def\OTRSETdofinaloutput {\ifdim\ht\OTRfinalpagebox=\textheight - \bgroup + \bgroup \ifcase\OTRSETbalancemethod \page_otr_construct_and_shipout\box\OTRfinalpagebox \else\ifdim\OTRSETbalht>\zeropoint @@ -543,9 +543,9 @@ \page_otr_construct_and_shipout\box\OTRfinalpagebox \fi \fi \globallet\OTRSETbalht\zeropoint - \egroup + \egroup \fi} - + \definesystemconstant {colset} \definetwopasslist\s!colset @@ -585,7 +585,7 @@ \synchronizenotes \fi} -\def\OTRSETsethsize % of course this does not migrate outside the otr +\def\page_set_command_set_hsize % of course this does not migrate outside the otr {\localcolumnwidth\OTRSETlocalwidth\mofcolumns \textwidth\localcolumnwidth \hsize\localcolumnwidth} @@ -598,7 +598,8 @@ \egroup \else % only if change in width and \column/\break - \egroup \OTRSETsethsize + \egroup + \page_set_command_set_hsize \fi \fi} @@ -627,7 +628,7 @@ {\OTRSETcolumnhbreak \page_otr_flush_all_floats \page_otr_eject_page - % no \OTRSETsethsize, can be mid smaller (like tabulate) + % no \page_set_command_set_hsize, can be mid smaller (like tabulate) % also, this one should be executed at the outer level % (setting hsize inside otr does not work) \page_set_command_synchronize_hsize} @@ -688,7 +689,7 @@ \newconstant\OTRSETflushtextmode % will be replaced -\def\OTRSETflushtextsofar +\def\OTRSETflushtextsofar % needs renaming {\ifcase\OTRSETflushtextmode % don't mess around \or @@ -1591,7 +1592,7 @@ {\xdef\OTRSETlist{#1}}% \OTRSETstartnextpage \OTRSETassignwidths - \OTRSETsethsize + \page_set_command_set_hsize \else \bgroup \fi} @@ -1753,7 +1754,7 @@ \donothing{\OTRSETsetgridcell\mofcolumns\recurselevel\copy\placeholderboxe}}% \egroup}} -\unexpanded\def\page_otr_set_routine +\unexpanded\def\page_set_command_routine {\dontcomplain % new, get rid of overfull message (to be sorted out) \doloop {\OTRSETnaturalflush @@ -1884,11 +1885,10 @@ \mofcolumns\plusone \OTRSETinitializecolumns \OTRSETassignwidths % already done - \OTRSETsethsize + \page_set_command_set_hsize \fi \!!counta#2\!!countb#3\docalculatecolumnsetspan - \expandafter\egroup\expandafter\edef\expandafter - #4\expandafter{\the\!!widtha}} + \expandafter\egroup\expandafter\edef\expandafter#4\expandafter{\the\!!widtha}} % interface to footnotes @@ -2551,7 +2551,7 @@ [\s!page_otr_command_routine =\page_set_command_routine, \s!page_otr_command_package_contents =\page_set_command_package_contents, \s!page_otr_command_set_vsize =\page_set_command_set_vsize, - \s!page_otr_command_set_hsize =\page_set_command_set_hsize, +% \s!page_otr_command_set_hsize =\page_one_command_set_hsize, % tricky, goes wrong \s!page_otr_command_next_page =\page_set_command_next_page, \s!page_otr_command_next_page_and_inserts =\page_set_command_next_page_and_inserts, \s!page_otr_command_synchronize_hsize =\page_set_command_synchronize_hsize, diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv index 1c92def9c..b38fb6ea6 100644 --- a/tex/context/base/spac-ali.mkiv +++ b/tex/context/base/spac-ali.mkiv @@ -547,7 +547,7 @@ \unexpanded\def\usealignparameter#1% faster local variant {\edef\m_spac_align{#1\c!align}% - \ifx\m_spac_align\else + \ifx\m_spac_align\empty\else \expandafter\let\expandafter\raggedcommand\csname\??alignmentnormalcache\m_spac_align\endcsname \ifx\raggedcommand\relax \spac_align_add_to_cache\m_spac_align @@ -615,8 +615,8 @@ \setvalue{\??aligncommand\v!nothanging }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\font_protruding_disable}} \setvalue{\??aligncommand\v!hz }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\font_expansion_enable }} \setvalue{\??aligncommand\v!nohz }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\font_expansion_disable }} -\setvalue{\??aligncommand\v!spacing }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\enablespacehandling \enablekernhandling }} -\setvalue{\??aligncommand\v!nospacing }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\disablespacehandling\disablekernhandling}} +%setvalue{\??aligncommand\v!spacing }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\enablespacehandling \enablekernhandling }} % not in mkiv +%setvalue{\??aligncommand\v!nospacing }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\disablespacehandling\disablekernhandling}} % not in mkiv \setvalue{\??aligncommand\v!hyphenated }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\dohyphens}} \setvalue{\??aligncommand\v!nothyphenated }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\nohyphens}} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 92f846922..e4c854d1d 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index baeec7fb3..21a63fa67 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-con.mkvi b/tex/context/base/strc-con.mkvi index 0ef2d8b4a..a4df0dc36 100644 --- a/tex/context/base/strc-con.mkvi +++ b/tex/context/base/strc-con.mkvi @@ -212,14 +212,11 @@ \endgroup} \unexpanded\def\strc_constructions_stored_start - {\begingroup - \csname\??constructionstarthandler\currentconstructionhandler\endcsname - } + {\begingroup % brrr \endgroup elsewhere ... will be sorted out + \csname\??constructionstarthandler\currentconstructionhandler\endcsname} \unexpanded\def\strc_constructions_stored_stop - {\csname\??constructionstophandler\currentconstructionhandler\endcsname - %\endgroup % brrr - } + {\csname\??constructionstophandler\currentconstructionhandler\endcsname} \newconstant\c_strc_constructions_nested_state % to be redone @@ -427,7 +424,7 @@ \hangafter-\noflines \else \hangafter-\p_hang - \fi + \fi\fi\fi \relax \hangindent\ifx#1\v!right-\fi\constructionsheadwidth} @@ -750,6 +747,10 @@ \ctxcommand{discardfromlist(\currentconstructionlistentry)}% \fi} +\let\currentconstructionlistnumber \!!zerocount +\let\currentconstructionsynchronize\relax +\let\currentconstructionattribute \attributeunsetvalue + \def\strc_constructions_register_yes[#1][#2]% #1=interfaced-settings, #2=optional user data {\begingroup % similar to structure so we might generalize this \setupcurrentconstruction[#1]% % xdef's will become edef's diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi index 099c6fe5f..fa0a9d960 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -908,19 +908,19 @@ \installcorenamespace{extrafloataction} -\setvalue{\??extrafloataction \v!inner}{\strc_floats_set_extra_action\v!left \v!right} -\setvalue{\??extrafloataction \v!outer}{\strc_floats_set_extra_action\v!right \v!left} -\setvalue{\??extrafloataction\v!innermargin}{\strc_floats_set_extra_action\v!leftmargin \v!rightmargin} -\setvalue{\??extrafloataction\v!outermargin}{\strc_floats_set_extra_action\v!rightmargin\v!leftmargin} -\setvalue{\??extrafloataction \v!inneredge}{\strc_floats_set_extra_action\v!leftedge \v!rightedge} -\setvalue{\??extrafloataction \v!outeredge}{\strc_floats_set_extra_action\v!rightedge \v!leftedge} -\setvalue{\??extrafloataction \v!backspace}{\strc_floats_set_extra_action\v!backspace \v!cutspace} -\setvalue{\??extrafloataction \v!cutspace}{\strc_floats_set_extra_action\v!cutspace \v!backspace} -%setvalue{\??extrafloataction \v!margin}{\strc_floats_set_extra_action\v!cutspace \v!backspace} -\setvalue{\??extrafloataction \v!left}{\strc_floats_set_extra_action\v!left \v!left} -\setvalue{\??extrafloataction \v!right}{\strc_floats_set_extra_action\v!right \v!right} -\setvalue{\??extrafloataction \v!line}{} % only -n*line is handled (see ***) -\setvalue{\??extrafloataction \s!unknown}{\movedownsidefloat[\commalistelement]} +\setvalue{\??extrafloataction \v!inner}#1{\strc_floats_set_extra_action\v!left \v!right} +\setvalue{\??extrafloataction \v!outer}#1{\strc_floats_set_extra_action\v!right \v!left} +\setvalue{\??extrafloataction\v!innermargin}#1{\strc_floats_set_extra_action\v!leftmargin \v!rightmargin} +\setvalue{\??extrafloataction\v!outermargin}#1{\strc_floats_set_extra_action\v!rightmargin\v!leftmargin} +\setvalue{\??extrafloataction \v!inneredge}#1{\strc_floats_set_extra_action\v!leftedge \v!rightedge} +\setvalue{\??extrafloataction \v!outeredge}#1{\strc_floats_set_extra_action\v!rightedge \v!leftedge} +\setvalue{\??extrafloataction \v!backspace}#1{\strc_floats_set_extra_action\v!backspace \v!cutspace} +\setvalue{\??extrafloataction \v!cutspace}#1{\strc_floats_set_extra_action\v!cutspace \v!backspace} +%setvalue{\??extrafloataction \v!margin}#1{\strc_floats_set_extra_action\v!cutspace \v!backspace} +\setvalue{\??extrafloataction \v!left}#1{\strc_floats_set_extra_action\v!left \v!left} +\setvalue{\??extrafloataction \v!right}#1{\strc_floats_set_extra_action\v!right \v!right} +\setvalue{\??extrafloataction \v!line}#1{} % only -n*line is handled (see ***) +\setvalue{\??extrafloataction \s!unknown}#1{\movedownsidefloat[#1]} \def\strc_floats_check_extra_actions % less tracingthis way ... {\doifnotinset\v!text\floatlocation % fuzzy, text overloads left, since then it's a directive @@ -934,8 +934,8 @@ \def\strc_floats_check_extra_actions_step#step% {\csname\??extrafloataction - \ifcsname\??extrafloataction#1\endcsname#step\else\s!unknown\fi - \endcsname} + \ifcsname\??extrafloataction#step\endcsname#step\else\s!unknown\fi + \endcsname{#step}} % pas op, maxbreedte niet instellen als plaats=links/rechts diff --git a/tex/context/base/strc-ini.lua b/tex/context/base/strc-ini.lua index 923d35f6d..8644c87e3 100644 --- a/tex/context/base/strc-ini.lua +++ b/tex/context/base/strc-ini.lua @@ -115,10 +115,23 @@ end local helpers = structures.helpers -function helpers.touserdata(str) - local hash = str and str ~= "" and settings_to_hash(str) - if hash and next(hash) then - return hash +-- function helpers.touserdata(str) +-- local hash = str and str ~= "" and settings_to_hash(str) +-- if hash and next(hash) then +-- return hash +-- end +-- end + +function helpers.touserdata(data) + if type(data) == "string" then + if data == "" then + return nil + else + data = settings_to_hash(data) + end + end + if data and next(data) then + return data end end diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua index 734ca3f7e..25d046f4f 100644 --- a/tex/context/base/strc-lst.lua +++ b/tex/context/base/strc-lst.lua @@ -116,6 +116,10 @@ end job.register('structures.lists.collected', tobesaved, initializer) function lists.addto(t) + local u = t.userdata + if u and type(u) == "string" then + t.userdata = helpers.touserdata(u) -- nicer at the tex end + end local m = t.metadata local r = t.references local i = (r and r.internal) or 0 -- brrr @@ -131,10 +135,6 @@ function lists.addto(t) if setcomponent then setcomponent(t) -- might move to the tex end end - local u = t.userdata - if u and type(u) == "string" then - t.userdata = helpers.touserdata(u) -- nicer at the tex end - end return p end diff --git a/tex/context/base/strc-lst.mkvi b/tex/context/base/strc-lst.mkvi index aa3da63e8..a814bdae4 100644 --- a/tex/context/base/strc-lst.mkvi +++ b/tex/context/base/strc-lst.mkvi @@ -65,10 +65,9 @@ \c!numbercommand=\firstofoneargument, \c!textcommand=\firstofoneargument, \c!pagecommand=\firstofoneargument, - \c!pagenumber=\v!yes, - \c!headnumber=\v!yes, % old (keep for a while) -% \c!headnumber=\v!yes, % old (keep for a while) -% \c!sectionnumber=\listparameter\c!headnumber, % use this instead + \c!pagenumber=\v!yes, % better: 'first' + \c!headnumber=\v!yes, % better: 'second' +% \c!sectionnumber=\listparameter\c!headnumber, % use this instead \c!interaction=\v!all, % was \v!sectionnumber, % or make this headnumber (or accept both) \c!label=\v!no, %\c!extras=, @@ -196,10 +195,10 @@ \doifelse{\namedlistparameter{#tag}\c!state}\v!start\strc_lists_write_to_yes\strc_lists_write_to_nop} \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[\c!location=\v!here,#settings,\c!type=\s!simple][\s!first={#first},\s!second={#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 @@ -715,6 +714,8 @@ \newconditional\c_lists_has_number \newconditional\c_lists_has_page +\newconditional\c_lists_show_number +\newconditional\c_lists_show_page \let\currentlistentrylocation \empty % watch the 'entry' in the name \let\currentlistentrynumber \empty % watch the 'entry' in the name @@ -742,8 +743,31 @@ % because these tests happen often and because we're dealing with % rather complex composed data we have special conditionals; keep % in mind that testing for empty fails do to tagging being applied - \doifstructurelisthaspageelse \settrue\setfalse\c_lists_has_page - \doifstructurelisthasnumberelse\settrue\setfalse\c_lists_has_number + \edef\p_pagenumber{\listparameter\c!pagenumber}% + \ifx\p_pagenumber\v!always + \settrue\c_lists_has_page + \settrue\c_lists_show_page + \else + \doifstructurelisthaspageelse\settrue\setfalse\c_lists_has_page + \ifx\p_pagenumber\v!yes + \settrue\c_lists_show_page + \else + \setfalse\c_lists_show_page + \fi + \fi + % always forces number placement (in bib we use a forced number) + \edef\p_headnumber{\listparameter\c!headnumber}% + \ifx\p_headnumber\v!always + \settrue\c_lists_has_number + \settrue\c_lists_show_number + \else + \doifstructurelisthasnumberelse\settrue\setfalse\c_lists_has_number + \ifx\p_headnumber\v!yes + \settrue\c_lists_show_number + \else + \setfalse\c_lists_show_number + \fi + \fi \to \t_lists_every_renderingsetup \appendtoks @@ -759,6 +783,8 @@ \let\currentlistentrypagenumber\empty \setfalse\c_lists_has_page \setfalse\c_lists_has_number + \setfalse\c_lists_show_page + \setfalse\c_lists_show_number \to \t_lists_every_renderingcleanup \unexpanded\def\strc_lists_apply_renderingsetup @@ -800,8 +826,7 @@ \vbox { \forgetall \hbox \strc_lists_get_reference_attribute\v!all { - \edef\p_headnumber{\listparameter\c!headnumber} - \ifx\p_headnumber\v!yes + \ifconditional\c_lists_show_number % \ifconditional\c_lists_has_page \hbox \strc_lists_get_reference_attribute\v!number { \strc_lists_set_style_color\c!numberstyle\c!numbercolor\v!number @@ -814,8 +839,7 @@ \the\t_lists_every_renderingtext \listparameter\c!textcommand\currentlistentrytitle } - \edef\p_pagenumber{\listparameter\c!pagenumber} - \ifx\p_pagenumber\v!yes + \ifconditional\c_lists_show_page \ifconditional\c_lists_has_page \hbox \strc_lists_get_reference_attribute\v!pagenumber { \strc_lists_set_style_color\c!pagestyle\c!pagecolor\v!pagenumber @@ -864,9 +888,8 @@ \forgetall \strc_lists_set_style_color\c!style\c!color\v!all \scratchhsize\hsize - \edef\p_headnumber{\listparameter\c!headnumber} \ifconditional\c_lists_has_number - \ifx\p_headnumber\v!yes + \ifconditional\c_lists_show_number \setbox\b_strc_lists_number\hbox \strc_lists_get_reference_attribute\v!number \ifdim\scratchwidth>\zeropoint to \scratchwidth \fi { \strc_lists_set_style_color\c!numberstyle\c!numbercolor\v!number \listparameter\c!numbercommand\currentlistsymbol @@ -881,8 +904,7 @@ \setbox\b_strc_lists_number\emptyhbox \fi \ifconditional\c_lists_has_page - \edef\p_pagenumber{\listparameter\c!pagenumber} - \ifx\p_pagenumber\v!yes + \ifconditional\c_lists_show_page \setbox\b_strc_lists_page\hbox { \scratchdimen\listalternativeparameter\c!width \hbox \strc_lists_get_reference_attribute\v!pagenumber \ifdim\scratchdimen>\zeropoint to \scratchdimen\fi { @@ -986,8 +1008,7 @@ \strc_lists_set_style_color\c!style\c!color\v!all \strc_lists_get_destination_attribute \begingroup - \edef\p_headnumber{\listparameter\c!headnumber} - \ifx\p_headnumber\v!yes + \ifconditional\c_lists_show_number \donetrue \ifconditional\c_lists_has_number \else \edef\p_symbol{\listparameter\c!symbol} @@ -1019,8 +1040,7 @@ \endgroup \begingroup \ifconditional\c_lists_has_page - \edef\p_pagenumber{\listparameter\c!pagenumber} - \ifx\p_pagenumber\v!yes + \ifconditional\c_lists_show_page \nobreak \hskip.75em\relax \nobreak diff --git a/tex/context/base/strc-not.mkvi b/tex/context/base/strc-not.mkvi index 0a1ede550..4bfcc291d 100644 --- a/tex/context/base/strc-not.mkvi +++ b/tex/context/base/strc-not.mkvi @@ -184,7 +184,7 @@ \iftrialtypesetting \strc_counters_save\currentconstructionnumber \fi - \strc_counters_increment_sub\currentconstructionnumber\currentconstructionlevel +% \strc_counters_increment_sub\currentconstructionnumber\currentconstructionlevel \else \setfalse\c_strc_constructions_number_state \fi @@ -219,6 +219,7 @@ \unexpanded\def\strc_notations_command#1% {\begingroup \strc_constructions_initialize{#1}% + \strc_counters_increment_sub\currentconstructionnumber\currentconstructionlevel \doifnextoptionalelse\strc_notations_command_yes\strc_notations_command_nop} \unexpanded\def\strc_notations_command_nop#1% @@ -242,6 +243,7 @@ \unexpanded\def\strc_notations_start#1#2% {\begingroup \strc_constructions_initialize{#1}% + \strc_counters_increment_sub\currentconstructionnumber\currentconstructionlevel \normalexpanded % not that efficient but also not that frequently used {\def\noexpand\strc_pickup_yes[##1]##2\csname\e!stop#2\endcsname{\strc_notations_command_yes[##1]{##2}}% \def\noexpand\strc_pickup_nop ##1\csname\e!stop#2\endcsname{\strc_notations_command_nop {##1}}}% @@ -1017,9 +1019,10 @@ \unexpanded\def\setnote [#1]{\getvalue{#1}} \unexpanded\def\setnotetext[#1]{\global\settrue\c_strc_notes_skip\getvalue{#1}} -\def\handlenoteinsert#1#2% tg, id +\unexpanded\def\handlenoteinsert#1#2% tg, id {\begingroup \edef\currentnote{#1}% + \strc_constructions_initialize{#1}% \the\everybeforenoteinsert \insert\currentnoteins\bgroup \the\everyinsidenoteinsert\relax @@ -1035,13 +1038,14 @@ \the\everyafternoteinsert \endgroup} -\def\betweennoteitself#1% tg +\unexpanded\def\betweennoteitself#1% tg {\edef\currentnote{#1}% \doif{\noteparameter\c!paragraph}\v!yes\strc_notes_between_paragraphs} -\def\handlenoteitself#1#2% tg, id +\unexpanded\def\handlenoteitself#1#2% tg, id {\edef\currentnote{#1}% \edef\currentnotenumber{#2}% + \strc_constructions_initialize{#1}% not needed when called in handlenoteinsert \edef\currentconstructionlistentry{\ctxlua{tex.write(structures.notes.listindex("#1",#2))}}% index in list cache % as we can have collected notes (e.g. in tables) we need to recover % \currentdescriptionattribute and \currentdescriptionsynchronize diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index 08c7166a2..5f00960e0 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -3012,7 +3012,7 @@ %D Apart from the prefixes, a few more \type{\expandafters} %D are needed: -\def\newif#1% +\unexpanded\def\newif#1% {\scratchcounter\escapechar \escapechar\minusone \expandafter\expandafter\expandafter @@ -3029,16 +3029,16 @@ \unexpanded\def\define#1% {\ifdefined#1% \message{[\noexpand#1is already defined]}% - \expandafter\def\expandafter\gobbleddefinition + \unexpanded\expandafter\def\expandafter\gobbleddefinition \else - \expandafter\def + \unexpanded\expandafter\def \fi#1} \def\redefine#1% {\ifdefined#1% \message{[\noexpand#1is redefined]}% \fi - \def#1} + \unexpanded\def#1} % \define\hans{hans} % \redefine\hans{hans} diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv index 6e2178f39..ee2adb733 100644 --- a/tex/context/base/tabl-tbl.mkiv +++ b/tex/context/base/tabl-tbl.mkiv @@ -420,6 +420,9 @@ \fi \fi\fi} +\let\tabl_tabulate_hook_b\donothing +\let\tabl_tabulate_hook_e\donothing + \def\tabl_tabulate_set_preamble_step#1#2% only makes sense for many tabulates {\normalexpanded{\t_tabl_tabulate_preamble{\the\t_tabl_tabulate_preamble \tabl_tabulate_check_local_vrule_thickness\constantdimenargument\d_tabl_tabulate_vrulethickness @@ -452,6 +455,7 @@ \bgroup \tabl_tabulate_bbskip \bgroup % we cannot combine the if because a cell may have only one ## +\tabl_tabulate_hook_b \c_tabl_tabulate_align\constantnumber\c_tabl_tabulate_align % needed in tag passing \noexpand\dostarttagged\noexpand\t!tabulatecell\noexpand\empty \noexpand\dotagtabulatecell @@ -481,6 +485,7 @@ \tabl_tabulate_shaped_par_end \fi \noexpand#2% +\tabl_tabulate_hook_e \egroup \egroup \aligntab @@ -1065,7 +1070,7 @@ \fi \lettabulationparameter\c!format\p_format \ifsecondargument - \getcurrenttabulationparameters[#2]% + \setupcurrenttabulation[#2]% \fi \tabl_tabulate_start_building} @@ -1923,9 +1928,27 @@ % \glet\tabl_tabulate_flush_collected\empty \ifdim\d_tabl_tabulate_margin>\zeropoint - \t_tabl_tabulate_preamble{\aligntab\tabl_tabulate_flush_indent\strut\alignmark\alignmark\tabskip\d_tabl_tabulate_margin\strut\aligntab\alignmark\alignmark\tabskip\zeropoint}% + \t_tabl_tabulate_preamble + {\aligntab + \tabl_tabulate_flush_indent +% \global\advance\c_tabl_tabulate_noflines\plusone + \strut + \alignmark\alignmark + \tabskip\d_tabl_tabulate_margin + \strut + \aligntab + \alignmark\alignmark + \tabskip\zeropoint}% \else - \t_tabl_tabulate_preamble{\aligntab\tabl_tabulate_flush_indent\strut\alignmark\alignmark\aligntab\alignmark\alignmark\tabskip\zeropoint}% + \t_tabl_tabulate_preamble + {\aligntab + \tabl_tabulate_flush_indent +% \global\advance\c_tabl_tabulate_noflines\plusone + \strut + \alignmark\alignmark + \aligntab + \alignmark\alignmark + \tabskip\zeropoint}% \fi \d_tabl_tabulate_width\zeropoint % these counters are set at the lua end @@ -2208,11 +2231,4 @@ % \NC \digits $@@@.@@1,@@$ \NC\NR % \stoptabulatie -% we don't register the paragraph characteristics, only the -% width - -\appendtoks - \setinnerparpositions % see "techniek" for application -\to \everytabulate - \protect \endinput diff --git a/tex/context/base/type-imp-texgyre.mkiv b/tex/context/base/type-imp-texgyre.mkiv index ef487f262..c2e06ae29 100644 --- a/tex/context/base/type-imp-texgyre.mkiv +++ b/tex/context/base/type-imp-texgyre.mkiv @@ -16,72 +16,6 @@ \starttypescriptcollection[texgyre] - % caps: \definetypeface [pagella] [rm] [serif] [pagella-caps] [default] - - \starttypescript [times,termes] - \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] - \definetypeface [\typescriptone] [\s!ss] [\s!sans] [helvetica] [\s!default] [\s!rscale=0.9] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.05] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [times] [\s!default] - \quittypescriptscanning - \stoptypescript - - \starttypescript [palatino,pagella] - \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] - \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] [\s!rscale=1.075] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.075] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [palatino] [\s!default] - \quittypescriptscanning - \stoptypescript - - \starttypescript [schoolbook,schola] - \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] - \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] [\s!rscale=1.1] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.1] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern] [\s!default] [\s!rscale=1.1] - \quittypescriptscanning - \stoptypescript - - \starttypescript [bookman,bonum] - \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] - \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] [\s!rscale=1.1] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.1] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern] [\s!default] [\s!rscale=1.1] - \quittypescriptscanning - \stoptypescript - - \starttypescript [chancery,chorus] - \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] - \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern] [\s!default] - \quittypescriptscanning - \stoptypescript - - \starttypescript [helvetica,heros] - \definetypeface [\typescriptone] [\s!ss] [\s!sans] [\typescriptone] [\s!default] - \definetypeface [\typescriptone] [\s!rm] [\s!serif] [modern] [\s!default] [\s!rscale=1.15] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.15] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern] [\s!default] [\s!rscale=1.15] - \quittypescriptscanning - \stoptypescript - - \starttypescript [avantgarde,adventor] - \definetypeface [\typescriptone] [\s!ss] [\s!sans] [adventor] [\s!default] - \definetypeface [\typescriptone] [\s!rm] [\s!serif] [modern] [\s!default] [\s!rscale=1.15] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.15] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern] [\s!default] - \quittypescriptscanning - \stoptypescript - - \starttypescript [courier,cursor] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [\typescriptone] [\s!default] - \definetypeface [\typescriptone] [\s!rm] [\s!serif] [modern] [\s!default] - \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern] [\s!default] - \quittypescriptscanning - \stoptypescript - \definetypescriptprefix [f:pagella] [pagella] \definetypescriptprefix [f:palatino] [pagella] \definetypescriptprefix [f:termes] [termes] \definetypescriptprefix [f:times] [termes] \definetypescriptprefix [f:heros] [heros] \definetypescriptprefix [f:helvetica] [heros] @@ -91,7 +25,7 @@ \definetypescriptprefix [f:cursor] [cursor] \definetypescriptprefix [f:courier] [cursor] \definetypescriptprefix [f:chorus] [chorus] \definetypescriptprefix [f:chancery] [chorus] - \starttypescript [serif,sans] [adventor,bonum,bookman,heros,helvetica,pagella,palatino,schola,schoolbook,termes,times] + \starttypescript [\s!serif,\s!sans] [adventor,bonum,bookman,heros,helvetica,pagella,palatino,schola,schoolbook,termes,times] \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Regular] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-regular] [\s!features=\s!default] \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Italic] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-italic] [\s!features=\s!default] \definefontsynonym [\typescriptprefix{n:\typescripttwo}-Bold] [\s!file:texgyre\typescriptprefix{f:\typescripttwo}-bold] [\s!features=\s!default] @@ -193,6 +127,74 @@ \definefontsynonym [\s!MonoBoldSlanted] [\s!MonoBoldItalic] \stoptypescript + % interesting is that we cannot move these definitions up (without loosing features) + + % caps: \definetypeface [pagella] [rm] [serif] [pagella-caps] [default] + + \starttypescript [times,termes] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [helvetica] [\s!default] [\s!rscale=0.9] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.05] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [times] [\s!default] + \quittypescriptscanning + \stoptypescript + + \starttypescript [palatino,pagella] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] [\s!rscale=1.075] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.075] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [palatino] [\s!default] + \quittypescriptscanning + \stoptypescript + + \starttypescript [schoolbook,schola] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] [\s!rscale=1.1] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.1] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern] [\s!default] [\s!rscale=1.1] + \quittypescriptscanning + \stoptypescript + + \starttypescript [bookman,bonum] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] [\s!rscale=1.1] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.1] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern] [\s!default] [\s!rscale=1.1] + \quittypescriptscanning + \stoptypescript + + \starttypescript [chancery,chorus] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern] [\s!default] + \quittypescriptscanning + \stoptypescript + + \starttypescript [helvetica,heros] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [\typescriptone] [\s!default] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [modern] [\s!default] [\s!rscale=1.15] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.15] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern] [\s!default] [\s!rscale=1.15] + \quittypescriptscanning + \stoptypescript + + \starttypescript [avantgarde,adventor] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [adventor] [\s!default] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [modern] [\s!default] [\s!rscale=1.15] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.15] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern] [\s!default] + \quittypescriptscanning + \stoptypescript + + \starttypescript [courier,cursor] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [\typescriptone] [\s!default] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [modern] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern] [\s!default] + \quittypescriptscanning + \stoptypescript + \stoptypescriptcollection \starttypescriptcollection[xmath] diff --git a/tex/context/base/typo-cap.mkiv b/tex/context/base/typo-cap.mkiv index 713beaa31..c18315960 100644 --- a/tex/context/base/typo-cap.mkiv +++ b/tex/context/base/typo-cap.mkiv @@ -135,6 +135,8 @@ \usepseudocaps % we use char0 as placeholder for the larger font +% +% here we keep the \groupedcommand \unexpanded\def\pseudosmallcapped{\groupedcommand{\setcharactercasing[1]\signalcharacter\tx}{}} % all upper \unexpanded\def\pseudoSmallcapped{\groupedcommand{\setcharactercasing[5]\signalcharacter\tx}{}} % one upper + font diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 5ea4b6bc2..db5941f2f 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/08/12 21:58:28 +-- merge date : 02/16/12 09:55:05 do -- begin closure to overcome local limits and interference -- cgit v1.2.3