diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2014-05-03 13:55:34 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2014-05-03 13:55:34 +0200 |
commit | 624cbb5da392e9403984dd1cf368c0d408b1c2a8 (patch) | |
tree | 489c049ac849bb5bbce7d32e4df477872c58373d /tex/context/base/node-typ.lua | |
parent | 088de88944c1f2254250bb448c7371a87ff7ee39 (diff) | |
download | context-624cbb5da392e9403984dd1cf368c0d408b1c2a8.tar.gz |
2014-01-03 00:42:00
Diffstat (limited to 'tex/context/base/node-typ.lua')
-rw-r--r-- | tex/context/base/node-typ.lua | 71 |
1 files changed, 21 insertions, 50 deletions
diff --git a/tex/context/base/node-typ.lua b/tex/context/base/node-typ.lua index 4c33e3199..4a2ef8d49 100644 --- a/tex/context/base/node-typ.lua +++ b/tex/context/base/node-typ.lua @@ -8,38 +8,26 @@ if not modules then modules = { } end modules ['node-typ'] = { -- code has been moved to blob-ini.lua -local typesetters = nodes.typesetters or { } -nodes.typesetters = typesetters +local typesetters = nodes.typesetters or { } +nodes.typesetters = typesetters -local nuts = nodes.nuts -local tonode = nuts.tonode -local tonut = nuts.tonut +local hpack_node_list = nodes.hpack +local vpack_node_list = nodes.vpack +local fast_hpack_list = nodes.fasthpack -local setfield = nuts.setfield -local getfont = nuts.getfont - -local hpack_node_list = nuts.hpack -local vpack_node_list = nuts.vpack -local fast_hpack_list = nuts.fasthpack -local copy_node = nuts.copy - -local nodepool = nuts.pool +local nodepool = nodes.pool local new_glyph = nodepool.glyph local new_glue = nodepool.glue local utfvalues = utf.values -local currentfont = font.current -local fontparameters = fonts.hashes.parameters +local currentfont = font.current +local fontparameters = fonts.hashes.parameters -local function tonodes(str,fontid,spacing,templateglyph) -- quick and dirty +local function tonodes(str,fontid,spacing) -- quick and dirty local head, prev = nil, nil if not fontid then - if templateglyph then - fontid = getfont(templateglyph) - else - fontid = currentfont() - end + fontid = currentfont() end local fp = fontparameters[fontid] local s, p, m @@ -56,10 +44,6 @@ local function tonodes(str,fontid,spacing,templateglyph) -- quick and dirty next = new_glue(s,p,m) spacedone = true end - elseif templateglyph then - next = copy_glyph(templateglyph) - setfield(next,"char",c) - spacedone = false else next = new_glyph(fontid or 1,c) spacedone = false @@ -69,8 +53,8 @@ local function tonodes(str,fontid,spacing,templateglyph) -- quick and dirty elseif not head then head = next else - setfield(prev,"next",next) - setfield(next,"prev",prev) + prev.next = next + next.prev = prev end prev = next end @@ -93,30 +77,17 @@ end local tovpackfast = tovpack -local tnuts = { } -nuts.typesetters = tnuts - -tnuts.tonodes = tonodes -tnuts.tohpack = tohpack -tnuts.tohpackfast = tohpackfast -tnuts.tovpack = tovpack -tnuts.tovpackfast = tovpackfast - -tnuts.hpack = tohpack -- obsolete -tnuts.fast_hpack = tohpackfast -- obsolete -tnuts.vpack = tovpack -- obsolete - -typesetters.tonodes = function(...) local h, b = tonodes (...) return tonode(h), b end -typesetters.tohpack = function(...) local h, b = tohpack (...) return tonode(h), b end -typesetters.tohpackfast = function(...) local h, b = tohpackfast(...) return tonode(h), b end -typesetters.tovpack = function(...) local h, b = tovpack (...) return tonode(h), b end -typesetters.tovpackfast = function(...) local h, b = tovpackfast(...) return tonode(h), b end +typesetters.tonodes = tonodes +typesetters.tohpack = tohpack +typesetters.tohpackfast = tohpackfast +typesetters.tovpack = tovpack +typesetters.tovpackfast = tovpackfast -typesetters.hpack = typesetters.tohpack -- obsolete -typesetters.fast_hpack = typesetters.tofasthpack -- obsolete -typesetters.vpack = typesetters.tovpack -- obsolete +typesetters.hpack = tohpack +typesetters.fast_hpack = tohpackfast +typesetters.vpack = tovpack -- node.write(nodes.typestters.hpack("Hello World!")) -- node.write(nodes.typestters.hpack("Hello World!",1,100*1024*10)) -string.tonodes = function(...) return tonode(tonodes(...)) end -- quite convenient +string.tonodes = tonodes -- quite convenient |