Hi David (N), Paul, 2012/12/13 Paul Morris <p...@paulwmorris.com>: > On Dec 12, 2012, at 7:24 PM, Thomas Morley <thomasmorle...@googlemail.com> > wrote: > >> Hi Paul, >> >> I had a look at the LSR-snippet >> http://lsr.dsi.unimi.it/LSR/Item?id=861 >> >> It's no problem to make it work with 2.14.2 just adding a $-sign >> before offsets in the music-function. >> >> But you will have noticed that after applying the function an >> additional override for 'stem-attachment is necessary in many cases. >> You should show how to do this. At least for some examples. >> >> In general I'd prefer to have a more automated way for offsetting the >> NoteHeads. >> The hardcoded value of 1.251178 will change for different NoteHeads and >> styles. >> >> I'll continue to think about it. ;) >> >> >> Regards, >> Harm > > > Hi Harm, > > Thanks for taking a look at it and for the tip on using a $-sign for 2.14.2. > I was also thinking about the best way to correct the 'stem-attachment > values. It would be nice if that could be automatic. > > I had emailed David Nalesnik to ask about posting his code to the LSR, and he > also had the concern about the hard-coded 1.251178. He sent me the following > which automatically calculates the offset amount based on the width of the > NoteHead, so I will update the snippet with this revision. > > #(define ((shift offsets) grob) > (let* ((note-heads (ly:grob-array->list (ly:grob-object grob 'note-heads))) > (stem (ly:grob-object grob 'stem)) > (stem-ext (ly:grob-property stem 'X-extent))) > (for-each > (lambda (p q) > (let ((head-ext (interval-length (ly:grob-property p 'X-extent)))) > (ly:grob-translate-axis! p (* q (- head-ext (cdr stem-ext))) X))) > note-heads offsets))) > > displaceHeads = > #(define-music-function (parser location offsets) (list?) > #{ > \once \override NoteColumn #'before-line-breaking = #(shift offsets) > #} > ) > > Regards, > -Paul
I've seen the updated version in the LSR already and tend to approve it as is. I doubt it could be possible to create an automatism for 'stem-attachment. I tried to break the code, though. And noticed that adding Fingering, StringNumber and Script will result in some strange not aligned output. Adding a stencil-tweak switches it to funny. ->png \version "2.16.1" % displaceHeads is omitted #(define rhomb-note (lambda (grob) (let* ((stencil (ly:note-head::print grob)) (new-stil (grob-interpret-markup grob (markup #:rotate -45 #:box #:rotate 45 #:stencil stencil)))) new-stil))) \relative c' { \displaceHeads #'(1 0 1 1) <\tweak #'stencil #rhomb-note b\1 cis-1\2 eis-2\3 gis-3\4 >4-.---| } It is much easier to break code than to create it. I should do more review-work. :D -Harm
<<attachment: atest-15.preview.png>>
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user