From 615fb53080cc1f45b3fb4b5bfdcb8f47ada36f74 Mon Sep 17 00:00:00 2001
From: Marius <mariausol@gmail.com>
Date: Fri, 19 Jul 2013 12:20:37 +0300
Subject: beta 2013.07.19 10:31

---
 tex/context/base/anch-bck.mkvi                     |  26 ++---
 tex/context/base/anch-pgr.lua                      |   4 +-
 tex/context/base/anch-pgr.mkiv                     |   2 +-
 tex/context/base/cont-new.mkiv                     |   2 +-
 tex/context/base/context-version.pdf               | Bin 4113 -> 4105 bytes
 tex/context/base/context.mkiv                      |   3 +-
 tex/context/base/font-sol.lua                      |   2 +-
 tex/context/base/lxml-css.lua                      |   2 +-
 tex/context/base/math-act.lua                      |   6 +-
 tex/context/base/math-def.mkiv                     |   2 +
 tex/context/base/math-fen.mkiv                     |  10 +-
 tex/context/base/math-ini.mkiv                     | 105 +++++++++++----------
 tex/context/base/math-map.lua                      |  11 ++-
 tex/context/base/math-stc.mkvi                     |   2 +
 tex/context/base/math-vfu.lua                      |  78 ++++++++++++---
 tex/context/base/meta-ini.mkiv                     |   5 +-
 tex/context/base/scrn-wid.lua                      |   4 +-
 tex/context/base/spac-ver.lua                      |   2 +-
 tex/context/base/status-files.pdf                  | Bin 24613 -> 24599 bytes
 tex/context/base/status-lua.log                    |   2 +-
 tex/context/base/strc-con.mkvi                     |  61 +++++++++---
 tex/context/base/strc-lnt.mkvi                     |   2 +
 tex/context/base/strc-ref.mkvi                     |   1 +
 tex/generic/context/luatex/luatex-fonts-merged.lua |   2 +-
 24 files changed, 216 insertions(+), 118 deletions(-)

(limited to 'tex')

diff --git a/tex/context/base/anch-bck.mkvi b/tex/context/base/anch-bck.mkvi
index 79e42dc0a..cccf14ee4 100644
--- a/tex/context/base/anch-bck.mkvi
+++ b/tex/context/base/anch-bck.mkvi
@@ -154,22 +154,22 @@
 \def\anch_backgrounds_text_preset_yes
   {\anch_backgrounds_text_preset_nop
    \csname\??textbackgroundlevel\textbackgroundparameter\c!location\endcsname
-   \edef\m_anch_backgrounds_text_frame     {\textbackgroundparameter\c!frame}%
-   \edef\m_anch_backgrounds_text_corner    {\textbackgroundparameter\c!corner}%
-   \edef\m_anch_backgrounds_text_background{\textbackgroundparameter\c!background}%
-   \ifx\m_anch_backgrounds_text_frame\v!on
-     \ifx\m_anch_backgrounds_text_corner\v!round
-       \let\m_anch_backgrounds_text_frame\!!plustwo
+   \edef\p_anch_backgrounds_text_frame     {\textbackgroundparameter\c!frame}%
+   \edef\p_anch_backgrounds_text_corner    {\textbackgroundparameter\c!corner}%
+   \edef\p_anch_backgrounds_text_background{\textbackgroundparameter\c!background}%
+   \ifx\p_anch_backgrounds_text_frame\v!on
+     \ifx\p_anch_backgrounds_text_corner\v!round
+       \let\p_anch_backgrounds_text_frame\!!plustwo
      \else
-       \let\m_anch_backgrounds_text_frame\!!plusone
+       \let\p_anch_backgrounds_text_frame\!!plusone
      \fi
    \else
-     \let\m_anch_backgrounds_text_frame\!!zerocount
+     \let\p_anch_backgrounds_text_frame\!!zerocount
    \fi
-   \ifx\m_anch_backgrounds_text_background\v!color
-     \let\m_anch_backgrounds_text_background\!!plusone
+   \ifx\p_anch_backgrounds_text_background\v!color
+     \let\p_anch_backgrounds_text_background\!!plusone
    \else
-     \let\m_anch_backgrounds_text_background\!!zerocount
+     \let\p_anch_backgrounds_text_background\!!zerocount
    \fi
    \startpositionoverlay{\textbackgroundoverlay{\textbackgroundparameter\c!level}}%
      \anch_backgrounds_text_meta_graphic % gets expanded directly
@@ -184,8 +184,8 @@
         {self=\v_anch_backgrounds_text_current,
          mp=\textbackgroundparameter\c!mp,
          gridtype=\textbackgroundparameter\c!alternative,
-         filltype=\m_anch_backgrounds_text_background,
-         linetype=\m_anch_backgrounds_text_frame,
+         filltype=\p_anch_backgrounds_text_background,
+         linetype=\p_anch_backgrounds_text_frame,
          dashtype=\textbackgroundparameter\c!dash,
          gridcolor=\textbackgroundparameter\c!framecolor,
          linecolor=\textbackgroundparameter\c!framecolor,
diff --git a/tex/context/base/anch-pgr.lua b/tex/context/base/anch-pgr.lua
index 278448e3a..c7f56a92b 100644
--- a/tex/context/base/anch-pgr.lua
+++ b/tex/context/base/anch-pgr.lua
@@ -681,12 +681,12 @@ end
 function commands.doifelserangeonpage(first,last,page)
     local collected = jobpositions.collected
     local f = collected[first]
-    if not f then
+    if not f or f.p == true then
         doifelse(false)
         return
     end
     local l = collected[last]
-    if not l then
+    if not l or l.p == true  then
         doifelse(false)
         return
     end
diff --git a/tex/context/base/anch-pgr.mkiv b/tex/context/base/anch-pgr.mkiv
index 01ef25dc4..8ed9913ae 100644
--- a/tex/context/base/anch-pgr.mkiv
+++ b/tex/context/base/anch-pgr.mkiv
@@ -254,7 +254,7 @@
   {\vbox to \overlayheight
      {%\writestatus{!!!}{\currentpositionoverlay/\MPanchoridentifier/\MPanchornumber}%
       \edef\MPanchorid{\currentpositionoverlay::\MPanchoridentifier:\MPanchornumber}% realpageno
-%       \edef\MPanchor##1{\MPpos\MPanchorid}%
+    % \edef\MPanchor##1{\MPpos\MPanchorid}%
       \let\MPanchor\MPoverlayanchor % no need to fetch it already, seldom used
       \the\everyinsertpositionaction
       \copyposition{\currentpositionoverlay::\MPanchoridentifier}\MPanchorid
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 72101e746..097d3ea82 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{2013.07.14 14:53}
+\newcontextversion{2013.07.19 10:31}
 
 %D This file is loaded at runtime, thereby providing an excellent place for
 %D hacks, patches, extensions and new features.
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 74319d9ea..a9c684cc7 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.mkiv b/tex/context/base/context.mkiv
index 4ad245936..4e1e6a42c 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -25,7 +25,7 @@
 %D up and the dependencies are more consistent.
 
 \edef\contextformat {\jobname}
-\edef\contextversion{2013.07.14 14:53}
+\edef\contextversion{2013.07.19 10:31}
 \edef\contextkind   {beta}
 
 %D For those who want to use this:
@@ -430,6 +430,7 @@
 \loadmarkfile{math-int}
 \loadmarkfile{math-del}
 \loadmarkfile{math-fen}
+\loadmkvifile{math-rad}
 \loadmarkfile{math-inl}
 \loadmarkfile{math-dis}
 %loadmarkfile{math-lan}
diff --git a/tex/context/base/font-sol.lua b/tex/context/base/font-sol.lua
index db2dd24c2..9ccfd0588 100644
--- a/tex/context/base/font-sol.lua
+++ b/tex/context/base/font-sol.lua
@@ -571,7 +571,7 @@ local function doit(word,list,best,width,badness,line,set,listdir)
                 local font = found.font
                 local setdynamics = setfontdynamics[font]
                 if setdynamics then
-                    local processes = setdynamics(font,featurenumber)
+                    local processes = setdynamics[featurenumber]
                     for i=1,#processes do -- often more than 1
                         first = processes[i](first,font,featurenumber)
                     end
diff --git a/tex/context/base/lxml-css.lua b/tex/context/base/lxml-css.lua
index 5b389626c..0deaea4d3 100644
--- a/tex/context/base/lxml-css.lua
+++ b/tex/context/base/lxml-css.lua
@@ -32,7 +32,7 @@ if tex then
     local emwidths  = fonts.hashes.emwidths
     local texget    = tex.get
 
-    percentage = function(s,pcf) return tonumber(s) * (pcf or texget("hsize")     end
+    percentage = function(s,pcf) return tonumber(s) * (pcf or texget("hsize"))    end
     exheight   = function(s,exf) return tonumber(s) * (exf or exheights[true])    end
     emwidth    = function(s,emf) return tonumber(s) * (emf or emwidths[true])     end
     pixels     = function(s,pxf) return tonumber(s) * (pxf or emwidths[true]/300) end
diff --git a/tex/context/base/math-act.lua b/tex/context/base/math-act.lua
index a03542b3e..c8d862ffc 100644
--- a/tex/context/base/math-act.lua
+++ b/tex/context/base/math-act.lua
@@ -292,9 +292,9 @@ sequencers.appendaction("aftercopyingcharacters", "system","mathematics.overload
 local tweaks       = { }
 mathematics.tweaks = tweaks
 
-function tweaks.fixbadprime(target,original)
-    target.characters[0xFE325] = target.characters[0x2032]
-end
+-- function tweaks.fixbadprime(target,original)
+--     target.characters[0xFE325] = target.characters[0x2032]
+-- end
 
 -- these could go to math-fbk
 
diff --git a/tex/context/base/math-def.mkiv b/tex/context/base/math-def.mkiv
index 99e6a8a18..8a8020c6e 100644
--- a/tex/context/base/math-def.mkiv
+++ b/tex/context/base/math-def.mkiv
@@ -210,6 +210,8 @@
 %D \starttyping
 %D $\sqrt[3]{10}$
 %D \stoptyping
+%D
+%D This root command will be overloaded later:
 
 \def\rootradical{\Uroot \defaultmathfamily "221A } % can be done in char-def
 
diff --git a/tex/context/base/math-fen.mkiv b/tex/context/base/math-fen.mkiv
index f7edc582e..74a870277 100644
--- a/tex/context/base/math-fen.mkiv
+++ b/tex/context/base/math-fen.mkiv
@@ -96,12 +96,12 @@
     \let\fenced\math_fenced_fenced
 \to \everymathematics
 
-\definemathfence [parenthesis] [\c!left=0x28,\c!right=0x29]
-\definemathfence [bracket]     [\c!left=0x5B,\c!right=0x5D]
-\definemathfence [braces]      [\c!left=0x7B,\c!right=0x7D]
-\definemathfence [bar]         [\c!left=0x7C,\c!right=0x7C]
+\definemathfence [parenthesis] [\c!left=0x0028,\c!right=0x0029]
+\definemathfence [bracket]     [\c!left=0x005B,\c!right=0x005D]
+\definemathfence [braces]      [\c!left=0x007B,\c!right=0x007D]
+\definemathfence [bar]         [\c!left=0x007C,\c!right=0x007C]
 \definemathfence [doublebar]   [\c!left=0x2016,\c!right=0x2016]
-\definemathfence [angle]       [\c!left=0x3C,\c!right=0x3E]
+\definemathfence [angle]       [\c!left=0x003C,\c!right=0x003E]
 
 %definemathfence [fancybracket] [bracket] [command=yes,color=red]
 
diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv
index d777bb018..c2438f384 100644
--- a/tex/context/base/math-ini.mkiv
+++ b/tex/context/base/math-ini.mkiv
@@ -542,7 +542,8 @@
 \activatemathcharacter\circumflexasciicode
 \activatemathcharacter\underscoreasciicode
 \activatemathcharacter\ampersandasciicode
-\activatemathcharacter\primeasciicode
+
+%activatemathcharacter\primeasciicode
 
 % not used:
 %
@@ -607,57 +608,57 @@
     \Umathchardef\prime "0 "0 "2032
 \fi
 
-\let\math_prime_indeed_normal\prime
-
-\appendtoks
-    \let\math_prime_indeed_normal\prime    % gets defined later
-    \let\mathfontprime\prime               % for tracing
-    \let\prime\math_prime_indeed           % so this is needed
-\to \everydump
-
-\unexpanded\def\math_prime_indeed
-  {\iffontchar\textfont\zerocount"FE325\relax
-    ^\bgroup
-     \expandafter\math_prime_indeed_virtual % virtual mess (using funny signal)
-   \else
-   % \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
-  {\math_prime_indeed_normal
-   \futurelet\nexttoken\math_prime_indeed_choice}
-
-\installcorenamespace{mathprime}
-
-\def\math_prime_indeed_choice
-  {\csname\??mathprime
-     \ifx                          '\nexttoken a\else
-     \ifx  \math_prime_indeed_normal\nexttoken a\else
-     \ifx                     \prime\nexttoken a\else
-     \ifx\superscriptcircumflextoken\nexttoken b\else
-     \ifx\othercircumflextoken      \nexttoken b\else
-                                               c\fi\fi\fi\fi\fi
-   \endcsname}
-
-\setvalue{\??mathprime a}#1{\math_prime_indeed_virtual}
-\setvalue{\??mathprime b}#1#2{#2\egroup}
-\setvalue{\??mathprime c}{\egroup}
-
-\let\activemathprime\math_prime_indeed
-
-\bgroup
-
-    \catcode\primeasciicode\activecatcode
-
-    \global\everymathematics\expandafter{\the\everymathematics\let'\math_prime_indeed} % todo: do this at the lua end
-
-\egroup
+% \let\math_prime_indeed_normal\prime
+%
+% \appendtoks
+%     \let\math_prime_indeed_normal\prime    % gets defined later
+%     \let\mathfontprime\prime               % for tracing
+%     \let\prime\math_prime_indeed           % so this is needed
+% \to \everydump
+%
+% \unexpanded\def\math_prime_indeed
+%   {\iffontchar\textfont\zerocount"FE325\relax
+%     ^\bgroup
+%      \expandafter\math_prime_indeed_virtual % virtual mess (using funny signal)
+%    \else
+%    % \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
+%   {\math_prime_indeed_normal
+%    \futurelet\nexttoken\math_prime_indeed_choice}
+%
+% \installcorenamespace{mathprime}
+%
+% \def\math_prime_indeed_choice
+%   {\csname\??mathprime
+%      \ifx                          '\nexttoken a\else
+%      \ifx  \math_prime_indeed_normal\nexttoken a\else
+%      \ifx                     \prime\nexttoken a\else
+%      \ifx\superscriptcircumflextoken\nexttoken b\else
+%      \ifx\othercircumflextoken      \nexttoken b\else
+%                                                c\fi\fi\fi\fi\fi
+%    \endcsname}
+%
+% \setvalue{\??mathprime a}#1{\math_prime_indeed_virtual}
+% \setvalue{\??mathprime b}#1#2{#2\egroup}
+% \setvalue{\??mathprime c}{\egroup}
+%
+% \let\activemathprime\math_prime_indeed
+%
+% \bgroup
+%
+%     \catcode\primeasciicode\activecatcode
+%
+%     \global\everymathematics\expandafter{\the\everymathematics\let'\math_prime_indeed} % todo: do this at the lua end
+%
+% \egroup
 
 \bgroup
 
diff --git a/tex/context/base/math-map.lua b/tex/context/base/math-map.lua
index 9158d945a..3d9ae23f4 100644
--- a/tex/context/base/math-map.lua
+++ b/tex/context/base/math-map.lua
@@ -21,6 +21,8 @@ if not modules then modules = { } end modules ['math-map'] = {
 -- todo: alphabets namespace
 -- maybe: script/scriptscript dynamic,
 
+-- superscripped primes get unscripted !
+
 -- to be looked into once the fonts are ready (will become font
 -- goodie):
 --
@@ -136,6 +138,7 @@ local regular_tf = {
     },
     symbols   = {
         [0x2202]=0x2202, [0x2207]=0x2207,
+        [0x0027]=0x2032, -- prime
     },
 }
 
@@ -168,6 +171,7 @@ local regular_it = {
     },
     symbols   = {
         [0x2202]=0x1D715, [0x2207]=0x1D6FB,
+        [0x0027]=0x2032, -- prime
     },
 }
 
@@ -193,6 +197,7 @@ local regular_bf= {
     },
     symbols   = {
         [0x2202]=0x1D6DB, [0x2207]=0x1D6C1,
+        [0x0027]=0x2032, -- prime
     },
 }
 
@@ -218,6 +223,7 @@ local regular_bi = {
     },
     symbols   = {
         [0x2202]=0x1D74F, [0x2207]=0x1D735,
+        [0x0027]=0x2032, -- prime
     },
 }
 
@@ -268,6 +274,7 @@ local sansserif_bf = {
     },
     symbols   = {
         [0x2202]=0x1D789, [0x2207]=0x1D76F,
+        [0x0027]=0x2032, -- prime
     },
 }
 
@@ -293,6 +300,7 @@ local sansserif_bi = {
     },
     symbols   = {
         [0x2202]=0x1D7C3, [0x2207]=0x1D7A9,
+        [0x0027]=0x2032, -- prime
     },
 }
 
@@ -337,7 +345,8 @@ local blackboard_tf = {
         [0x0393]=0x0213E, [0x03A0]=0x0213F,
     },
     symbols   = { -- sum
-      [0x2211]=0x02140,
+        [0x2211]=0x02140,
+        [0x0027]=0x2032, -- prime
     },
 }
 
diff --git a/tex/context/base/math-stc.mkvi b/tex/context/base/math-stc.mkvi
index 559fbd16c..f0f585c15 100644
--- a/tex/context/base/math-stc.mkvi
+++ b/tex/context/base/math-stc.mkvi
@@ -616,6 +616,8 @@
 
 % These are compatibity definitions, math only.
 
+% todo: top= bottom= middle= is nicer (compare math-fen)
+
 \definemathstackers [\v!none]   [\v!mathematics] [\c!hoffset=\zeropoint]
 \definemathstackers [\v!normal] [\v!mathematics] [\c!hoffset=0.5\emwidth] % the default
 \definemathstackers [\v!small]  [\v!mathematics] [\c!hoffset=1\emwidth]
diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua
index 2f7c0507b..174b05367 100644
--- a/tex/context/base/math-vfu.lua
+++ b/tex/context/base/math-vfu.lua
@@ -26,6 +26,7 @@ local type, next = type, next
 local max = math.max
 local format = string.format
 local utfchar = utf.char
+local fastcopy = table.copy
 
 local fonts, nodes, mathematics = fonts, nodes, mathematics
 
@@ -199,21 +200,44 @@ end
 -- { "node", nodeinjections.transform(.7,0,0,.7) },
 -- commands[#commands+1] = { "node", nodeinjections.restore() }
 
-local done = { }
+-- local done = { }
+--
+-- local function raise(main,characters,id,size,unicode,private,n,id_of_smaller) -- this is a real fake mess
+--     local raised = characters[private]
+--     if raised then
+--         if not done[unicode] then
+--             report_virtual("temporary too large %U due to issues in luatex backend",unicode)
+--             done[unicode] = true
+--         end
+--         local up = 0.85 * main.parameters.x_height
+--         local slot = { "slot", id, private }
+--         local commands = {
+--             push,
+--             { "down", - up },
+--          -- { "scale", .7, 0, 0, .7 },
+--             slot,
+--         }
+--         for i=2,n do
+--             commands[#commands+1] = slot
+--         end
+--         commands[#commands+1] = pop
+--         characters[unicode] = {
+--             width    = .7 * n * raised.width,
+--             height   = .7 * (raised.height + up),
+--             depth    = .7 * (raised.depth  - up),
+--             commands = commands,
+--         }
+--     end
+-- end
 
-local function raise(main,characters,id,size,unicode,private,n) -- this is a real fake mess
-    local raised = characters[private]
+local function raise(main,characters,id,size,unicode,private,n,id_of_smaller) -- this is a real fake mess
+    local raised = fonts.hashes.characters[main.fonts[id_of_smaller].id][private]  -- characters[private]
     if raised then
-        if not done[unicode] then
-            report_virtual("temporary too large %U due to issues in luatex backend",unicode)
-            done[unicode] = true
-        end
         local up = 0.85 * main.parameters.x_height
-        local slot = { "slot", id, private }
+        local slot = { "slot", id_of_smaller, private }
         local commands = {
             push,
             { "down", - up },
-         -- { "scale", .7, 0, 0, .7 },
             slot,
         }
         for i=2,n do
@@ -221,9 +245,10 @@ local function raise(main,characters,id,size,unicode,private,n) -- this is a rea
         end
         commands[#commands+1] = pop
         characters[unicode] = {
-            width    = .7 * n * raised.width,
-            height   = .7 * (raised.height + up),
-            depth    = .7 * (raised.depth  - up),
+            width    = n * raised.width,
+            height   = raised.height + up,
+            depth    = raised.depth  - up,
+            italic   = raised.italic,
             commands = commands,
         }
     end
@@ -406,7 +431,25 @@ local function repeated(main,characters,id,size,unicode,u,n,private,fraction) --
     end
 end
 
+-- we use the fact that context defines the smallest sizes first .. a real dirty and ugly hack
+
+local data_of_smaller = nil
+local size_of_smaller = 0
+
 function vfmath.addmissing(main,id,size)
+
+    local id_of_smaller = nil
+
+    if size < size_of_smaller or size_of_smaller == 0 then
+        data_of_smaller = main.fonts[id]
+        id_of_smaller = id
+    else
+        id_of_smaller = #main.fonts + 1
+        main.fonts[id_of_smaller] = data_of_smaller
+    end
+
+    -- here id is the index in fonts (normally 14 or so) and that slot points to self
+
     local characters = main.characters
     local shared = main.shared
     local variables = main.goodies.mathematics and main.goodies.mathematics.variables or { }
@@ -504,9 +547,11 @@ function vfmath.addmissing(main,id,size)
     repeated(main,characters,id,size,0x222C,0x222B,2,0xFF800,1/3)
     repeated(main,characters,id,size,0x222D,0x222B,3,0xFF810,1/3)
 
- -- raise    (main,characters,id,size,0x02032,0xFE325,1) -- prime
- -- raise    (main,characters,id,size,0x02033,0xFE325,2) -- double prime
- -- raise    (main,characters,id,size,0x02034,0xFE325,3) -- triple prime
+    characters[0xFE325] = fastcopy(characters[0x2032])
+
+    raise    (main,characters,id,size,0x02032,0xFE325,1,id_of_smaller) -- prime
+    raise    (main,characters,id,size,0x02033,0xFE325,2,id_of_smaller) -- double prime
+    raise    (main,characters,id,size,0x02034,0xFE325,3,id_of_smaller) -- triple prime
 
     -- there are more (needs discussion first):
 
@@ -515,6 +560,9 @@ function vfmath.addmissing(main,id,size)
 
     characters[0x02B9] = characters[0x2032] -- we're nice
 
+    data_of_smaller = main.fonts[id]
+    size_of_smaller = size
+
 end
 
 local unique = 0 -- testcase: \startTEXpage \math{!\text{-}\text{-}\text{-}} \stopTEXpage
diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv
index 6502047fb..16ecb4ca1 100644
--- a/tex/context/base/meta-ini.mkiv
+++ b/tex/context/base/meta-ini.mkiv
@@ -593,7 +593,7 @@
 %D \stoptyping
 
 \def\overlaystamp % watch the \MPcolor, since colors can be redefined
-  {\overlaywidth:\overlayheight:\overlaydepth:\MPcolor\overlaycolor:\MPcolor\overlaylinecolor}
+  {\overlaywidth:\overlayheight:\overlaydepth:\overlayoffset:\overlaylinewidth:\MPcolor\overlaycolor:\MPcolor\overlaylinecolor}
 
 %D A better approach is to let additional variables play a role
 %D in determining the uniqueness. In the next macro, the
@@ -1094,8 +1094,9 @@
     CurrentLayout:="\currentlayout";
     OverlayWidth:=\overlaywidth;
     OverlayHeight:=\overlayheight;
-    OverlayDepth:=\overlayheight;
+    OverlayDepth:=\overlaydepth;
     OverlayLineWidth:=\overlaylinewidth;
+    OverlayOffset:=\overlayoffset;
     %
     \m_meta_colo_initializations
     %
diff --git a/tex/context/base/scrn-wid.lua b/tex/context/base/scrn-wid.lua
index 90aaed609..5b319b07e 100644
--- a/tex/context/base/scrn-wid.lua
+++ b/tex/context/base/scrn-wid.lua
@@ -111,7 +111,7 @@ end
 commands.registerattachment = attachments.register
 
 function commands.insertattachment(specification)
-    texsetbox("b_scrn_attachment_link",attachments.insert(specification))
+    texsetbox("b_scrn_attachment_link",(attachments.insert(specification)))
 end
 
 -- Comment
@@ -125,7 +125,7 @@ function comments.insert(specification)
 end
 
 function commands.insertcomment(specification)
-    texsetbox("b_scrn_comment_link",comments.insert(specification))
+    texsetbox("b_scrn_comment_link",(comments.insert(specification)))
 end
 
 -- Soundclips
diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua
index 406896e4d..de3a1f1e8 100644
--- a/tex/context/base/spac-ver.lua
+++ b/tex/context/base/spac-ver.lua
@@ -1277,7 +1277,7 @@ function vspacing.collapsevbox(n) -- for boxes but using global a_snapmethod
     if box then
         local list = box.list
         if list then
-            setfield(box,"list",vpack_node(collapser(list,"snapper","vbox",trace_vbox_vspacing,true,a_snapmethod)))
+            box.list = vpack_node(collapser(list,"snapper","vbox",trace_vbox_vspacing,true,a_snapmethod))
         end
     end
 end
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index d2eb1348c..8ed3b2301 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.log b/tex/context/base/status-lua.log
index 10d115dfe..b3e3fc78d 100644
--- a/tex/context/base/status-lua.log
+++ b/tex/context/base/status-lua.log
@@ -1,6 +1,6 @@
 (cont-yes.mkiv
 
-ConTeXt  ver: 2013.07.14 14:53 MKIV beta  fmt: 2013.7.14  int: english/english
+ConTeXt  ver: 2013.07.19 10:31 MKIV beta  fmt: 2013.7.19  int: english/english
 
 system          > 'cont-new.mkiv' loaded
 (cont-new.mkiv)
diff --git a/tex/context/base/strc-con.mkvi b/tex/context/base/strc-con.mkvi
index 2d49a60db..75519b8ce 100644
--- a/tex/context/base/strc-con.mkvi
+++ b/tex/context/base/strc-con.mkvi
@@ -246,6 +246,24 @@
 
 \newconditional\c_strc_constructions_distance_none
 
+\def\strc_constructions_set_width_and_distance
+  {\assignwidth
+     \p_strc_constructions_width
+     \constructionsheadwidth
+     {\unhcopy\constructionheadbox}
+     \constructionsheaddistance}
+
+\def\strc_constructions_preroll_head#content%
+  {\setbox\constructionheadbox\hbox
+     {\forgetall
+      \dontcomplain
+      \settrialtypesetting
+      \csname\??constructionmainhandler\currentconstructionhandler\endcsname#content}}
+
+\def\strc_constructions_ignore_head
+  {\constructionsheaddistance\zeropoint
+   \constructionsheadwidth   \zeropoint}
+
 \unexpanded\setvalue{\??constructionstarthandler\v!construction}% this will be redone (reorganized) .. too much boxing
   {\dostarttagged\t!construction\currentconstruction
    \dotagsetconstruction
@@ -283,21 +301,34 @@
    \fi
    % inefficient and not always needed, for instance not with margins so we will make checkers
    % per alternative some day (especially in labels this is unwanted overhead)
-   \setbox\constructionheadbox\hbox
-     {\forgetall
-      \dontcomplain
-      \settrialtypesetting
-      \edef\p_strc_constructions_sample{\constructionparameter\c!sample}%
-      \ifx\p_strc_constructions_sample\empty
-        \csname\??constructionmainhandler\currentconstructionhandler\endcsname\currentconstructiontext
-      \else
-        \csname\??constructionmainhandler\currentconstructionhandler\endcsname\currentconstructionsample
-      \fi}%
-   \assignwidth
-     \p_strc_constructions_width
-     \constructionsheadwidth
-     {\unhcopy\constructionheadbox}
-     \constructionsheaddistance
+   %
+   % maybe we should have an option as i cannot oversee the consequences now
+   %
+   % \edef\p_strc_constructions_sample{\constructionparameter\c!sample}%
+   % \ifx\p_strc_constructions_sample\empty
+   %   \strc_constructions_preroll_head\currentconstructiontext
+   % \else
+   %   \strc_constructions_preroll_head\currentconstructiontextsample
+   % \fi
+   % \strc_constructions_set_width_and_distance
+   %
+   \strc_constructions_preroll_head\currentconstructiontext
+   \ifzeropt\wd\constructionheadbox
+     \strc_constructions_ignore_head
+   \else
+     \edef\p_strc_constructions_sample{\constructionparameter\c!sample}%
+     \ifx\p_strc_constructions_sample\empty
+       \strc_constructions_set_width_and_distance
+     \else
+       \strc_constructions_preroll_head\currentconstructionsample
+       \ifzeropt\wd\constructionheadbox
+     \strc_constructions_ignore_head
+       \else
+         \strc_constructions_set_width_and_distance
+       \fi
+     \fi
+   \fi
+   %
    \dostarttagged\t!constructiontag\empty % todo
    \setbox\constructionheadbox\hbox
      {\forgetall
diff --git a/tex/context/base/strc-lnt.mkvi b/tex/context/base/strc-lnt.mkvi
index 2c26acec7..f713ee20b 100644
--- a/tex/context/base/strc-lnt.mkvi
+++ b/tex/context/base/strc-lnt.mkvi
@@ -11,6 +11,8 @@
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
 %C details.
 
+% todo: mkvi #
+
 \writestatus{loading}{ConTeXt Structure Macros / Line Notes}
 
 %D This module loads on top of the footnote and line numbering macros.
diff --git a/tex/context/base/strc-ref.mkvi b/tex/context/base/strc-ref.mkvi
index c82a09d20..28d759a7f 100644
--- a/tex/context/base/strc-ref.mkvi
+++ b/tex/context/base/strc-ref.mkvi
@@ -230,6 +230,7 @@
      \dontleavehmode\hbox attr \destinationattribute\lastdestinationattribute\bgroup
        \strc_references_flush_destination_nodes
      \egroup
+     \prewordbreak % new
    \fi}
 
 \def\strc_references_set_page_only_destination_attribute#labels% could in fact be fully expandable
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index c17a54182..e32dad3d3 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  : 07/14/13 14:53:44
+-- merge date  : 07/19/13 10:31:47
 
 do -- begin closure to overcome local limits and interference
 
-- 
cgit v1.2.3