diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/typo-dir.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/typo-dir.lua | 26 |
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 |