diff options
Diffstat (limited to 'tex/context/base/font-ota.lua')
-rw-r--r-- | tex/context/base/font-ota.lua | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/tex/context/base/font-ota.lua b/tex/context/base/font-ota.lua index 0e5b55542..0ec7bac73 100644 --- a/tex/context/base/font-ota.lua +++ b/tex/context/base/font-ota.lua @@ -17,34 +17,37 @@ local trace_cjk = false trackers.register("cjk.injections", function(v) t trackers.register("cjk.analyzing","otf.analyzing") -fonts = fonts or { } -fonts.analyzers = fonts.analyzers or { } -fonts.analyzers.initializers = fonts.analyzers.initializers or { node = { otf = { } } } -fonts.analyzers.methods = fonts.analyzers.methods or { node = { otf = { } } } +local fonts, nodes = fonts, nodes +local node = node local otf = fonts.otf local tfm = fonts.tfm -local initializers = fonts.analyzers.initializers -local methods = fonts.analyzers.methods +fonts.analyzers = fonts.analyzers or { } +local analyzers = fonts.analyzers -local glyph = node.id('glyph') -local glue = node.id('glue') -local penalty = node.id('penalty') +analyzers.initializers = analyzers.initializers or { node = { otf = { } } } +analyzers.methods = analyzers.methods or { node = { otf = { } } } + +local initializers = analyzers.initializers +local methods = analyzers.methods + +local nodecodes = nodes.nodecodes +local glyph_code = nodecodes.glyph local set_attribute = node.set_attribute local has_attribute = node.has_attribute local traverse_id = node.traverse_id local traverse_node_list = node.traverse -local fontdata = fonts.ids -local state = attributes.private('state') +local fontdata = fonts.ids +local state = attributes.private('state') -local fcs = (fonts.color and fonts.color.set) or function() end -local fcr = (fonts.color and fonts.color.reset) or function() end +local fcs = (fonts.color and fonts.color.set) or function() end +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 a_to_script = otf.a_to_script +local a_to_language = otf.a_to_language -- in the future we will use language/script attributes instead of the -- font related value, but then we also need dynamic features which is @@ -98,7 +101,7 @@ table.insert(fonts.triggers,"analyze") -- we need a proper function for doing t -- latin -fonts.analyzers.methods.latn = fonts.analyzers.aux.setstate +analyzers.methods.latn = analyzers.aux.setstate -- this info eventually will go into char-def @@ -180,8 +183,8 @@ local function warning(current,what) end end -function fonts.analyzers.methods.nocolor(head,font,attr) - for n in traverse_node_list(head,glyph) do +function analyzers.methods.nocolor(head,font,attr) + for n in traverse_id(glyph_code,head) do if not font or n.font == font then fcr(n) end @@ -230,12 +233,12 @@ local function finish(first,last) return first, last end -function fonts.analyzers.methods.arab(head,font,attr) -- maybe make a special version with no trace +function analyzers.methods.arab(head,font,attr) -- maybe make a special version with no trace local tfmdata = fontdata[font] local marks = tfmdata.marks local first, last, current, done = nil, nil, head, false while current do - if current.id == glyph and current.subtype<256 and current.font == font and not has_attribute(current,state) then + if current.id == glyph_code and current.subtype<256 and current.font == font and not has_attribute(current,state) then done = true local char = current.char if marks[char] then |