From 0dc23517ffebac8da38bbf8b4b8753d2a39848a7 Mon Sep 17 00:00:00 2001
From: Hans Hagen <pragma@wxs.nl>
Date: Tue, 14 Aug 2012 10:44:00 +0200
Subject: beta 2012.08.14 10:44

---
 tex/context/base/buff-ver.mkiv                     |   2 +
 tex/context/base/cont-new.mkii                     |   2 +-
 tex/context/base/cont-new.mkiv                     | 227 ++---------------
 tex/context/base/context-version.pdf               | Bin 4089 -> 4087 bytes
 tex/context/base/context-version.png               | Bin 106764 -> 106568 bytes
 tex/context/base/context.mkii                      |   2 +-
 tex/context/base/context.mkiv                      |   2 +-
 tex/context/base/core-def.mkiv                     |   2 +
 tex/context/base/page-ini.mkiv                     |  19 ++
 tex/context/base/s-abr-01.tex                      |   2 +
 tex/context/base/spac-hor.mkiv                     |   5 +
 tex/context/base/spac-ver.mkiv                     |  69 +++++
 tex/context/base/status-files.pdf                  | Bin 24434 -> 24426 bytes
 tex/context/base/status-lua.pdf                    | Bin 190437 -> 190432 bytes
 tex/context/base/supp-box.mkiv                     |  36 ++-
 tex/context/base/syst-aux.mkiv                     |  66 ++++-
 tex/context/base/tabl-tbl.mkiv                     |  20 ++
 tex/context/base/type-imp-husayni.mkiv             | 280 ++++++++++++---------
 tex/context/base/typo-brk.mkiv                     |   2 +
 tex/context/fonts/husayni.lfg                      |   3 +-
 tex/generic/context/luatex/luatex-fonts-merged.lua |   2 +-
 21 files changed, 404 insertions(+), 337 deletions(-)

(limited to 'tex')

diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv
index 8c026d112..d18883faf 100644
--- a/tex/context/base/buff-ver.mkiv
+++ b/tex/context/base/buff-ver.mkiv
@@ -391,6 +391,8 @@
 
 \unexpanded\def\astype{\bgroup\usetypestyleandcolor\c!style\c!color\let\nexttoken}
 
+\unexpanded\def\asciistr#1{\dontleavehmode{\verbatimfont\detokenize{#1}}} % use in some old styles
+
 %D The basic display verbatim commands are defined in an indirect way. As we
 %D will see, they are a specific case of a more general mechanism.
 
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 5d0d77e4f..b68b34047 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.08.13 18:45}
+\newcontextversion{2012.08.14 10:44}
 
 %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 b0b002991..a5b59432f 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.08.13 18:45}
+\newcontextversion{2012.08.14 10:44}
 
 %D This file is loaded at runtime, thereby providing an excellent place for
 %D hacks, patches, extensions and new features.
@@ -20,230 +20,51 @@
 
 \writestatus\m!system{beware: some patches loaded from cont-new.mkiv}
 
-\def\dividedsize#1#2#3% size gap n
-  {\dimexpr
-     \ifnum\dimexpr#1\relax>\plusone
-       (\dimexpr#1\relax-\numexpr#3-1\relax\dimexpr#2\relax)/#3\else#1%
-     \fi
-   \relax}
-
-%D Idea:
-
-% \newinsert\thispageinsert % <- installinsertion
-%
-% \def\flushatthispage
-%   {\bgroup
-%    \dowithnextbox{\insert\thispageinsert{\box\nextbox}\egroup}%
-%    \hbox}
-%
-% \appendtoks
-%     \ifvoid\thispageinsert\else\hbox{\smashedbox\thispageinsert}\fi
-% \to \everyshipout
-
-%D Idea:
-
-% \definemarkedpage[nobackgrounds]
-% \markpage[nobackgrounds]
-% \doifmarkedpageelse{nobackgrounds}
-
-\unexpanded\def\inlinedbox
-  {\bgroup
-   \dowithnextbox
-     {\scratchdimen\nextboxht
-      \advance\scratchdimen\nextboxdp
-      \advance\scratchdimen-\lineheight
-      \divide\scratchdimen\plustwo
-      \advance\scratchdimen\strutdepth
-      \setbox\nextbox\hbox{\lower\scratchdimen\flushnextbox}%
-      \nextboxht\strutht
-      \nextboxdp\strutdp
-      \flushnextbox
-      \egroup}%
-     \hbox}
-
-\def\dimenratio#1#2% etex only
-  {\withoutpt\the\dimexpr2\dimexpr(#1)/\dimexpr(#2)/32768\relax\relax}
-
-\def\doxprecurse#1#2%
-  {\ifnum#1=\zerocount % no \ifcase
-     \expandafter\gobblethreearguments
-   \else
-     #2\expandafter\expandafter\expandafter\doxprecurse\expandafter
-   \fi\expandafter{\the\numexpr#1-1\relax}{#2}}
-
-\unexpanded\def\asciistr#1{\dontleavehmode{\defconvertedargument\ascii{#1}\verbatimfont\ascii}}
-
-\def\shapefill{\vskip\zeropoint\s!plus\lineheight\s!minus\lineheight\relax}
-
-
-\def\minimalhbox#1#%
-  {\dowithnextbox
-     {\bgroup
-      \setbox\scratchbox\hbox#1{\hss}%
-      \ifdim\nextboxwd<\wd\scratchbox\nextboxwd\wd\scratchbox\fi
-      \flushnextbox
-      \egroup}
-     \hbox}
-
-\def\gobbleuntilempty#1\empty{}
-
-\def\dodimchoice#1#2#3%
-  {\ifdim#1#2%
-     #3\@EA\gobbleuntilempty
-   \else
-     \@EA\dodimchoice
-   \fi{#1}}
+%D Maybe:
 
-\def\donumchoice#1#2#3%
-  {\ifnum#1#2%
-     #3\@EA\gobbleuntilempty
-   \else
-     \@EA\dodimchoice
-   \fi{#1}}
-
-\def\dimchoice#1#2{\dodimchoice{#1}#2{=#1}{#1}\empty}
-\def\numchoice#1#2{\donumchoice{#1}#2{=#1}{#1}\empty}
-
-% \the\dimexpr(\dimchoice {7pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}})
-% \the\dimexpr(\dimchoice{11pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}})
-% \the\dimexpr(\dimchoice{14pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}})
-
-% between alignment lines certain rules apply, and even a
-% simple test can mess up a table, which is why we have a
-% special test facility
-%
-% \ruledvbox
-%   {\starttabulate[|l|p|]
-%    \NC 1test \NC test \NC \NR
-%    \tableifelse{\doifelse{a}{a}}{\NC Xtest \NC test \NC \NR}{}%
-%    \stoptabulate}
-
-\def\tableifelse#1%
-  {\tablenoalign
-     {#1%
-       {\aftergroup \firstoftwoarguments}%
-       {\aftergroup\secondoftwoarguments}}}
-
-\def\tableiftextelse#1{\tableifelse{\doiftextelse{#1}}}
-
-\def\tightvbox{\dowithnextbox{\nextboxdp\zeropoint\flushnextbox}\vbox}
-\def\tightvtop{\dowithnextbox{\nextboxht\zeropoint\flushnextbox}\vtop}
-
-\unexpanded\def\obeysupersubletters
-  {\let\super\normalsuper
-   \let\suber\normalsuber
-   \let\normalsuper\letterhat
-   \let\normalsuber\letterunderscore
-   \enablesupersub}
-
-\unexpanded\def\obeysupersubmath
-  {\let\normalsuper\letterhat
-   \let\normalsuber\letterunderscore
-   \enablesupersub}
-
-\def\startgridcorrection
-  {\dosingleempty\dostartgridcorrection}
-
-\def\dostartgridcorrection[#1]%
+\unexpanded\def\tightvbox{\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\vbox}
+\unexpanded\def\tightvtop{\dowithnextbox{\ht\nextbox\zeropoint\box\nextbox}\vtop}
+
+%D Needs some work:
+
+\unexpanded\def\startgridcorrection
+  {\dosingleempty\spac_grid_correction_start}
+
+\def\spac_grid_correction_start[#1]%
   {\ifgridsnapping
      \snaptogrid[#1]\vbox\bgroup
    \else
      \startbaselinecorrection
    \fi}
 
-\def\stopgridcorrection
+\unexpanded\def\stopgridcorrection
   {\ifgridsnapping
      \egroup
    \else
      \stopbaselinecorrection
    \fi}
 
-\def\checkgridsnapping
+\unexpanded\def\checkgridsnapping
   {\lineskip\ifgridsnapping\zeropoint\else\normallineskip\fi}
-
-\def\startcolumnmakeup % don't change
+
+%D Probably obsolete:
+
+\unexpanded\def\startcolumnmakeup % don't change
   {\bgroup
-   \getrawnoflines\textheight % teksthoogte kan topskip hebben, dus raw
-   \scratchdimen\noflines\lineheight
-   \advance\scratchdimen-\lineheight
-   \advance\scratchdimen\topskip
-   \setbox\scratchbox
-   \ifcase\showgridstate\vbox\else\ruledvbox\fi to \scratchdimen\bgroup
-   \forgetall} % ! don't change
-
-\def\stopcolumnmakeup
+   \getrawnoflines\textheight % raw as we cna have topskip
+   \setbox\scratchbox\vbox to \dimexpr\noflines\lineheight-\lineheight+\topskip\relax
+     \bgroup
+     \forgetall}
+
+\unexpanded\def\stopcolumnmakeup
   {\egroup
    \dp\scratchbox\zeropoint
    \wd\scratchbox\textwidth
    \box\scratchbox
    \egroup
    \page_otr_command_synchronize_hsize}
-
-% incomplete, will be a special case of float placement
-
-\def\startfixed{\dosingleempty\dostartfixed}
-
-\def\dostartfixed[#1]%
-  {\expanded{\dowithnextbox{\noexpand\dodofixed{\ifhmode0\else1\fi}{#1}}}%
-   \vbox\bgroup
-   \setlocalhsize}
-
-\def\stopfixed
-  {\egroup}
-
-\def\dodofixed#1#2%
-  {\ifcase#1\relax
-     \processaction
-       [#2]
-       [   \v!high=>\bbox   {\flushnextbox},
-           \v!low=>\tbox    {\flushnextbox},
-         \v!middle=>\vcenter{\flushnextbox},
-           \v!lohi=>\vcenter{\flushnextbox},
-        \s!unknown=>\tbox   {\flushnextbox},
-        \s!default=>\tbox   {\flushnextbox}]%
-   \else
-     \startbaselinecorrection
-       \noindent\flushnextbox
-     \stopbaselinecorrection
-   \fi}
 
-% \startitemize
-%
-% \item \externalfigure[koe][height=2cm]
-% \item \externalfigure[koe][height=2cm]
-% \item \externalfigure[koe][height=2cm]
-% \item \externalfigure[koe][height=2cm]
-%
-% \page
-%
-% \item \startfixed      \externalfigure[koe][height=2cm]\stopfixed
-% \item \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed
-% \item \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed
-% \item \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed
-%
-% \page
-%
-% \item test \startfixed      \externalfigure[koe][height=2cm]\stopfixed
-% \item test \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed
-% \item test \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed
-% \item test \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed
-%
-% \page
-%
-% \item test \par \startfixed      \externalfigure[koe][height=2cm]\stopfixed
-% \item test \par \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed
-% \item test \par \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed
-% \item test \par \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed
-%
-% \stopitemize
-
-\def\obeyfollowingtoken{{}}  % end \cs scanning
-
-% potential new defaults:
-%
-% \setbreakpoints[compound]
-
-% till we fixed all styles:
+%D Till we fixed all styles:
 
 \let\\=\crlf
 
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 63662ffd6..689c9383b 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 1010da9f7..6c4bbc6cf 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 b1a8bcb98..82281400e 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.08.13 18:45}
+\edef\contextversion{2012.08.14 10:44}
 
 %D For those who want to use this:
 
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 51396d161..22d28841f 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{2012.08.13 18:45}
+\edef\contextversion{2012.08.14 10:44}
 
 %D For those who want to use this:
 
diff --git a/tex/context/base/core-def.mkiv b/tex/context/base/core-def.mkiv
index d418689ef..a574597e6 100644
--- a/tex/context/base/core-def.mkiv
+++ b/tex/context/base/core-def.mkiv
@@ -159,4 +159,6 @@
 %     \resetcharacterspacing
 % \to \everyhyphenatedurl
 
+% \setbreakpoints[compound]
+
 \protect \endinput
diff --git a/tex/context/base/page-ini.mkiv b/tex/context/base/page-ini.mkiv
index 9b7b1e4d2..fdffa552d 100644
--- a/tex/context/base/page-ini.mkiv
+++ b/tex/context/base/page-ini.mkiv
@@ -238,4 +238,23 @@
      \doubleexpandafter\secondoftwoarguments
    \fi\fi}
 
+% %D Idea:
+%
+% \newinsert\thispageinsert % <- installinsertion
+%
+% \def\flushatthispage
+%   {\bgroup
+%    \dowithnextbox{\insert\thispageinsert{\box\nextbox}\egroup}%
+%    \hbox}
+%
+% \appendtoks
+%     \ifvoid\thispageinsert\else\hbox{\smashedbox\thispageinsert}\fi
+% \to \everyshipout
+%
+% %D Idea:
+%
+% \definemarkedpage[nobackgrounds]
+% \markpage[nobackgrounds]
+% \doifmarkedpageelse{nobackgrounds}
+
 \protect \endinput
diff --git a/tex/context/base/s-abr-01.tex b/tex/context/base/s-abr-01.tex
index d6685bd71..cf2ade8a0 100644
--- a/tex/context/base/s-abr-01.tex
+++ b/tex/context/base/s-abr-01.tex
@@ -165,6 +165,7 @@
 \logo [MSDOS]      {msdos}
 \logo [MICROSOFT]  {Microsoft}
 \logo [MSWINDOWS]  {MS~Windows}
+\logo [MSWORD]     {MS~Word}
 \logo [MTXRUN]     {mtxrun}
 \logo [MTXTOOLS]   {mtxtools}
 \logo [NETPBM]     {NetPBM}
@@ -175,6 +176,7 @@
 \logo [OPENMATH]   {OpenMath}
 \logo [OPENTYPE]   {OpenType}
 \logo [OPI]        {opi}
+\logo [OTEX]       {Oriental \TeX}
 \logo [OTF]        {otf}
 \logo [OTP]        {otp}
 \logo [OVF]        {ovf}
diff --git a/tex/context/base/spac-hor.mkiv b/tex/context/base/spac-hor.mkiv
index 2753bdac4..d0d4660bc 100644
--- a/tex/context/base/spac-hor.mkiv
+++ b/tex/context/base/spac-hor.mkiv
@@ -1060,4 +1060,9 @@
      \unskip
    \fi\fi}
 
+%D \macros
+%D   {obeyfollowingtoken}
+
+\def\obeyfollowingtoken{{}}  % end \cs scanning
+
 \protect \endinput
diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv
index 010df21e4..7fdf2f70f 100644
--- a/tex/context/base/spac-ver.mkiv
+++ b/tex/context/base/spac-ver.mkiv
@@ -1924,4 +1924,73 @@
   {\endgraf
    \egroup}
 
+%D \macros
+%D   {startfixed}
+%D
+%D \starttyping
+%D \startitemize
+%D     \startitem \externalfigure[cow][height=1cm] \stopitem
+%D     \startitem \externalfigure[cow][height=1cm] \stopitem
+%D
+%D     \startitem \startfixed      \externalfigure[cow][height=1cm]\stopfixed \stopitem
+%D     \startitem \startfixed[high]\externalfigure[cow][height=1cm]\stopfixed \stopitem
+%D     \startitem \startfixed[low] \externalfigure[cow][height=1cm]\stopfixed \stopitem
+%D     \startitem \startfixed[lohi]\externalfigure[cow][height=1cm]\stopfixed \stopitem
+%D
+%D     \startitem test \par \startfixed      \externalfigure[koe][height=1cm]\stopfixed \stopitem
+%D     \startitem test \par \startfixed[high]\externalfigure[koe][height=1cm]\stopfixed \stopitem
+%D     \startitem test \par \startfixed[low] \externalfigure[koe][height=1cm]\stopfixed \stopitem
+%D     \startitem test \par \startfixed[lohi]\externalfigure[koe][height=1cm]\stopfixed \stopitem
+%D \stopitemize
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+
+\installcorenamespace{fixedalternatives}
+
+\unexpanded\def\startfixed
+  {\bgroup
+   \dosingleempty\typo_fixed_start}
+
+\def\typo_fixed_start
+  {\ifhmode
+     \expandafter\typo_fixed_start_h
+   \else
+     \expandafter\typo_fixed_start_v
+   \fi}
+
+\def\typo_fixed_start_h[#1]%
+  {\let\stopfixed\typo_fixed_stop_h
+   \dowithnextbox{\typo_fixed_finish{#1}}%
+   \vbox\bgroup
+   %ignorespaces
+   \setlocalhsize}
+
+\unexpanded\def\typo_fixed_stop_h
+  {%removeunwantedspaces
+   \egroup
+   \egroup}
+
+\def\typo_fixed_start_v[#1]%
+  {\let\stopfixed\typo_fixed_stop_v
+   \startbaselinecorrection}
+
+\unexpanded\def\typo_fixed_stop_v
+  {\stopbaselinecorrection
+   \egroup}
+
+\letvalue{\??fixedalternatives   \v!high}\bbox
+\letvalue{\??fixedalternatives    \v!low}\tbox
+\letvalue{\??fixedalternatives \v!middle}\vcenter
+\letvalue{\??fixedalternatives   \v!lohi}\vcenter
+\letvalue{\??fixedalternatives\s!unknown}\tbox
+\letvalue{\??fixedalternatives\s!default}\tbox
+
+\unexpanded\def\typo_fixed_finish#1%
+  {\expandcheckedcsname\??fixedalternatives{#1}\s!default{\box\nextbox}}
+
+% %D Forgotten already:
+%
+% \def\shapefill{\vskip\zeropoint\s!plus\lineheight\s!minus\lineheight\relax}
+
 \protect \endinput
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 539067d56..a7a181ece 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 b05be9286..3e6336e26 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/supp-box.mkiv b/tex/context/base/supp-box.mkiv
index dc6358202..a8774e482 100644
--- a/tex/context/base/supp-box.mkiv
+++ b/tex/context/base/supp-box.mkiv
@@ -1424,12 +1424,27 @@
   {\setbox\nextbox\hbox
      {\strut
       \dp\nextbox\zeropoint
-      \lower\strutdepth\box\nextbox}%
-    \dp\nextbox\strutdepth
-    \ht\nextbox\strutheight
+      \lower\strutdp\box\nextbox}%
+    \dp\nextbox\strutdp
+    \ht\nextbox\strutht
     \box\nextbox
     \egroup}
 
+%D A variant on this:
+
+\unexpanded\def\inlinedbox
+  {\bgroup
+   \dowithnextbox
+     {\setbox\nextbox\hbox
+        {\lower
+           \dimexpr(\htdp\nextbox-\lineheight)/\plustwo+\strutdp\relax
+           \box\nextbox}%
+      \ht\nextbox\strutht
+      \dp\nextbox\strutdp
+      \box\nextbox
+      \egroup}%
+     \hbox}
+
 %D \macros
 %D   {struttedbox}
 %D
@@ -2615,6 +2630,21 @@
 % \showboxbreadth\maxdimen
 % \showboxdepth  \maxdimen
 
+%D Moved from cont-new:
+%D
+%D \starttyping
+%D \minimalhbox 100pt {test}
+%D \stoptyping
+
+\unexpanded\def\minimalhbox#1#%
+  {\dowithnextbox
+     {\bgroup
+      \setbox\scratchbox\hbox#1{\hss}%
+      \ifdim\wd\nextbox<\wd\scratchbox\wd\nextbox\wd\scratchbox\fi
+      \box\nextbox
+      \egroup}
+     \hbox}
+
 \protect \endinput
 
 % a bit of test code:
diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv
index 0fab918b7..8dd99fe83 100644
--- a/tex/context/base/syst-aux.mkiv
+++ b/tex/context/base/syst-aux.mkiv
@@ -3272,8 +3272,7 @@
 
 %D \macros
 %D   {dorecurse,recurselevel,recursedepth,
-%D    dostepwiserecurse,
-%D    for}
+%D    dostepwiserecurse}
 %D
 %D \TEX\ does not offer us powerfull for||loop mechanisms. On
 %D the other hand its recursion engine is quite unique. We
@@ -3389,9 +3388,9 @@
 \unexpanded\def\dorecurse#1%
   {\dostepwiserecurse\plusone{#1}\plusone}
 
-\def\doexpandedrecurse#1#2% user macro
+\def\doexpandedrecurse#1#2% user macro (also was \doxprecurse)
   {\ifnum#1>\zerocount
-     #2\expandafter\doexpandedrecurse\expandafter{\the\numexpr#1-1\relax}{#2}%
+     #2\expandafter\doexpandedrecurse\expandafter{\the\numexpr#1-\plusone\relax}{#2}%
    \fi}
 
 %D As we can see here, the simple command \type{\dorecurse} is
@@ -6239,17 +6238,11 @@
 \installsystemnamespace{measure}
 
 \unexpanded\def\definemeasure
-  {\dodoubleargument\dodefinemeasure}
+  {\dodoubleargument\syst_helpers_define_measure}
 
-\def\dodefinemeasure[#1][#2]%
+\def\syst_helpers_define_measure[#1][#2]%
   {\expandafter\def\csname\??measure#1\endcsname{#2}}
 
-% #2 could be omitted, but we want to support spaces
-%
-% \setmeasure {x}  {1cm}
-% \setmeasure {xx} {1cm}
-% \setmeasure {xxx}{1cm}
-
 \unexpanded\def\setmeasure #1#2{\expandafter\def \csname\??measure#1\endcsname{#2}} % quick way
 \unexpanded\def\setemeasure#1#2{\expandafter\edef\csname\??measure#1\endcsname{#2}} % quick way
 \unexpanded\def\setgmeasure#1#2{\expandafter\gdef\csname\??measure#1\endcsname{#2}} % quick way
@@ -6258,6 +6251,28 @@
 \def\measure#1% maybe \dimexpr ... \relax
   {\ifcsname\??measure#1\endcsname\csname\??measure#1\endcsname\else\zeropoint\fi}
 
+% #2 could be omitted, but we want to support spaces
+%
+% \setmeasure {x}  {1cm}
+% \setmeasure {xx} {1cm}
+% \setmeasure {xxx}{1cm}
+
+%D \macros
+%D   {dividedsize}
+%D
+%D This one can be used inside a measure (used in m4all):
+%D
+%D \starttyping
+%D \definemeasure[columnwidth][\dividedsize\textwidth{1em}{3}]
+%D \stoptyping
+
+\def\dividedsize#1#2#3% size gap n
+  {\dimexpr
+     \ifnum\dimexpr#1\relax>\plusone
+       (\dimexpr#1\relax-\numexpr#3-\plusone\relax\dimexpr#2\relax)/#3\else#1%
+     \fi
+   \relax}
+
 %D \macros
 %D   {doifdimensionelse}
 %D
@@ -6747,6 +6762,33 @@
      {#1}%
    \fi}
 
+% %D Maybe some day (moved from cont-new):
+% %D
+% %D \starttyping
+% %D \the\dimexpr(\dimchoice {7pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}})
+% %D \the\dimexpr(\dimchoice{11pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}})
+% %D \the\dimexpr(\dimchoice{14pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}})
+% %D \stoptyping
+%
+% \def\syst_helpers_choice_finish#1\empty{}
+%
+% \def\syst_helpers_choice_dim#1#2#3%
+%   {\ifdim#1#2%
+%      #3\expandafter\syst_helpers_choice_finish
+%    \else
+%      \expandafter\syst_helpers_choice_dim
+%    \fi{#1}}
+%
+% \def\syst_helpers_choice_num#1#2#3%
+%   {\ifnum#1#2%
+%      #3\expandafter\syst_helpers_choice_finish
+%    \else
+%      \expandafter\syst_helpers_choice_num
+%    \fi{#1}}
+%
+% \def\dimchoice#1#2{\syst_helpers_choice_dim{#1}#2{=#1}{#1}\empty}
+% \def\numchoice#1#2{\syst_helpers_choice_num{#1}#2{=#1}{#1}\empty}
+
 \protect \endinput
 
 % \edef\choicetokenyes{+}
diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv
index d38b7e22e..90fba1e69 100644
--- a/tex/context/base/tabl-tbl.mkiv
+++ b/tex/context/base/tabl-tbl.mkiv
@@ -2153,6 +2153,26 @@
     \let\TB\tabl_tabulate_TB
 \to \everytabulate
 
+% %D Between alignment lines certain rules apply, and even a simple test can mess
+% %D up a table, which is why we have a special test facilityL
+% %D
+% %D \startbuffer
+% %D \starttabulate[|l|p|]
+% %D \NC 1test \NC test \NC \NR
+% %D \tableifelse{\doifelse{a}{a}}{\NC Xtest \NC test \NC \NR}{}%
+% %D \stoptabulate
+% %D \stopbuffer
+% %D
+% %D \typebuffer \getbuffer
+%
+% \def\tableifelse#1% should be tabulatenoalign then
+%   {\tablenoalign
+%      {#1%
+%        {\aftergroup \firstoftwoarguments}%
+%        {\aftergroup\secondoftwoarguments}}}
+%
+% \def\tableiftextelse#1{\tableifelse{\doiftextelse{#1}}}
+
 %D Some new trickery:
 %D
 %D \startbuffer
diff --git a/tex/context/base/type-imp-husayni.mkiv b/tex/context/base/type-imp-husayni.mkiv
index 96999fd4e..b81996c33 100644
--- a/tex/context/base/type-imp-husayni.mkiv
+++ b/tex/context/base/type-imp-husayni.mkiv
@@ -1,126 +1,133 @@
-\definefontfeature
+%D \module
+%D   [       file=type-imp-husayni,
+%D        version=2008.08.08, % or whatever ... onwards
+%D          title=\CONTEXT\ Typescript Macros,
+%D       subtitle=Husayni,
+%D         author=Idris Samawi Hamid \& 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.
+
+%D For a detailed list of features and names, see husayni.lfg. In fact, the following
+%D sets will go there.
+
+\definefontfeature
   [husayni-default]
-  [analyze=yes,mode=node,
-   language=dflt,script=arab,
-   ccmp=yes, % adds identity dots to unicode letters; includes dynamic dot placement
-   init=yes,medi=yes,fina=yes, % contextual analysis
-   % dlig=yes, % Hamzahbelow under YaaHamzahabove
-   rlig=yes, % indispensable
-   calt=yes, % ayah+numerals
-   salt=yes, % includes manual justification with Tatwiil
-   % fchr=yes % formatting chars
-   anum=yes, % replace latin numerals with arabic-script ones
-   ss01=yes, % Allah, Muhammad,
-   % ss02=yes, % ss01 + Allah_final
-   ss03=yes, % level-1 stack over Jiim, initial entry only
-   % ss04=yes, % level-1 stack over Jiim, initial/medial entry
-   % ss05=yes, % multi-level Jiim stacking, initial/medial entry
-   % ss06=yes, % aesthetic Faa/Qaaf for FJ_mm, FJ_mf connection
-   ss07=yes, % initial-entry stacking over Haa
-   % ss08=yes, % initial/medial stacking over Haa, minus HM_mf strings
-   % ss09=yes, % initial/medial Haa stacking plus HM_mf strings
-   ss10=yes, % basic dipped Miim, initial-entry B_S-stack over Miim
-   % ss11=yes, % full dipped Miim, initial-entry B_S-stack over Miim
-   ss12=yes, % XBM_im initial-medial entry B_S-stack over Miim,
-   % ss13=yes, % full initial-medial entry B_S-stacked Miim
-   % ss14=yes, initial entry, stacked Laam on Miim
-   ss15=yes, % full stacked Laam-on-Miim
-   ss16=yes, % initial entry, stacked Ayn-on-Miim
-   % ss17=yes, % full stacked Ayn-on-Miim
-   % ss18=yes, % LMJ_im % already contained in ss03--05, may remove
-   ss19=yes, % LM_im
-   % ss20=yes, % KLM_m, sloped Miim
-   % ss21=yes, % KLM_i_mm/LM_mm, sloped Miim
-   % ss22=yes, % filled sloped Miim
-   % ss23=yes, % LM_mm, non-sloped Miim
-   ss24=yes, % BR_i_mf, BN_i_mf
-   ss25=yes, % basic LH_im % might merge with ss24
-   ss26=yes, % full Yaa.final special strings: BY_if, BY_mf, LY_mf
-   ss27=yes, % basic thin Miim.final
-   % ss28=yes, % full thin Miim.final % to be moved to jsnn
-   % ss29=yes, % basic short Miim.final
-   % ss30=yes, % full short Miim.final % to be moved to jsnn
-   ss31=yes, % basic Raa.final strings: JR and SR
-   % ss32=yes, % basic Raa.final strings: JR, SR, and BR
-   % ss33=yes, % TtR % to be moved to jsnn
-   ss34=yes, % AyR style % also available in jsnn
-   ss35=yes, % full Kaaf contexts
-   ss36=yes, % full Laam contexts
-   ss37=yes, % Miim-Miim contexts
-   ss38=yes, % basic dipped Haa, B_SH_mm
-   % ss39=yes, % full dipped Haa,  B_S_LH_i_mm_Mf
-   % ss40=yes, % aesthetic dipped medial Haa
-   ss41=yes, % high and low Baa strings
-   ss42=yes, % diagonal entry
-   ss43=yes, % initial alternates
-   % ss44=yes, % hooked final alif
-   % ss45=yes, % BMA_f
-   % ss46=yes, % BM_mm_alt, for JBM combinations
-   % ss47=yes, % Shaddah-<kasrah> combo
-   % ss48=yes, % Auto-sukuun
-   % ss49=yes, % No vowels
-   % ss50=yes, % Shaddah/MaaddahHamzah only
-   % ss51=yes, % No Skuun
-   % ss52=yes, % No Waslah
-   % ss53=yes, % No Waslah
-   % ss54=yes, % chopped finals
-   % ss55=yes, % idgham-tanwin
-   ss60=yes, %
-   % js01=yes, % Raawide
-   % js02=yes, % Yaawide
-   % js03=yes, % Kaafwide
-   % js04=yes, % Nuunwide
-   % js05=yes, % Kaafwide Nuunwide Siinwide Baawide
-   % js06=yes, % final Haa wide
-   % js07=yes, % thin Miim
-   % js08=yes, % short Miim
-   % js09=yes, % wide Siin
-   % js10=yes, % thuluth-style initial Haa, final Miim, MRw_mf
-   % js11=yes, % level-1 stretching
-   % js12=yes, % level-2 stretching
-   % js13=yes, % level-3 stretching
-   % js14=yes, % final Alif
-   % js15=yes, % hooked final Alif
-   js16=yes, % aesthetic medial Faa/Qaaf
-   % js17=yes, % fancy isol Haa after Daal, Raa, and Waaw
-   % js18=yes, % Laamwide, alternate substitution
-   % js19=yes, % level-4 stretching, only siin and Hhaa for basmalah
-   % js20=yes, % level-5 stretching, only siin and Hhaa for basmalah
-   % js21=yes, % Haa.final_alt2
-   % calt=yes, % to be used for vowel/dot-based dynamics
-   % ttwl=yes, % for simple, horizontal stretching, not yet implemented in luatex/mkiv
-   % flts=yes, % Final Glyph On Line Alternates Short: Baa-like
-   % fltw=yes, % Final Glyph On Line Alternates Wide: Baa-like
-   % gclr=yes, % Geometric Cursive LR : for testing GPOS only!
-   % gcrl=yes, % Geometric Cursive RL
-   % gklr=yes, % Geometric Kerning LR
-   % gkrl=yes, % Geometric Kerning RL
-   kern=yes, % includes kerning of dot-base pairs, and final pairs in continuous strings
-   curs=yes, % we don't curs final pairs, padj for that
-   mark=yes, % vowels
-   mkmk=yes, % stacked vowels
+  [analyze=yes,
+   mode=node,
+   language=dflt,
+   script=arab,
+   ccmp=yes,         % adds identity dots to unicode letters; includes dynamic dot placement
+   init=yes,         % contextual analysis
+   medi=yes,         % contextual analysis
+   fina=yes,         % contextual analysis
+   rlig=yes,         % indispensable
+   calt=yes,         % ayah+numerals
+   salt=yes,         % includes manual justification with Tatwiil
+   anum=yes,         % replace latin numerals with arabic-script ones
+   ss01=yes,         % Allah, Muhammad,
+   ss03=yes,         % level-1 stack over Jiim, initial entry only
+   ss10=yes,         % basic dipped Miim, initial-entry B_S-stack over Miim
+   ss12=yes,         % XBM_im initial-medial entry B_S-stack over Miim,
+   ss15=yes,         % full stacked Laam-on-Miim
+   ss16=yes,         % initial entry, stacked Ayn-on-Miim
+   ss19=yes,         % LM_im
+   ss24=yes,         % BR_i_mf, BN_i_mf
+   ss25=yes,         % basic LH_im % might merge with ss24
+   ss26=yes,         % full Yaa.final special strings: BY_if, BY_mf, LY_mf
+   ss27=yes,         % basic thin Miim.final
+   ss31=yes,         % basic Raa.final strings: JR and SR
+   ss34=yes,         % AyR style % also available in jsnn
+   ss35=yes,         % full Kaaf contexts
+   ss36=yes,         % full Laam contexts
+   ss37=yes,         % Miim-Miim contexts
+   ss38=yes,         % basic dipped Haa, B_SH_mm
+   ss41=yes,         % high and low Baa strings
+   ss42=yes,         % diagonal entry
+   ss43=yes,         % initial alternates
+   ss60=yes,         %
+   js16=yes,         % aesthetic medial Faa/Qaaf
+   kern=yes,         % includes kerning of dot-base pairs, and final pairs in continuous strings
+   curs=yes,         % we don't curs final pairs, padj for that
+   mark=yes,         % vowels
+   mkmk=yes,         % stacked vowels
    tlig=yes,
-   colorscheme=husayni:default]
+   goodies=husayni,
+   colorscheme=default]
+
+\definefontfeature
+  [husayni-alternative] % was husayni-default2
+  [analyze=yes,
+   mode=node,
+   language=dflt,
+   script=arab,
+   ccmp=yes,         % adds identity dots to unicode letters; includes dynamic dot placement
+   init=yes,         % contextual analysis
+   medi=yes,         % contextual analysis
+   fina=yes,         % contextual analysis
+   rlig=yes,         % indispensable
+   calt=yes,         % ayah+numerals
+   salt=yes,         % includes manual justification with Tatwiil
+   anum=yes,         % replace latin numerals with arabic-script ones
+   ss01=yes,         % Allah, Muhammad,
+   ss03=yes,         % level-1 stack over Jiim, initial entry only
+   ss10=yes,         % basic dipped Miim, initial-entry B_S-stack over Miim
+   ss12=yes,         % XBM_im initial-medial entry B_S-stack over Miim,
+   ss15=yes,         % full stacked Laam-on-Miim
+   ss16=yes,         % initial entry, stacked Ayn-on-Miim
+   ss19=yes,         % LM_im
+   ss24=yes,         % BR_i_mf, BN_i_mf
+   ss25=yes,         % basic LH_im % might merge with ss24
+   ss26=yes,         % full Yaa.final special strings: BY_if, BY_mf, LY_mf
+   ss27=yes,         % basic thin Miim.final
+   ss31=yes,         % basic Raa.final strings: JR and SR
+   ss34=yes,         % AyR style % also available in jsnn
+   ss35=yes,         % full Kaaf contexts
+   ss36=yes,         % full Laam contexts
+   ss37=yes,         % Miim-Miim contexts
+   ss38=yes,         % basic dipped Haa, B_SH_mm
+   ss41=yes,         % high and low Baa strings
+   ss42=yes,         % diagonal entry
+   ss43=yes,         % initial alternates
+   ss60=yes,         %
+   js16=yes,         % aesthetic medial Faa/Qaaf
+   kern=yes,         % includes kerning of dot-base pairs, and final pairs in continuous strings
+   curs=yes,         % we don't curs final pairs, padj for that
+   mark=yes,         % vowels
+   mkmk=yes,         % stacked vowels
+   tlig=yes]
 
 \definefontfeature
   [husayni-tt]
-  [analyze=yes,mode=node,
-   language=dflt,script=arab,
-   ccmp=yes, % adds identity dots to unicode letters; includes dynamic dot placement
-   init=yes,medi=yes,fina=yes, % contextual analysis
-   rlig=yes, % indispensable
+  [analyze=yes,
+   mode=node,
+   language=dflt,
+   script=arab,
+   ccmp=yes,
+   init=yes,
+   medi=yes,
+   fina=yes,
+   rlig=yes,
    fchr=yes,
-   kern=yes, % includes kerning of dot-base pairs, and final pairs in continuous strings
-   curs=yes, % we don't curs final pairs, padj for that
-   mark=yes, % vowels
-   mkmk=yes] % stacked vowels
+   kern=yes,
+   curs=yes,
+   mark=yes,
+   mkmk=yes]
 
 \definefontfeature
   [husayni-mono]
-  [analyze=yes,mode=node,
-   language=dflt,script=arab,ccmp=no,
-   init=yes,medi=yes,fina=yes,isol=yes,
-   rlig=yes,liga=yes,
+  [analyze=yes,
+   mode=node,
+   language=dflt,
+   script=arab,
+   ccmp=no,
+   init=yes,
+   medi=yes,
+   fina=yes,
+   isol=yes,
    mset=yes]
 
 \definedelimitedtext
@@ -144,3 +151,48 @@
   [left={‏\symbol[rightquote]},
    right={‏\symbol[leftquote]},
    leftmargin=standard]
+
+\definebodyfontenvironment
+  [husayni-default]
+  [default]
+  [interlinespace=4.4ex]
+
+\definefontfallback
+  [husayni-latin]
+  [file:lmroman12-regular*default]
+  [basiclatin,latin-1supplement,latinextended-A,latinextendedadditional]
+  [force=no,
+   rscale=.7]
+
+\definefontfallback
+   [husayni-mono]
+   [file:cour*husayni-mono]
+   [arabic,arabicpresentationformsa,arabicpresentationformsb,arabicsupplement,0x200C,0x200D,0x200E,0x200F]
+ % [force=no]
+
+\definebodyfontenvironment[20.7pt]
+\definebodyfontenvironment[24.8pt]
+\definebodyfontenvironment[29.8pt]
+\definebodyfontenvironment[35.8pt]
+
+\starttypescriptcollection[husayni]
+
+    \starttypescript [naskh] [husayni] [name]
+        \definefontsynonym [Arabic-Light]       [name:husayni] [goodies=husayni,features=husayni-default]
+        \definefontsynonym [Arabic-Bold]        [name:husayni] [goodies=husayni,features=husayni-default]
+        \definefontsynonym [Arabic-Italic]      [name:husayni] [goodies=husayni,features=husayni-default]
+        \definefontsynonym [Arabic-Bold-Italic] [name:husayni] [goodies=husayni,features=husayni-default]
+
+        \definefontsynonym [Serif]           [Arabic-Light]
+        \definefontsynonym [SerifItalic]     [Arabic-Italic]
+        \definefontsynonym [SerifBold]       [Arabic-Bold]
+        \definefontsynonym [SerifBoldItalic] [Arabic-Bold-Italic]
+    \stoptypescript
+
+    \starttypescript [husayni-default]
+        \definetypeface [husayni-default] [rm] [naskh] [husayni]  [default] [fallbacks=husayni-latin]
+        \definetypeface [husayni-default] [tt] [mono]  [modern]   [default] [fallbacks=husayni-latin]
+        \definetypeface [husayni-default] [mm] [math]  [xitsbidi] [default]
+    \stoptypescript
+
+\stoptypescriptcollection
diff --git a/tex/context/base/typo-brk.mkiv b/tex/context/base/typo-brk.mkiv
index 62fd72fce..af498bfec 100644
--- a/tex/context/base/typo-brk.mkiv
+++ b/tex/context/base/typo-brk.mkiv
@@ -77,6 +77,8 @@
 % \setbreakpoints[compound]
 % \start \hsize 1mm test-test \par \stop
 
+%D Maybe some day default:
+%
 % \setbreakpoints[compound]
 
 \protect \endinput
diff --git a/tex/context/fonts/husayni.lfg b/tex/context/fonts/husayni.lfg
index d0b3e631c..2f45add21 100644
--- a/tex/context/fonts/husayni.lfg
+++ b/tex/context/fonts/husayni.lfg
@@ -17,6 +17,7 @@ local regular = {
    ss01 = yes, ss03 = yes, ss07 = yes, ss10 = yes, ss12 = yes, ss15 = yes, ss16 = yes,
    ss19 = yes, ss24 = yes, ss25 = yes, ss26 = yes, ss27 = yes, ss31 = yes, ss34 = yes,
    ss35 = yes, ss36 = yes, ss37 = yes, ss38 = yes, ss41 = yes, ss42 = yes, ss43 = yes,
+   ss55 = yes,
    js16 = yes,
 }
 
@@ -44,7 +45,7 @@ local shrink = {
     flts = yes, js17 = yes, ss05 = yes, ss11 = yes, ss06 = yes, ss09 = yes,
 }
 
-local default = {
+local default = { -- we need to merge the typescript definition in here
     basics, analysis, regular, positioning, -- xxxx = yes, yyyy = 2,
 }
 
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 3b6506586..6f624c38f 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  : 08/13/12 18:45:25
+-- merge date  : 08/14/12 10:44:56
 
 do -- begin closure to overcome local limits and interference
 
-- 
cgit v1.2.3