diff options
-rw-r--r-- | metapost/context/base/mp-core.mpiv | 19 | ||||
-rw-r--r-- | tex/context/base/anch-bck.mkvi | 21 | ||||
-rw-r--r-- | tex/context/base/anch-pgr.lua | 125 | ||||
-rw-r--r-- | tex/context/base/anch-pos.lua | 2 | ||||
-rw-r--r-- | tex/context/base/anch-pos.mkiv | 372 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4070 -> 4075 bytes | |||
-rw-r--r-- | tex/context/base/context-version.png | bin | 105731 -> 105299 bytes | |||
-rw-r--r-- | tex/context/base/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/font-otn.lua | 8 | ||||
-rw-r--r-- | tex/context/base/mlib-pps.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/page-lin.mkiv | 6 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24264 -> 24275 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 172311 -> 172321 bytes | |||
-rw-r--r-- | tex/context/base/tabl-tsp.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/typo-mar.lua | 6 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 10 |
19 files changed, 195 insertions, 386 deletions
diff --git a/metapost/context/base/mp-core.mpiv b/metapost/context/base/mp-core.mpiv index 509801b02..c0718397d 100644 --- a/metapost/context/base/mp-core.mpiv +++ b/metapost/context/base/mp-core.mpiv @@ -1139,30 +1139,31 @@ vardef do_draw_par (expr p) = enddef ; vardef baseline_grid (expr pxy, pdir, at_baseline) = - if (par_line_height>0) and (bbheight(pxy)>1) and (bbwidth(pxy)>1) and (boxgridwidth>0) : + save width ; width := bbwidth(pxy) ; + save height ; height := bbheight(pxy) ; + if (par_line_height>0) and (height>1) and (width>1) and (boxgridwidth>0) : save i, grid, bb ; picture grid ; pair start ; path bb ; def _do_ (expr start) = % 1 = normal, 2 = with background (i.e. no shine-through) if boxdashtype = 2 : - draw - start -- start shifted (bbwidth(pxy),0) - withpen pencircle scaled boxgridwidth - boxfilloptions ; + draw start -- start shifted (width,0) + withpen pencircle scaled boxgridwidth + boxfilloptions ; fi ; - draw start -- start shifted (bbwidth(pxy),0) + draw start -- start shifted (width,0) if boxdashtype > 0 : dashed evenly fi withpen pencircle scaled boxgridwidth boxgridoptions ; enddef ; - grid := image ( %fails with inlinespace + grid := image ( % fails with inlinespace if pdir=up : - for i = if at_baseline : par_strut_depth else : 0 fi step par_line_height until max(bbheight(pxy),par_line_height) : + for i = if at_baseline : par_strut_depth else : 0 fi step par_line_height until max(height,par_line_height) : _do_ (llcorner pxy shifted (0,+i)) ; endfor ; else : - for i = if at_baseline : par_strut_height else : 0 fi step par_line_height until bbheight(pxy) : + for i = if at_baseline : par_strut_height else : 0 fi step par_line_height until height : _do_ (ulcorner pxy shifted (0,-i)) ; endfor ; fi ; diff --git a/tex/context/base/anch-bck.mkvi b/tex/context/base/anch-bck.mkvi index cc796edef..677d5e2ea 100644 --- a/tex/context/base/anch-bck.mkvi +++ b/tex/context/base/anch-bck.mkvi @@ -67,10 +67,10 @@ \newcount\MPparcounter -\def\MPself {\MPvar{self}} -\def\MPbself {b:\MPvar{self}} -\def\MPeself {e:\MPvar{self}} -\def\MPparanchor {p:\number\MPparcounter} +\def\MPself {\MPvar{self}} +\def\MPbself {b:\MPvar{self}} +\def\MPeself {e:\MPvar{self}} +\def\MPparanchor{p:\number\MPparcounter} % \carryoverpar is needed for left/right floats @@ -512,6 +512,10 @@ endfor ; \stopuseMPgraphic +\setuptextbackground + [\c!mp=mpos:par:region, + \c!method=mpos:par:region] + %D \starttyping %D \setupbackground %D [test] @@ -591,15 +595,6 @@ \protect \endinput -% todo 1: shift down option - -% \startuseMPgraphic{mpos:par:columnset} -% \iftracepositions show_multi_pars \else draw_multi_pars \fi ; -% path p ; p := boundingbox currentpicture ; -% currentpicture := currentpicture shifted (0,-StrutDepth/2) ; -% setbounds currentpicture to p ; -% \stopuseMPgraphic - \definetextbackground[underline] [location=text,alternative=1,background=,frame=off] \definetextbackground[overstrike] [location=text,alternative=2,background=,frame=off] \definetextbackground[exlines] [location=text,alternative=3,background=,frame=off] diff --git a/tex/context/base/anch-pgr.lua b/tex/context/base/anch-pgr.lua index 6b7ce13be..7ab341b63 100644 --- a/tex/context/base/anch-pgr.lua +++ b/tex/context/base/anch-pgr.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['anch-pgr'] = { license = "see context related readme files" } +-- todo: we need to clean up lists (of previous pages) + local format = string.format local concat, sort = table.concat, table.sort local splitter = lpeg.splitat(":") @@ -15,6 +17,10 @@ local jobpositions = job.positions local report_graphics = logs.reporter("graphics") +local function point(n) + return format("%.5fpt",n/65536) +end + local function pair(x,y) return format("(%.5fpt,%.5fpt)",x/65536,y/65536) end @@ -36,10 +42,33 @@ local function regionarea(r) } 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 } +-- we can use a 'local t, n' and reuse the table + +local function add(t,x,y,last) + local n = #t + if n == 0 then + t[n+1] = { x, y } + elseif n == 1 then + local tn = t[1] + if tn[1] ~= x or tn[2] ~= y then + t[n+1] = { x, y } + end + else + local tm = t[n-1] + local tn = t[n] + local lx = tn[1] + local ly = tn[2] + if lx == tm[1] and lx == x then + if ly ~= y then + tn[2] = y + end + elseif ly == tm[2] and ly == y then + if lx ~= x then + tn[1] = x + end + elseif not last then + t[n+1] = { x, y } + end end end @@ -208,6 +237,7 @@ local function singlepart(b,e,r,left,right) add(area,li[1],li[2]-ry) end add(area,bx,bd-ry) + add(area,bx,bh-ry,true) -- finish last straight line (but no add as we cycle) for i=1,#area do local a = area[i] area[i] = pair(a[1],a[2]) @@ -244,6 +274,7 @@ local function firstpart(b,r,left,right) add(area,li[1],li[2]-ry) end add(area,bx,bd-ry) + add(area,bx,bh-ry,true) -- finish last straight line (but no add as we cycle) for i=1,#area do local a = area[i] area[i] = pair(a[1],a[2]) @@ -380,11 +411,13 @@ local function calculate(tag) -- if bindex == eindex then return { - [b.p] = { singlepart(b,e,collected[br],left,right) } + list = { [b.p] = { singlepart(b,e,collected[br],left,right) } }, + bpos = b, + epos = e, } else - local pars = { - [b.p] = { firstpart(b,collected[br],left,right) } + local list = { + [b.p] = { firstpart(b,collected[br],left,right) }, } for i=bindex+1,eindex-1 do br = format("%s:%s",btag,i) @@ -393,51 +426,55 @@ local function calculate(tag) report_graphics("invalid middle for '%s'",br) else local p = r.p - local pp = pars[p] + local pp = list[p] if pp then pp[#pp+1] = middlepart(r,left,right) else - pars[p] = { middlepart(r,left,right) } + list[p] = { middlepart(r,left,right) } end end end local p = e.p - local pp = pars[p] + local pp = list[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 } + list[p] = { lastpart(e,collected[er],left,right) } end + return { + list = list, + bpos = b, + epos = e, + } end end -function graphics.backgrounds.registered(anchor,page) - local pa = pending[anchor] - if pa then - concat(pa,",") - else - return "" - 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 @@ -460,6 +497,10 @@ string multikind[] ; numeric multilocs[], nofmultipars ; nofmultipars := %s ; multibox := unitsquare xyscaled %s ; +numeric par_strut_height, par_strut_depth, par_line_height ; +par_strut_height := %s ; +par_strut_depth := %s ; +par_line_height := %s ; ]] local template_b = [[ @@ -481,10 +522,10 @@ function graphics.backgrounds.fetch(n,page,anchor) if not data then data = calculate(n) pbg[n] = data -- can be replaced by register - register(data,n,anchor) + -- register(data.list,n,anchor) end if data then - local pagedata = data[page] + local pagedata = data.list[page] if pagedata then local nofmultipars = #pagedata -- report_graphics("fetching '%s' at page %s using anchor '%s' containing %s multipars",n,page,anchor,nofmultipars) @@ -494,7 +535,9 @@ function graphics.backgrounds.fetch(n,page,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)) } + local bpos = data.bpos + local bh, bd = bpos.h, bpos.d + local result = { format(template_a,nofmultipars,pair(w,h+d),point(bh),point(bd),point(bh+bd)) } for i=1,nofmultipars do local region = pagedata[i] result[#result+1] = format(template_b, diff --git a/tex/context/base/anch-pos.lua b/tex/context/base/anch-pos.lua index ff7b3ca7b..bc062161d 100644 --- a/tex/context/base/anch-pos.lua +++ b/tex/context/base/anch-pos.lua @@ -244,6 +244,8 @@ jobpositions.setall = setall jobpositions.set = set jobpositions.get = get +commands.setpos = setall + -- will become private table (could also become attribute driven but too nasty -- as attributes can bleed e.g. in margin stuff) diff --git a/tex/context/base/anch-pos.mkiv b/tex/context/base/anch-pos.mkiv index c29c98e5b..3341d40c4 100644 --- a/tex/context/base/anch-pos.mkiv +++ b/tex/context/base/anch-pos.mkiv @@ -11,108 +11,30 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% needs a cleanup, things may change; we also need to move the mp -% related code to meta-pos - -% shorter tags, ..:achtergrond:.. etc in pos actions -% dubbele text- * pos's eruit - -% class pos -> als gelijk aan vorige, dan niet niet definieren -% en erven, maw: -% -% 1 -> opslaan -% 2 -> undef, dus == prev -% 3 -> undef, dus == prev -% 4 -> opslaan - \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 -% -% at some point (when we no longer share code) we will move to numbers -% do that we have less garbage collection and hashing -% -% the global table _ptbs_ is equivalent to job.positions.tobesaved -% the global table _pcol_ is equivalent to job.positions.collected -% -% btw, using a function is more efficient than passing longer code -% snippets to ctxlua +%D In \MKIV\ there was already a different housekeeping model for positions quite +%D early, but starting in 2012 more dramatic changes started to happen, especially +%D in relation to background graphics. It will probably take some time to settle. \registerctxluafile{anch-pos}{1.001} -% todo: topskip als optie voor eerste regel achtergrond -% todo: build pos layers on top of layers -% todo: positionlayer pos van text-1 etc delen - -%D Although \TEX\ has a rather powerful channel to the outside -%D world, called \type {\special}, real communication with -%D other programs is complicated by the fact that no positional -%D information is available. Mid 1999, I discussed this with -%D \THANH, the author of \PDFTEX, and after some experiments, -%D \PDFTEX\ was extended with a simple but effective mechanism, -%D that provided positional information. The interesting -%D thought is that, although \TEX\ is frozen, similar -%D functionality could have been achieved with \type -%D {\specials} and an additional \DVI\ postprocessor. -%D -%D Since we want to be as compatible as can be, \CONTEXT\ will -%D support both methods, although the development is primarily -%D driven by the \PDFTEX\ way of doing things. Since the -%D mechanism is basically not limited to one application, for -%D the moment we stick to building the functionality around one -%D \CONTEXT\ special command, but at the same time we keep our -%D eyes open for extensions in other directions. -%D -%D A question that may arise when one reads this module, is to -%D what extend these macros are generic, in the sense that they -%D could be collected in a support module instead of a core -%D module. Since the mechanism described here will closely -%D cooperate with the \METAPOST\ support built in \CONTEXT, -%D which in turn will be tightly integrated with the \CONTEXT\ -%D overlay mechanisms, I decided to write a core module instead -%D of a support one. This makes even more sense, when one takes -%D into account that this kind of support depends on special -%D drivers. - \unprotect -%D The first application of positional information was embedded -%D graphics. Since we are interacting with text, it made sense -%D to take the current line height and depth into account too. -%D This is why we have two basic position macros: one for -%D simple positions, and one for boxes. -%D -%D We could have sticked to one special, and actually did so in -%D earlier experiments, but for convenience, as well for -%D clearness, we now have two alternatives. This approach will -%D save us quite some bytes when storing large quantities of -%D positional information. We save as less information as -%D needed, that is, we save no dimensions, in a \METAPOST\ -%D friendly way. -%D -%D The three specials involved are: +%D The first application of positional information was embedded graphics. Since we +%D are interacting with text, it made sense to take the current line height and +%D depth into account too. This is why we have position macros for simple positions +%D and one boxes. %D %D \starttyping %D \dosetposition {identifier} %D \dosetpositionwhd {identifier} {width} {height} {depth} %D \dosetpositionplus {identifier} {width} {height} {depth} {list} -%D \dosetpositionpapersize {width} {height} %D \stoptyping -\def\dosaveposition #1#2#3#4{\normalexpanded{\ctxlua {_plib_.setall("#1",\number#2,\number\dimexpr#3,\number\dimexpr#4)}}} -\def\dosavepositionwhd #1#2#3#4#5#6#7{\normalexpanded{\ctxlua {_plib_.setall("#1",\number#2,\number\dimexpr#3,\number\dimexpr#4,\number\dimexpr#5,\number\dimexpr#6,\number\dimexpr#7)}}} -\def\dosavepositionplus#1#2#3#4#5#6#7#8{\normalexpanded{\ctxlua {_plib_.setall("#1",\number#2,\number\dimexpr#3,\number\dimexpr#4,\number\dimexpr#5,\number\dimexpr#6,\number\dimexpr#7,"#8")}}} - -% \def\dosetposition #1{\normalexpanded{\ctxlatelua{_plib_.setdim("#1")}}} -% \def\dosetpositionwhd #1#2#3#4{\normalexpanded{\ctxlatelua{_plib_.setdim("#1",\number\dimexpr#2,\number\dimexpr#3,\number\dimexpr#4)}}} -% \def\dosetpositionplus #1#2#3#4#5{\normalexpanded{\ctxlatelua{_plib_.setdim("#1",\number\dimexpr#2,\number\dimexpr#3,\number\dimexpr#4,"#5")}}} +\def\dosaveposition #1#2#3#4{\ctxcommand{setpos("#1",\number#2,\number\dimexpr#3,\number\dimexpr#4)}} +\def\dosavepositionwhd #1#2#3#4#5#6#7{\ctxcommand{setpos("#1",\number#2,\number\dimexpr#3,\number\dimexpr#4,\number\dimexpr#5,\number\dimexpr#6,\number\dimexpr#7)}} +\def\dosavepositionplus#1#2#3#4#5#6#7#8{\ctxcommand{setpos("#1",\number#2,\number\dimexpr#3,\number\dimexpr#4,\number\dimexpr#5,\number\dimexpr#6,\number\dimexpr#7,"#8")}} \def\dosetposition #1{\ctxcommand{posxy("#1")}} \def\dosetpositionwhd #1#2#3#4{\ctxcommand{poswhd("#1",\number\dimexpr#2,\number\dimexpr#3,\number\dimexpr#4)}} @@ -120,40 +42,26 @@ \def\dosetpositionbox #1#2{\ctxcommand{poswhd("#1",\number\wd#2,\number\ht#2,\number\dp#2)}} \def\dosetpositionstrut #1{\ctxcommand{posstrut("#1")}} -\let\dosetpositionpapersize\gobbletwoarguments - \newbox\positionbox \newif \ifpositioning -\def\POSprefix{POS::} - -%D This is real tricky! The page anchor is applied to the -%D page box and therefore flushed first. So, when present, it -%D is applied to all positions except itself. - -% 0 = don't relocate page origin 1 = relocate page origin once - -\setnewconstant\positionanchormode\plusone % not used - %D Sometimes we want to trick the position handler a bit: \def\replacepospxywhd#1#2#3#4#5#6#7% {\ctxcommand{replacepospxywhd('#1',\number#2,\number\dimexpr#3,\number\dimexpr#4,\number\dimexpr#5,\number\dimexpr#6,\number\dimexpr#7)}} -%D The next switch can be used to communicate a special -%D situation. Positioning and associated actions can be -%D executed any time. However, in for instance backgrounds -%D they can be collected in a layer, for instance the text -%D layer (especially the hidden text layer). In the case of -%D floats, we run into problems, since the page information is -%D not applicable when the content floats indeed. In such -%D situations one can treat positions and graphics local. +%D The next switch can be used to communicate a special situation. Positioning and +%D associated actions can be executed any time. However, in for instance backgrounds +%D they can be collected in a layer, for instance the text layer (especially the +%D hidden text layer). In the case of floats, we run into problems, since the page +%D information is not applicable when the content floats indeed. In such situations +%D one can treat positions and graphics local. \newif\iflocalpositioning % todo: conditional \newif\ifregionpositioning % todo: conditional -%D Watch out: sometimes a pagebreak occurs inside a float -%D placement, so there we need to disable local mode. +%D Watch out: sometimes a pagebreak occurs inside a float placement, so there we need +%D to disable local mode. \appendtoks \localpositioningtrue @@ -165,32 +73,30 @@ \to \everybeforepagebody %D \macros -%D {MPp, MPx, MPy, MPw, MPh, MPd, -%D MPxy, MPll, MPlr, MPur, MPul, MPpos,MPanchor} +%D {MPp, MPx, MPy, MPw, MPh, MPd, MPxy, MPll, MPlr, MPur, MPul, MPpos, MPanchor} %D -%D Access to the positional information is provided by macros -%D with short names that are clearly meant for \METAPOST\ but -%D nowadays also used for other purposes. - -\def\MPp #1{\ctxcommand{MPp("#1")}} \let\MPpage \MPp -\def\MPr #1{\ctxcommand{MPr("#1")}} \let\MPregion \MPr -\def\MPc #1{\ctxcommand{MPc("#1")}} \let\MPcolumn \MPc -\def\MPn #1{\ctxcommand{MPn("#1")}} \let\MPparagraph\MPn -\def\MPx #1{\ctxcommand{MPx("#1")}} -\def\MPy #1{\ctxcommand{MPy("#1")}} -\def\MPw #1{\ctxcommand{MPw("#1")}} % first we need to replace \MPwidth etc -\def\MPh #1{\ctxcommand{MPh("#1")}} -\def\MPd #1{\ctxcommand{MPd("#1")}} -\def\MPxy #1{\ctxcommand{MPxy("#1")}} -\def\MPll #1{\ctxcommand{MPll("#1")}} -\def\MPlr #1{\ctxcommand{MPlr("#1")}} -\def\MPur #1{\ctxcommand{MPur("#1")}} -\def\MPul #1{\ctxcommand{MPul("#1")}} -\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 -\def\MPrs #1{\ctxcommand{MPrs("#1")}} \let\MPrightkip\MPrs % compatible feature +%D Access to the positional information is provided by macros with short names +%S that are clearly meant for \METAPOST\ but nowadays also used for other purposes. + +\def\MPp #1{\ctxcommand{MPp("#1")}} \let\MPpage \MPp +\def\MPr #1{\ctxcommand{MPr("#1")}} \let\MPregion \MPr +\def\MPc #1{\ctxcommand{MPc("#1")}} \let\MPcolumn \MPc +\def\MPn #1{\ctxcommand{MPn("#1")}} \let\MPparagraph\MPn +\def\MPx #1{\ctxcommand{MPx("#1")}} +\def\MPy #1{\ctxcommand{MPy("#1")}} +\def\MPw #1{\ctxcommand{MPw("#1")}} % first we need to replace \MPwidth etc +\def\MPh #1{\ctxcommand{MPh("#1")}} +\def\MPd #1{\ctxcommand{MPd("#1")}} +\def\MPxy #1{\ctxcommand{MPxy("#1")}} +\def\MPll #1{\ctxcommand{MPll("#1")}} +\def\MPlr #1{\ctxcommand{MPlr("#1")}} +\def\MPur #1{\ctxcommand{MPur("#1")}} +\def\MPul #1{\ctxcommand{MPul("#1")}} +\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 +\def\MPrs #1{\ctxcommand{MPrs("#1")}} \let\MPrightkip\MPrs % compatible feature \def\MPpardata#1{\ctxcommand{MPpardata("#1")}} \def\MPxywhd #1{\ctxcommand{MPxywhd("#1")}} @@ -198,10 +104,9 @@ %D \macros %D {MPplus, MPrest, MPv, MPvv} %D -%D Since we will probably keep on extending, we provide a -%D general extension macro. The plus alternative takes an -%D extra argument, denoting what additional parameter to pick -%D up. So, the third extra is fetched with, +%D Since we will probably keep on extending, we provide a general extension +%D macro. The plus alternative takes an extra argument, denoting what additional +%D parameter to pick up. So, the third extra is fetched with, %D %D \starttyping %D \MPplus{identifier}{3}{default} @@ -218,16 +123,14 @@ \def\MPplus#1#2#3{\ctxcommand{MPplus("#1",#2,"#3")}} \let\MPv \MPplus \def\MPrest #1#2{\ctxcommand{MPrest("#1","#2")}} \let\MPvv\MPrest -%D There are two low level positioning macros. Both store the -%D position as well as execute an action associated with that -%D position. +%D There are two low level positioning macros. Both store the position as well +%D as execute an action associated with that position. \let\dopositionaction\gobbleoneargument % implemented later \def\anch_positions_initialize {\ifpositioning \else \global\positioningtrue - \dosetpositionpapersize\printpaperwidth\printpaperheight \fi} \unexpanded\def\setpositiononly @@ -406,9 +309,8 @@ \def\copyposition#1#2{\ctxcommand{copyposition('#1','#2')}} -%D The fact that handling positions is a two pass operation, is -%D one of the reasons why we need to be able to test for -%D existence, using: +%D The fact that handling positions is a two pass operation, is one of the +%D reasons why we need to be able to test for existence, using: %D %D \starttyping %D \doifpositionelse {identifier} {found action} {not found action} @@ -417,50 +319,39 @@ \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. - %D \macros %D {xypos} %D -%D We have several macros available to save positions. Later -%D we will see applications. +%D We have several macros available to save positions. Later we will see +%D applications. %D %D \starttabulate[|l|l||] %D \NC \type {\xypos} \NC \NC simple position with no dimensions \NC \NR -%D \NC \type {\hpos} \NC \NC position and characteristics of a \type {\hbox} \NC \NR -%D \NC \type {\vpos} \NC \NC position and characteristics of a \type {\vbox} \NC \NR +%D \NC \type {\hpos} \NC \NC position and characteristics of a \type {\hbox} \NC \NR +%D \NC \type {\vpos} \NC \NC position and characteristics of a \type {\vbox} \NC \NR %D \NC \type {\bpos} \NC b: \NC begin point in a line \NC \NR %D \NC \type {\epos} \NC e: \NC end point in a line \NC \NR -%D \NC \type {\fpos} \NC f: \NC begin point in a paragraph \NC \NR -%D \NC \type {\tpos} \NC t: \NC end point in a paragraph \NC \NR %D \stoptabulate %D %D Each macro takes an identifier as argument, and the \type %D {\hpos} and \type {\vpos} also expect box content. -% \def\xypos{\anch_positions_initialize\dosetposition} - \let\xypos\setpositiononly -\unexpanded\def\hpos #1{\dontleavehmode\setpositionbox{#1}\hbox} -\unexpanded\def\vpos #1{\setpositionbox{#1}\vbox} +\unexpanded\def\hpos#1{\dontleavehmode\setpositionbox{#1}\hbox} +\unexpanded\def\vpos#1{\setpositionbox{#1}\vbox} +\unexpanded\def\bpos#1{\dontleavehmode \setpositionstrut{b:#1}\ignorespaces} +\unexpanded\def\epos#1{\removeunwantedspaces\setpositionstrut{e:#1}} -\unexpanded\def\bpos #1{\dontleavehmode \setpositionstrut{b:#1}\ignorespaces} -\unexpanded\def\epos #1{\removeunwantedspaces\setpositionstrut{e:#1}} - -%D When we want to calculate more complex backgrounds, we -%D need to know what the current indentation scheme is. At -%D the cost of many positions and memory, we can keep track -%D of them. This mechanism is activated automatically -%D based on information collected in the previous pass. +%D When we want to calculate more complex backgrounds, we need to know what the +%D current indentation scheme is. At the cost of many positions and memory, we +%D can keep track of them. This mechanism is activated automatically based on +%D information collected in the previous pass. \newcount\parposcounter \newif \ifpositioningpar \newif \iftracepositions -% we can check for used entries, and if not, then not add one - \unexpanded\def\enableparpositions % global {\global\let\registerparoptions\doregisterparoptions \global\positioningtrue @@ -478,14 +369,6 @@ \fi \fi \fi \fi} -% \def\anch_positions_register_par_options -% {\global\advance\parposcounter\plusone -% \setpositiondataplus -% {p:\number\parposcounter}\zeropoint\strutht\strutdp -% {\the\hsize,\the\dimexpr\leftskip\relax,\the\dimexpr\rightskip\relax,\the\hangindent,\the\hangafter,\the\parindent}% -% %\hbox{\registerparsymbol}% -% \iftracepositions\registerparsymbol\fi} - \def\anch_positions_register_par_options {\dontleavehmode\ctxcommand{parpos()}% \iftracepositions\registerparsymbol\fi} @@ -514,130 +397,11 @@ % \appendtoks \registerparoptions \to \everypar -%D Eperimental code, don't use this yet: (must be sped up anyway) .. obsolete - -\def\@@noden{node:n:} -\def\@@nodeo{node:o:} -\def\@@nodep{node:p:} - -\def\doifelsenodelocation#1% - {\ifcsname\@@noden#1\endcsname - \expandafter\firstoftwoarguments - \else - \expandafter\secondoftwoarguments - \fi} - -\def\nextnodelocation#1% - {\ifcsname\@@noden#1\endcsname\pluscounter{\@@noden#1}\fi} - -\def\newnodelocation#1% - {\ifcsname\@@noden#1\endcsname - \setcounter{\@@noden#1}\zerocount - \letgvalue {\@@nodeo#1}\!!zerocount - \fi} - -\def\tagnodelocation#1% - {\ifcsname\@@noden#1\endcsname\xypos{\@@nodep#1:\countervalue{\@@noden#1}}\fi} - -\def\getnodelocationp#1{\MPp{\@@nodep#1:\countervalue{\@@noden#1}}} -\def\getnodelocationx#1{\MPx{\@@nodep#1:\countervalue{\@@noden#1}}} -\def\getnodelocationy#1{\MPy{\@@nodep#1:\countervalue{\@@noden#1}}} - -\def\numnodelocationp#1#2{\MPp{\@@nodep#1:\number#2}} -\def\numnodelocationx#1#2{\MPx{\@@nodep#1:\number#2}} -\def\numnodelocationy#1#2{\MPy{\@@nodep#1:\number#2}} - -\def\getnodelocationn#1{\countervalue{\@@noden#1}} -\def\getnodelocationo#1{\getvalue {\@@nodeo#1}} - -\setnewconstant\nodelocationmode\plusone - -\def\analyzenodelocation#1% - {\ifcsname\@@noden#1\endcsname - \anch_positions_node_location_analyze{#1}{\getnodelocationn{#1}}\zerocount - \fi} - -\def\anch_positions_node_location_analyze#1#2#3% class n default - {\begingroup - \donefalse - \ifcase\nodelocationmode - % do nothing - \else - \edef\nodelocationselfn{#2}% - \edef\nodelocationselfp{\numnodelocationp{#1}\nodelocationselfn}% - \edef\nodelocationselfx{\numnodelocationx{#1}\nodelocationselfn}% - \edef\nodelocationselfy{\numnodelocationy{#1}\nodelocationselfn}% - \scratchcounter\plusone - \doloop - {\ifnum\recurselevel=\nodelocationselfn\relax - \donetrue - \else - \edef\nodelocationotherp{\numnodelocationp{#1}\recurselevel}% - \edef\nodelocationotherx{\numnodelocationx{#1}\recurselevel}% - \edef\nodelocationothery{\numnodelocationy{#1}\recurselevel}% - \ifcase\nodelocationmode - % \exitloop - \or - % ok for single column - \anch_positions_node_location_analyze_one - \or - % acceptable for double column - \anch_positions_node_location_analyze_two - \else - \exitloop - \fi - \fi}% - \fi - \ifdone \else - \scratchcounter#3\relax - \fi - \setxvalue{\@@nodeo#1}{\the\scratchcounter}% - \endgroup} - -\def\anch_positions_node_location_analyze_one - {\ifcase\nodelocationotherp\relax - \exitloop - \else\ifnum\nodelocationotherp<\nodelocationselfp\relax - \donetrue \advance\scratchcounter\plusone - \else\ifnum\nodelocationotherp>\nodelocationselfp\relax - % skip - \else\ifdim\nodelocationothery>\nodelocationselfy\relax - \donetrue \advance\scratchcounter\plusone - \else\ifdim\nodelocationothery<\nodelocationselfy\relax - % skip - \else\ifdim\nodelocationotherx<\nodelocationselfx\relax - \donetrue \advance\scratchcounter\plusone - \fi\fi\fi\fi\fi\fi} - -\def\anch_positions_node_location_analyze_two - {\ifcase\nodelocationotherp\relax - \exitloop - \else\ifnum\nodelocationotherp<\nodelocationselfp\relax - \donetrue \advance\scratchcounter\plusone - \else\ifnum\nodelocationotherp>\nodelocationselfp\relax - % skip - \else\ifnum\recurselevel>\nodelocationselfn\relax - \donetrue \exitloop - \else - \donetrue \advance\scratchcounter\plusone - \fi\fi\fi\fi} - -\unexpanded\def\shownodelocation#1% - {\ifcsname\@@noden#1\endcsname - \analyzenodelocation{#1}% - (#1,% - n:\getnodelocationn{#1},% - p:\getnodelocationp{#1},% - x:\getnodelocationx{#1},% - y:\getnodelocationy{#1},% - o:\getnodelocationo{#1})% - \fi} - %D \macros %D {doifoverlappingelse} %D -%D A first application of positional information, is to -%D determine if two boxes do overlap: +%D A first application of positional information, is to determine if two +%D boxes do overlap: %D %D \starttyping %D \doifoverlappingelse{point a}{point b} @@ -651,8 +415,8 @@ %D {doifpositionsonsamepageelse, %D doifpositionsonthispageelse} %D -%D Instead of letting the user handle fuzzy expansion, we -%D provide a simple test on positions being on the same page. +%D Instead of letting the user handle fuzzy expansion, we provide a simple test on +%D positions being on the same page. %D %D \starttyping %D \doifpositionsonsamepageelse{point a}{point b} @@ -666,12 +430,4 @@ \def\doifpositionsonsamepageelse#1{\ctxcommand{doifpositionsonsamepageelse("#1")}} \def\doifpositionsonthispageelse#1{\ctxcommand{doifpositionsonthispageelse("#1")}} -%D \macros -%D {POSp, POSx, POSy, POSh, POSd, POSw} -%D -%D This is obsolete in \MKIV: - -\let\POSp\MPp \let\POSx\MPx \let\POSy\MPy -\let\POSh\MPh \let\POSd\MPd \let\POSw\MPw - \protect \endinput diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 6446020e8..c045890b2 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.17 18:52} +\newcontextversion{2012.02.18 10:50} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 68ad069c4..dc19402c2 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.17 18:52} +\newcontextversion{2012.02.18 10:50} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 4c0eba78e..b5e4d1d07 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 0024ab229..7db14f01e 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 3edaefddf..9bd21ba7a 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.17 18:52} +\edef\contextversion{2012.02.18 10:50} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index bdbba20a2..5bfa6e61e 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.17 18:52} +\edef\contextversion{2012.02.18 10:50} %D For those who want to use this: diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index 1e552d35a..edef853de 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -730,9 +730,11 @@ function handlers.gpos_mark2mark(start,kind,lookupname,markanchors,sequence) local markchar = start.char if marks[markchar] then local base = start.prev -- [glyph] [basemark] [start=mark] -while base and has_attribute(base,markdone) and has_attribute(base,markdone) ~= has_attribute(start,markdone) do - base = base.prev -- KE: prevents mknk fo rmarks on different components of a ligature -end + -- new + while base and has_attribute(base,markdone) and has_attribute(base,markdone) ~= has_attribute(start,markdone) do + base = base.prev -- KE: prevents mknk fo rmarks on different components of a ligature + end + -- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then -- subtype test can go local basechar = base.char local baseanchors = descriptions[basechar] diff --git a/tex/context/base/mlib-pps.mkiv b/tex/context/base/mlib-pps.mkiv index a9b2e6e70..b233f7b08 100644 --- a/tex/context/base/mlib-pps.mkiv +++ b/tex/context/base/mlib-pps.mkiv @@ -98,7 +98,7 @@ %D \typebuffer \startlinecorrection \getbuffer \stoplinecorrection \def\MPLIBpositionwhd#1#2#3#4#5% bp ! - {\dosavepositionwhd{#1}{0}{#2bp}{#3bp}{#4bp}{#5bp}{0bp}} + {\dosavepositionwhd{#1}\zerocount{#2\onebasepoint}{#3\onebasepoint}{#4\onebasepoint}{#5\onebasepoint}\zeropoint} \def\MPLIBextrapass#1% {\ctxlua{metapost.graphic_extra_pass("#1")}} diff --git a/tex/context/base/page-lin.mkiv b/tex/context/base/page-lin.mkiv index f43839441..7b1cbcd94 100644 --- a/tex/context/base/page-lin.mkiv +++ b/tex/context/base/page-lin.mkiv @@ -13,6 +13,8 @@ % generic or not ... maybe not bother too much and simplify to mkiv only % get rid of \mk* (left over from experimental times) +% +% to be redone (was experiment) .. can be hooked into margin code \writestatus{loading}{ConTeXt Core Macros / Line Numbering} @@ -68,7 +70,7 @@ {\setbox\linenumberscratchbox\vbox {\forgetall \offinterlineskip - \ctxlua{nodes.lines.boxed.stage_one(\number#1,\ifcase\linenumbernesting false\else true\fi)}}% + \ctxlua{nodes.lines.boxed.stage_one(\number#1,\ifcase\linenumbernesting false\else true\fi)}}% #2 \ctxlua{nodes.lines.boxed.stage_two(\number#1,\number\linenumberscratchbox)}}% can move to lua code % id nr shift width leftskip dir @@ -264,7 +266,7 @@ \the\aftereverylinenumbering \endgroup} -% number placement +% number placement .. will change into (the new) margin code \def\mkdoinnerlinenumber{\doifoddpageelse\mkdoleftlinenumber\mkdorightlinenumber} \def\mkdoouterlinenumber{\doifoddpageelse\mkdorightlinenumber\mkdoleftlinenumber} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 73a12ab77..ed4110d93 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 5a5fda95d..e886b982d 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/tabl-tsp.mkiv b/tex/context/base/tabl-tsp.mkiv index f230346bd..21182a988 100644 --- a/tex/context/base/tabl-tsp.mkiv +++ b/tex/context/base/tabl-tsp.mkiv @@ -113,7 +113,7 @@ {\forgetall \dontcomplain \global\settrue\splitfloatdone - \nodelocationmode\zerocount % bypass auto-renumbering + % \nodelocationmode\zerocount % bypass auto-renumbering \global\advance\noffloatssplits\plusone \ifcase\noffloatssplits\relax \or \ifconditional\onlyonesplitofffloat diff --git a/tex/context/base/typo-mar.lua b/tex/context/base/typo-mar.lua index 00747a585..45cab0f71 100644 --- a/tex/context/base/typo-mar.lua +++ b/tex/context/base/typo-mar.lua @@ -656,6 +656,8 @@ local function flushinline(parent,head) return head, done, continue end +local a_linenumber = attributes.private('linenumber') + local function flushed(scope,parent) -- current is hlist local head = parent.list local done = false @@ -689,7 +691,11 @@ local function flushed(scope,parent) -- current is hlist done = done or don end if done then +local a = has_attribute(head,a_linenumber) -- hack .. we need a more decent critical attribute inheritance mechanism parent.list = hpack_nodes(head,parent.width,"exactly") +if a then + set_attribute(parent.list,a_linenumber,a) +end -- resetstacked() end return done, continue diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 0966cd3b8..d85a0f4a3 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/17/12 18:52:08 +-- merge date : 02/18/12 10:50:58 do -- begin closure to overcome local limits and interference @@ -9295,9 +9295,11 @@ function handlers.gpos_mark2mark(start,kind,lookupname,markanchors,sequence) local markchar = start.char if marks[markchar] then local base = start.prev -- [glyph] [basemark] [start=mark] -while base and has_attribute(base,markdone) and has_attribute(base,markdone) ~= has_attribute(start,markdone) do - base = base.prev -- KE: prevents mknk fo rmarks on different components of a ligature -end + -- new + while base and has_attribute(base,markdone) and has_attribute(base,markdone) ~= has_attribute(start,markdone) do + base = base.prev -- KE: prevents mknk fo rmarks on different components of a ligature + end + -- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then -- subtype test can go local basechar = base.char local baseanchors = descriptions[basechar] |