summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/typo-dir.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-04-08 00:43:40 +0000
committerKarl Berry <karl@freefriends.org>2013-04-08 00:43:40 +0000
commit824f7b0903de8ad7f6ee3d7656005e4c59155e06 (patch)
treeabfc8673ef9916f3ab7074e811207384c301492b /Master/texmf-dist/tex/context/base/typo-dir.lua
parent689aefb0727676ed3cddf331337b4be226495e72 (diff)
context import for TL13, from www.pragma-ade.com/context/beta/cont-tmf.zip
git-svn-id: svn://tug.org/texlive/trunk@29731 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/typo-dir.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/typo-dir.lua26
1 files changed, 13 insertions, 13 deletions
diff --git a/Master/texmf-dist/tex/context/base/typo-dir.lua b/Master/texmf-dist/tex/context/base/typo-dir.lua
index 620862e85a8..7e5f8c2d3a8 100644
--- a/Master/texmf-dist/tex/context/base/typo-dir.lua
+++ b/Master/texmf-dist/tex/context/base/typo-dir.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['typo-dir'] = {
license = "see context related readme files"
}
-local utf = unicode.utf8
+-- todo: also use end_of_math here?
local next, type = next, type
local format, insert, sub, find, match = string.format, table.insert, string.sub, string.find, string.match
@@ -20,9 +20,6 @@ local trace_directions = false trackers.register("typesetters.directions", func
local report_directions = logs.reporter("typesetting","directions")
-local has_attribute = node.has_attribute
-local unset_attribute = node.unset_attribute
-local set_attribute = node.set_attribute
local traverse_id = node.traverse_id
local insert_node_before = node.insert_before
local insert_node_after = node.insert_after
@@ -170,6 +167,8 @@ end
-- todo: use new dir functions
+local s_isol = fonts.analyzers.states.isol
+
function directions.process(namespace,attribute,start) -- todo: make faster
if not start.next then
return start, false
@@ -182,7 +181,6 @@ function directions.process(namespace,attribute,start) -- todo: make faster
local lro, rlo, prevattr, inmath = false, false, 0, false
while current do
local id = current.id
---~ print(id,attribute,has_attribute(current,attribute))
if skipmath and id == math_code then
local subtype = current.subtype
if subtype == beginmath_code then
@@ -196,9 +194,9 @@ function directions.process(namespace,attribute,start) -- todo: make faster
elseif inmath then
current = current.next
else
- local attr = has_attribute(current,attribute)
+ local attr = current[attribute]
if attr and attr > 0 then
- -- unset_attribute(current,attribute) -- slow, needed?
+ -- current[attribute] = unsetvalue -- slow, needed?
if attr == 1 then
-- bidi parsing mode
elseif attr ~= prevattr then
@@ -242,7 +240,7 @@ function directions.process(namespace,attribute,start) -- todo: make faster
end
elseif lro or override < 0 then
if d == "r" or d == "al" then
- set_attribute(current,a_state,4) -- maybe better have a special bidi attr value -> override (9) -> todo
+ current[a_state] = s_isol -- maybe better have a special bidi attr value -> override (9) -> todo
if trace_directions then
list[#list+1] = format("char %s (%s / U+%04X) of class %s overidden to l (bidi=%s) (state=isol)",utfchar(char),char,char,d,attr)
end
@@ -276,7 +274,7 @@ function directions.process(namespace,attribute,start) -- todo: make faster
end
end
elseif d == "l" or d == "en" then -- european number
- if autodir <= 0 then
+ if autodir <= 0 then -- could be option
force_auto_left_before()
end
elseif d == "r" or d == "al" then -- arabic number
@@ -285,9 +283,11 @@ function directions.process(namespace,attribute,start) -- todo: make faster
end
elseif d == "an" then -- arabic number
-- actually this is language dependent ...
- if autodir <= 0 then
---~ force_auto_right_before()
- force_auto_left_before()
+-- if autodir <= 0 then
+-- force_auto_left_before()
+-- end
+ if autodir >= 0 then
+ force_auto_right_before()
end
elseif d == "lro" then -- Left-to-Right Override -> right becomes left
if trace_directions then
@@ -421,7 +421,7 @@ end
--~ if n then
--~ local id = n.id
--~ if id == glyph_code then
---~ local attr = has_attribute(n,attribute)
+--~ local attr = n[attribute]
--~ if attr and attr > 0 then
--~ local d = chardirs[n.char]
--~ if d == "r" or d == "al" then -- override