summaryrefslogtreecommitdiff
path: root/tex/context/base/font-ots.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/font-ots.lua')
-rw-r--r--tex/context/base/font-ots.lua75
1 files changed, 72 insertions, 3 deletions
diff --git a/tex/context/base/font-ots.lua b/tex/context/base/font-ots.lua
index 6826ae849..5dbb25ab2 100644
--- a/tex/context/base/font-ots.lua
+++ b/tex/context/base/font-ots.lua
@@ -194,9 +194,9 @@ local glue_code = nodecodes.glue
local disc_code = nodecodes.disc
local whatsit_code = nodecodes.whatsit
local math_code = nodecodes.math
+local dir_code = nodecodes.dir or whatcodes.dir
+local localpar_code = nodecodes.localpar or whatcodes.localpar
-local dir_code = whatcodes.dir
-local localpar_code = whatcodes.localpar
local discretionary_code = disccodes.discretionary
local ligature_code = glyphcodes.ligature
@@ -3292,7 +3292,7 @@ if not a or (a == attr) then
comprun(start,c_run)
start = getnext(start)
end
- elseif id == whatsit_code then -- will be function
+ elseif id == whatsit_code then
local subtype = getsubtype(start)
if subtype == dir_code then
local dir = getfield(start,"dir")
@@ -3331,6 +3331,41 @@ if not a or (a == attr) then
start = getnext(start)
elseif id == math_code then
start = getnext(end_of_math(start))
+ elseif id == dir_code then
+ local dir = getfield(start,"dir")
+ if dir == "+TLT" then
+ topstack = topstack + 1
+ dirstack[topstack] = dir
+ rlmode = 1
+ elseif dir == "+TRT" then
+ topstack = topstack + 1
+ dirstack[topstack] = dir
+ rlmode = -1
+ elseif dir == "-TLT" or dir == "-TRT" then
+ topstack = topstack - 1
+ rlmode = dirstack[topstack] == "+TRT" and -1 or 1
+ else
+ rlmode = rlparmode
+ end
+ if trace_directions then
+ report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,mref(rlparmode),mref(rlmode),topstack,mref(newdir))
+ end
+ start = getnext(start)
+ elseif id == localpar_code then
+ local dir = getfield(start,"dir")
+ if dir == "TRT" then
+ rlparmode = -1
+ elseif dir == "TLT" then
+ rlparmode = 1
+ else
+ rlparmode = 0
+ end
+ -- one might wonder if the par dir should be looked at, so we might as well drop the next line
+ rlmode = rlparmode
+ if trace_directions then
+ report_process("directions after pardir %a: parmode %a, txtmode %a",dir,mref(rlparmode),mref(rlmode))
+ end
+ start = getnext(start)
else
start = getnext(start)
end
@@ -3606,6 +3641,40 @@ if not a or (a == attr) then
start = getnext(start)
elseif id == math_code then
start = getnext(end_of_math(start))
+ elseif id == dir_code then
+ local dir = getfield(start,"dir")
+ if dir == "+TLT" then
+ topstack = topstack + 1
+ dirstack[topstack] = dir
+ rlmode = 1
+ elseif dir == "+TRT" then
+ topstack = topstack + 1
+ dirstack[topstack] = dir
+ rlmode = -1
+ elseif dir == "-TLT" or dir == "-TRT" then
+ topstack = topstack - 1
+ rlmode = dirstack[topstack] == "+TRT" and -1 or 1
+ else
+ rlmode = rlparmode
+ end
+ if trace_directions then
+ report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,mref(rlparmode),mref(rlmode),topstack,mref(newdir))
+ end
+ start = getnext(start)
+ elseif id == localpar_code then
+ local dir = getfield(start,"dir")
+ if dir == "TRT" then
+ rlparmode = -1
+ elseif dir == "TLT" then
+ rlparmode = 1
+ else
+ rlparmode = 0
+ end
+ rlmode = rlparmode
+ if trace_directions then
+ report_process("directions after pardir %a: parmode %a, txtmode %a",dir,mref(rlparmode),mref(rlmode))
+ end
+ start = getnext(start)
else
start = getnext(start)
end