From e6734b0c6499a51dec0e834b68d0ac579602e1eb Mon Sep 17 00:00:00 2001
From: Hans Hagen <pragma@wxs.nl>
Date: Tue, 10 Sep 2013 17:17:00 +0200
Subject: beta 2013.09.10 17:17

---
 tex/context/base/cont-new.mkiv                     |   2 +-
 tex/context/base/context-version.pdf               | Bin 4109 -> 4115 bytes
 tex/context/base/context.mkiv                      |   2 +-
 tex/context/base/status-files.pdf                  | Bin 24758 -> 24752 bytes
 tex/context/base/status-lua.log                    |   2 +-
 tex/context/base/typo-dha.lua                      |  18 +++++++++++++-----
 tex/generic/context/luatex/luatex-fonts-merged.lua |   2 +-
 7 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index bc6eca7b7..cfd7dfc93 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.09.10 16:50}
+\newcontextversion{2013.09.10 17:17}
 
 %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 0bc759237..a80e91311 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 8d744fa13..c82bdc27d 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.09.10 16:50}
+\edef\contextversion{2013.09.10 17:17}
 \edef\contextkind   {beta}
 
 %D For those who want to use this:
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index f6f078e45..975b88348 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 339dc72cf..8b1432edf 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.09.10 16:50 MKIV beta  fmt: 2013.9.10  int: english/english
+ConTeXt  ver: 2013.09.10 17:17 MKIV beta  fmt: 2013.9.10  int: english/english
 
 system          > 'cont-new.mkiv' loaded
 (cont-new.mkiv)
diff --git a/tex/context/base/typo-dha.lua b/tex/context/base/typo-dha.lua
index 35dfa856e..131db28df 100644
--- a/tex/context/base/typo-dha.lua
+++ b/tex/context/base/typo-dha.lua
@@ -103,6 +103,7 @@ local function process(namespace,attribute,start)
     local finished, finidir, finipos = nil, nil, 1
     local stack, top, obsolete = { }, 0, { }
     local lro, rlo, prevattr = false, false, 0
+    local fences = { }
 
     local function finish_auto_before()
         local fdir = finish == "TRT" and "-TRT" or "-TLT"
@@ -183,7 +184,7 @@ local function process(namespace,attribute,start)
                 local d = chardirections[char]
                 return d == "r" or d == "al" or d == "an"
          -- elseif id == glue_code or id == kern_code or id == penalty_code then
-         --   -- too complex
+         --   -- too complex and doesn't cover bounds anyway
      --     else
      --         return
             end
@@ -199,7 +200,7 @@ local function process(namespace,attribute,start)
                 local d = chardirections[char]
                 return d == "r" or d == "al" or d == "an"
          -- elseif id == glue_code or id == kern_code or id == penalty_code then
-         --     -- too complex
+         --   -- too complex and doesn't cover bounds anyway
      --     else
      --         return
             end
@@ -291,9 +292,10 @@ local function process(namespace,attribute,start)
                     if d == "on" then
                         local mirror = charmirrors[char]
                         if mirror and fontchar[current.font][mirror] then
-                            -- todo: set attribute
+                            -- for the moment simple stacking
                             local class = charclasses[char]
                             if class == "open" then
+                                fences[#fences+1] = autodir
                                 if nextisright(current) then
                                     if autodir >= 0 then
                                         force_auto_right_before(d)
@@ -306,10 +308,16 @@ local function process(namespace,attribute,start)
                                         force_auto_left_before(d)
                                     end
                                 end
-                            elseif class == "close" then
-                                if previsright(current) then
+                            elseif class == "close" and #fences > 0 then
+                                local prevdir = fences[#fences]
+                                fences[#fences] = nil
+                                if prevdir < 0 then
                                     current.char = mirror
                                     done = true
+                                    if autodir >= 0 then
+                                        -- a bit tricky but ok for simple cases
+                                        force_auto_right_before(d)
+                                    end
                                 else
                                     mirror = nil
                                 end
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 88f94b647..4e5f1cfc6 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  : 09/10/13 16:50:05
+-- merge date  : 09/10/13 17:17:59
 
 do -- begin closure to overcome local limits and interference
 
-- 
cgit v1.2.3