diff options
Diffstat (limited to 'tex/context/base/trac-par.lua')
-rw-r--r-- | tex/context/base/trac-par.lua | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/tex/context/base/trac-par.lua b/tex/context/base/trac-par.lua index 262a9cc33..aab57ce5c 100644 --- a/tex/context/base/trac-par.lua +++ b/tex/context/base/trac-par.lua @@ -1,8 +1,25 @@ --- for the moment here: +if not modules then modules = { } end modules ['trac-par'] = { + version = 1.001, + comment = "companion to node-par.mkiv", + author = "Hans Hagen", + copyright = "ConTeXt Development Team", + license = "see context related readme files", + comment = "a translation of the built in parbuilder, initial convertsin by Taco Hoekwater", +} local utfchar = utf.char local concat = table.concat +local nuts = nodes.nuts +local tonut = nuts.tonut + +local getfield = nuts.getfield +local getid = nuts.getid +local getnext = nuts.getnext +local getlist = nuts.getlist +local getfont = nuts.getfont +local getchar = nuts.getchar + local nodecodes = nodes.nodecodes local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist @@ -42,14 +59,14 @@ local function colorize(n) -- tricky: the built-in method creates dummy fonts and the last line normally has the -- original font and that one then has ex.auto set while n do - local id = n.id + local id = getid(n) if id == glyph_code then - local ne = n.expansion_factor + local ne = getfield(n,"expansion_factor") if ne == 0 then if length > 0 then flush() end setnodecolor(n,"hz:zero") else - local f = n.font + local f = getfont(n) if f ~= font then if length > 0 then flush() @@ -79,8 +96,8 @@ local function colorize(n) end if trace_verbose then length = length + 1 - list[length] = utfchar(n.char) - width = width + n.width -- no kerning yet + list[length] = utfchar(getchar(n)) + width = width + getfield(n,"width") -- no kerning yet end end end @@ -88,13 +105,13 @@ local function colorize(n) if length > 0 then flush() end - colorize(n.list,flush) + colorize(getlist(n),flush) else -- nothing to show on kerns if length > 0 then flush() end end - n = n.next + n = getnext(n) end if length > 0 then flush() @@ -104,14 +121,14 @@ end builders.paragraphs.expansion = builders.paragraphs.expansion or { } function builders.paragraphs.expansion.trace(head) - colorize(head,true) + colorize(tonut(head),true) return head end local tasks = nodes.tasks -tasks.prependaction("shipouts","normalizers","builders.paragraphs.expansion.trace") -tasks.disableaction("shipouts","builders.paragraphs.expansion.trace") +-- tasks.prependaction("shipouts","normalizers","builders.paragraphs.expansion.trace") +-- tasks.disableaction("shipouts","builders.paragraphs.expansion.trace") local function set(v) if v then |