Élie Roux <[email protected]> a écrit: > > Well, modifying linebreak_filter would be a good idea indeed :) > > > > Otherwise, you could put the clef in a \cleaders: > > > > \newbox\clefbox > > \setbox\clefbox=\hbox{<clef>} > > \def\clef{\cleaders\copy\clefbox\hskip\wd\clefbox} > > > > note ... note ... \clef ... note ... note > > > > then it will automatically disappear at the beginning of a line. Of > > course the above code is cumbersome, all the more as<clef> won’t > > interact with surrounding glyphs if that must happen (e.g. spacing). > > > > So you could use the symbol as usual, and then in pre_linebreak_filter > > (i.e. after kerning, ligaturing, etc., have occurred, i.e. after the > > glyph has been processed) turn the sublist made of that glyph and > > associated material into an hlist, and create a leader node pointing > > to it (really, a glue with a “leader” field pointing to the created > > box). > > > > I guess it’ll work, and it’s much simpler than tinkering with the > > algorithm (all the more as the Lua version is much slower than the TeX > > version, if I remember correctly a recent paper by Hans). > > Hmmm, this opens some interesting perspectives! I have to say I would > *never* have thought to something like this... I've never used cleaders > but I'll learn... > > If between two book readings you ever have a little time to help... ;)
See attached file, which still requires some work: - Basic optimization (local’s, etc.); the leaders nodes could be created beforehand (one for each key) and reused with “node.copy()”. - Populate the “clefs” table. - Define the “getnodes()” function properly (I don’t know what nodes are associated with a clef, so I couldn’t do that for you). - Replace the “callback.register()” call with whatever you use. As a quick test, you can: - Add “[65] = true” to the “clefs”. - Run it on some text with interspersed A’s and a small \hsize. - You’ll see the A’s disappear at linebreaks. Wow. > Thank you very much, Welcome. After all, you’re the one who converted me to LuaTeX :) Best, Paul
test.lua
Description: Binary data
