diff options
author | Elie Roux <elie.roux@telecom-bretagne.eu> | 2009-04-23 15:22:25 +0200 |
---|---|---|
committer | Elie Roux <elie.roux@telecom-bretagne.eu> | 2009-04-23 15:22:25 +0200 |
commit | 190afdecb3f4d133e472fd17a140c57100219b7b (patch) | |
tree | c4dce7c6e609147c6709581bf52f6443b10b95ad /otfl-font-ota.lua | |
parent | fed311d67f0258a26530e04c43acf3d0261a25ce (diff) | |
download | luaotfload-190afdecb3f4d133e472fd17a140c57100219b7b.tar.gz |
sync with the latest ConTeXt beta, and using luaotfload in DVI mode too (for dvipdfmx)
Diffstat (limited to 'otfl-font-ota.lua')
-rw-r--r-- | otfl-font-ota.lua | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/otfl-font-ota.lua b/otfl-font-ota.lua index c6a5b29..72e7414 100644 --- a/otfl-font-ota.lua +++ b/otfl-font-ota.lua @@ -32,10 +32,14 @@ local glyph = node.id('glyph') local glue = node.id('glue') local penalty = node.id('penalty') -local set_attribute = node.set_attribute -local has_attribute = node.has_attribute -local traverse_id = node.traverse_id -local remove_node = nodes.remove +local set_attribute = node.set_attribute +local has_attribute = node.has_attribute +local traverse_id = node.traverse_id +local delete_node = nodes.delete +local replace_node = nodes.replace +local insert_node_after = node.insert_after +local insert_node_before = node.insert_before +local traverse_node_list = node.traverse local fontdata = fonts.ids local state = attributes.private('state') @@ -46,12 +50,6 @@ local fcr = (fonts.color and fonts.color.reset) or function() end local a_to_script = otf.a_to_script local a_to_language = otf.a_to_language -local remove_node = node.remove -local delete_node = nodes.delete -local insert_node_after = node.insert_after -local insert_node_before = node.insert_before -local traverse_node_list = node.traverse - -- in the future we will use language/script attributes instead of the -- font related value, but then we also need dynamic features which is -- somewhat slower; and .. we need a chain of them @@ -239,17 +237,23 @@ end function fonts.analyzers.methods.arab(head,font,attr) -- maybe make a special version with no trace local tfmdata = fontdata[font] ---~ local marks = tfmdata.shared.otfdata.luatex.marks local marks = tfmdata.marks local first, last, current, done = nil, nil, head, false - local removejoiners = otf.remove_joiners - local joiners = { } + local joiners, nonjoiners + local removejoiners = tfmdata.remove_joiners -- or otf.remove_joiners + if removejoiners then + joiners, nonjoiners = { }, { } + end while current do if current.id == glyph and current.subtype<256 and current.font == font and not has_attribute(current,state) then done = true local char = current.char - if removejoiners and char == zwj or char == zwnj then - joiners[#joiners+1] = current + if removejoiners then + if char == zwj then + joiners[#joiners+1] = current + elseif char == zwnj then + nonjoiners[#nonjoiners+1] = current + end end if marks[char] then set_attribute(current,state,5) -- mark @@ -298,8 +302,19 @@ function fonts.analyzers.methods.arab(head,font,attr) -- maybe make a special ve first, last = finish(first,last) if removejoiners then for i=1,#joiners do - head = delete_node(head,joiners[i]) -- was remove so no free + head = delete_node(head,joiners[i]) + end + for i=1,#nonjoiners do + head = replace_node(head,nonjoiners[i],nodes.glue(0)) -- or maybe a kern end end return head, done end + +table.insert(fonts.manipulators,"joiners") + +function fonts.initializers.node.otf.joiners(tfmdata,value) + if value == "strip" then + tfmdata.remove_joiners = true + end +end |