[latex3-commits] [git/LaTeX3-latex3-luaotfload] bidi-dev: Fix bugs found by @jbezos (5156fc6)

Marcel Fabian Krüger tex at 2krueger.de
Sun Aug 25 23:34:46 CEST 2019


Repository : https://github.com/latex3/luaotfload
On branch  : bidi-dev
Link       : https://github.com/latex3/luaotfload/commit/5156fc6cdc3e8a26c84b82019d07ccfd7c4b937d

>---------------------------------------------------------------

commit 5156fc6cdc3e8a26c84b82019d07ccfd7c4b937d
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Sun Aug 25 23:04:53 2019 +0200

    Fix bugs found by @jbezos


>---------------------------------------------------------------

5156fc6cdc3e8a26c84b82019d07ccfd7c4b937d
 src/luaotfload-bidi.lua                            | 34 +++++++++++++++-------
 texmf/tex/latex-dev/luaotfload/luaotfload-bidi.lua | 34 +++++++++++++++-------
 2 files changed, 46 insertions(+), 22 deletions(-)

diff --git a/src/luaotfload-bidi.lua b/src/luaotfload-bidi.lua
index 9642007..0d5f764 100644
--- a/src/luaotfload-bidi.lua
+++ b/src/luaotfload-bidi.lua
@@ -235,15 +235,9 @@ function do_wni(head, level, stop, sos, eos, node_class, node_level, node_origcl
         node_class[cur] = curclass
       end
     elseif curclass == "ET" then
-      local follow = getnext(cur)
-      local followclass = node_class[follow]
-      while follow ~= stop and (followclass == "ET" or not followclass) do
-        follow = getnext(follow)
-        followclass = node_class[follow]
-      end
-      if followclass == "EN" then
-        follow = cur
-        followclass = curclass
+      if prevclass == "EN" then
+        local follow = cur
+        local followclass = curclass
         while follow ~= stop and (followclass == "ET" or not followclass) do
           if followclass then
             node_class[follow] = "EN"
@@ -252,8 +246,26 @@ function do_wni(head, level, stop, sos, eos, node_class, node_level, node_origcl
           followclass = node_class[follow]
         end
       else
-        curclass = "ON"
-        node_class[cur] = curclass
+        local follow = getnext(cur)
+        local followclass = node_class[follow]
+        while follow ~= stop and (followclass == "ET" or not followclass) do
+          follow = getnext(follow)
+          followclass = node_class[follow]
+        end
+        if followclass == "EN" and prevstrong ~= "AL" then
+          follow = cur
+          followclass = curclass
+          while follow ~= stop and (followclass == "ET" or not followclass) do
+            if followclass then
+              node_class[follow] = "EN"
+            end
+            follow = getnext(follow)
+            followclass = node_class[follow]
+          end
+        else
+          curclass = "ON"
+          node_class[cur] = curclass
+        end
       end
     elseif curclass == "AL" then
       prevstrong = "AL"
diff --git a/texmf/tex/latex-dev/luaotfload/luaotfload-bidi.lua b/texmf/tex/latex-dev/luaotfload/luaotfload-bidi.lua
index 9642007..0d5f764 100644
--- a/texmf/tex/latex-dev/luaotfload/luaotfload-bidi.lua
+++ b/texmf/tex/latex-dev/luaotfload/luaotfload-bidi.lua
@@ -235,15 +235,9 @@ function do_wni(head, level, stop, sos, eos, node_class, node_level, node_origcl
         node_class[cur] = curclass
       end
     elseif curclass == "ET" then
-      local follow = getnext(cur)
-      local followclass = node_class[follow]
-      while follow ~= stop and (followclass == "ET" or not followclass) do
-        follow = getnext(follow)
-        followclass = node_class[follow]
-      end
-      if followclass == "EN" then
-        follow = cur
-        followclass = curclass
+      if prevclass == "EN" then
+        local follow = cur
+        local followclass = curclass
         while follow ~= stop and (followclass == "ET" or not followclass) do
           if followclass then
             node_class[follow] = "EN"
@@ -252,8 +246,26 @@ function do_wni(head, level, stop, sos, eos, node_class, node_level, node_origcl
           followclass = node_class[follow]
         end
       else
-        curclass = "ON"
-        node_class[cur] = curclass
+        local follow = getnext(cur)
+        local followclass = node_class[follow]
+        while follow ~= stop and (followclass == "ET" or not followclass) do
+          follow = getnext(follow)
+          followclass = node_class[follow]
+        end
+        if followclass == "EN" and prevstrong ~= "AL" then
+          follow = cur
+          followclass = curclass
+          while follow ~= stop and (followclass == "ET" or not followclass) do
+            if followclass then
+              node_class[follow] = "EN"
+            end
+            follow = getnext(follow)
+            followclass = node_class[follow]
+          end
+        else
+          curclass = "ON"
+          node_class[cur] = curclass
+        end
       end
     elseif curclass == "AL" then
       prevstrong = "AL"





More information about the latex3-commits mailing list