From e41d9b25d1b44b28206a44d6baf3635b014f3d87 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 8 Dec 2020 19:15:53 +0100 Subject: 2020-12-08 18:43:00 --- .../documents/general/manuals/luametatex.pdf | Bin 1283942 -> 1289756 bytes .../manuals/luametatex/luametatex-callbacks.tex | 10 +-- .../manuals/luametatex/luametatex-nodes.tex | 97 +++++++++++++++++++-- .../general/manuals/luametatex/luametatex.tex | 5 ++ 4 files changed, 102 insertions(+), 10 deletions(-) (limited to 'doc') diff --git a/doc/context/documents/general/manuals/luametatex.pdf b/doc/context/documents/general/manuals/luametatex.pdf index 6d7e0b892..662012f6b 100644 Binary files a/doc/context/documents/general/manuals/luametatex.pdf and b/doc/context/documents/general/manuals/luametatex.pdf differ diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-callbacks.tex b/doc/context/sources/general/manuals/luametatex/luametatex-callbacks.tex index 4c8a0db78..d8e98efa2 100644 --- a/doc/context/sources/general/manuals/luametatex/luametatex-callbacks.tex +++ b/doc/context/sources/general/manuals/luametatex/luametatex-callbacks.tex @@ -251,7 +251,7 @@ into a stack of \prm {hbox}es, after the addition of \prm {parfillskip}. \startfunctioncall function( head, groupcode) - return true | false | newhead + return newhead end \stopfunctioncall @@ -353,7 +353,7 @@ stack of \prm {hbox}es. \startfunctioncall function( head, groupcode) - return true | false | newhead + return newhead end \stopfunctioncall @@ -369,7 +369,7 @@ material. Math items and line boxes are ignored at the moment. \startfunctioncall function( head, groupcode, size, packtype [, direction] [, attributelist]) - return true | false | newhead + return newhead end \stopfunctioncall @@ -397,7 +397,7 @@ that it is called at different moments, there is an extra variable that matches \startfunctioncall function( head, groupcode, size, packtype, maxdepth [, direction] [, attributelist])) - return true | false | newhead + return newhead end \stopfunctioncall @@ -462,7 +462,7 @@ This callback is called when \TEX\ is ready to start boxing the box 255 for \prm \startfunctioncall function( head, groupcode, size, packtype, maxdepth [, direction]) - return true | false | newhead + return newhead end \stopfunctioncall diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex b/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex index d56d85ceb..3c9041e8d 100644 --- a/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex +++ b/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex @@ -1383,16 +1383,18 @@ The \type{traverse_char} iterator loops over the \nod {glyph} nodes in a list. Only nodes with a subtype less than 256 are seen. \startfunctioncall - n, font, char = node.traverse_char( n) + n, font, char = node.direct.traverse_char( n) \stopfunctioncall The \type{traverse_glyph} iterator loops over a list and returns the list and filters all glyphs: \startfunctioncall - n, font, char = node.traverse_glyph( n) + n, font, char = node.traverse_glyph( n) \stopfunctioncall +These functions are only available for direct nodes. + \stopsubsubsection \startsubsubsection[title={\type {traverse_list}}] @@ -1402,15 +1404,100 @@ filters all glyphs: This iterator loops over the \nod {hlist} and \nod {vlist} nodes in a list. \startfunctioncall - n, id, subtype, list = node.traverse_list( n) + n, id, subtype, list = node.traverse_list( n) +\stopfunctioncall + +The four return values can save some time compared to fetching these fields but +in practice you seldom need them all. This function is only available for direct +nodes. + +\stopsubsubsection + +\startsubsubsection[title={\type {traverse_content}}] + +\libindex {traverse_content} + +This iterator loops over nodes that have content: \nod {hlist}, \nod {vlist}, \nod {glue} +with leaders, \nod {glyphs}, \nod {disc} and \nod {rules} nodes. + +\startfunctioncall + n, id, subtype[, list|leader] = node.traverse_list( n) \stopfunctioncall The four return values can save some time compared to fetching these fields but -in practice you seldom need them all. So consider it a (side effect of -experimental) convenience. +in practice you seldom need them all. This function is only available for direct +nodes. \stopsubsubsection +\startsubsubsection[title={Reverse traversing}] + +The traversers also support backward traversal. An optional extra boolean triggers +this. Yet another optional boolean will automatically start at the end of the +given list. + +\starttyping +\setbox0\hbox{1 2 3 4 5} + +local l = tex.box[0].list +for n in node.traverse(l) do + print("1>",n) +end +for n in node.traverse(l,true) do + print("2>",n) +end +for n in node.traverse(l,true,true) do + print("3>",n) +end +for n in node.traverse_id(nodes.nodecodes.glyph,l) do + print("4>",n) +end +for n in node.traverse_id(nodes.nodecodes.glyph,l,true) do + print("5>",n) +end +for n in node.traverse_id(nodes.nodecodes.glyph,l,true,true) do + print("6>",n) +end +\stoptyping + +This produces something similar to this (the glyph subtype indicates that it has +been processed by the font handlers): + +\starttyping +1> 590 : glyph 32768> +1> 1120 : glue spaceskip> +1> 849 : glyph 32768> +1> 1128 : glue spaceskip> +1> 880 : glyph 32768> +1> 1136 : glue spaceskip> +1> 1020 : glyph 32768> +1> 1144 : glue spaceskip> +1> nil : glyph 32768> +2> 590 : glyph 32768> +3> nil : glyph 32768> +3> 1144 : glue spaceskip> +3> 1020 : glyph 32768> +3> 1136 : glue spaceskip> +3> 880 : glyph 32768> +3> 1128 : glue spaceskip> +3> 849 : glyph 32768> +3> 1120 : glue spaceskip> +3> 590 : glyph 32768> +4> 590 : glyph 32768> +4> 849 : glyph 32768> +4> 880 : glyph 32768> +4> 1020 : glyph 32768> +4> nil : glyph 32768> +5> 590 : glyph 32768> +6> nil : glyph 32768> +6> 1020 : glyph 32768> +6> 880 : glyph 32768> +6> 849 : glyph 32768> +6> 590 : glyph 32768> +\stoptyping + +\stopsubsection + \startsubsubsection[title={\type {find_node}}] \libindex {find_node} diff --git a/doc/context/sources/general/manuals/luametatex/luametatex.tex b/doc/context/sources/general/manuals/luametatex/luametatex.tex index 77cf98019..b2de45ae2 100644 --- a/doc/context/sources/general/manuals/luametatex/luametatex.tex +++ b/doc/context/sources/general/manuals/luametatex/luametatex.tex @@ -41,6 +41,9 @@ % 20201204 : 260 pages % mingw all in: 10.0 +% 20201204 : 262 pages +% mingw all in: 9.9 + % 20200720 : 258 pages / all in % % mingw : 10.6 (sometimes less) @@ -68,6 +71,8 @@ % Thanks to sebastian.miele@gmail.com for close reading the manual and sending % fixes. +% \listcallbackmode0 + \pushoverloadmode \unprotect % test code \protect \popoverloadmode -- cgit v1.2.3