# [luatex] linebreak_filter example implementation

Élie Roux elie.roux at telecom-bretagne.eu
Tue Jun 11 11:42:57 CEST 2013

> 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>}
>
>      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... ;)

Thank you very much,
--
Elie