2012/9/12 Thomas Morley <[email protected]>: > Hi, > > please have a look at the fix for > http://lilypond.org/doc/v2.16/Documentation/snippets/text#text-center-text-below-hairpin-dynamics > imported from LSR: > http://lsr.dsi.unimi.it/LSR/Item?id=233 > making possible to add DynamicText to the NoteColumn where the Hairpin starts. > > Additionally I added two features: > The Hairpin is now aligned to the DynamicText and the additional text > switches the direction, if the Hairpin does it, too. > > If you think ist's ok, I'll change the LSR-snippet, downgrading it to > 2.14.2. (simply adding a single $-sign) > > > Because there is nothing wrong with lilypond, only the snippet should > be improved, Phil adviced me to post the fix here, offering a minimal > review possibility. > > If someone objects to such a minimal treatment, I'll take the Rietveld-route. > > The code, (added as attachment, too) > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > \version "2.16.0" > > hairpinWithCenteredText = > #(define-music-function (parser location text) (markup?) > #{ > \once \override Voice.Hairpin #'after-line-breaking = > #(lambda (grob) > (let* ((stencil (ly:hairpin::print grob)) > (par-y (ly:grob-parent grob Y)) > (dir (ly:grob-property par-y 'direction)) > (new-stencil (ly:stencil-aligned-to > (ly:stencil-combine-at-edge > (ly:stencil-aligned-to stencil X CENTER) > Y dir > (ly:stencil-aligned-to (grob-interpret-markup > grob text) X CENTER)) > X LEFT)) > (staff-space (ly:staff-symbol-staff-space grob)) > (staff-line-thickness (ly:staff-symbol-line-thickness grob)) > (grob-name (lambda (x) (assq-ref (ly:grob-property x > 'meta) 'name))) > (par-x (ly:grob-parent grob X)) > (dyn-text (eq? (grob-name par-x) 'DynamicText )) > (dyn-text-stencil-x-length (if dyn-text > (interval-length > (ly:stencil-extent (ly:grob-property par-x 'stencil) X)) > 0)) > (x-shift (if dyn-text (- (+ staff-space > dyn-text-stencil-x-length) (* 0.5 staff-line-thickness)) 0))) > > (ly:grob-set-property! grob 'Y-offset 0) > (ly:grob-set-property! grob 'stencil > (ly:stencil-translate-axis > new-stencil > x-shift X)))) > #}) > > hairpinMolto = > \hairpinWithCenteredText \markup { \italic molto } > > hairpinMore = > \hairpinWithCenteredText \markup { \larger moltissimo } > > \layout { ragged-right = ##f } > > \relative c' { > \hairpinMolto > c2\< c\f > \hairpinMore > c2\ppppp\< c\f > \break > \hairpinMolto > c2^\< c\f > \hairpinMore > c2\ppppp^\< c\f > } > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > -Harm
I take no reaction for no objection. http://lsr.dsi.unimi.it/LSR/Item?id=233 changed according to my proposal above. -Harm _______________________________________________ lilypond-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-devel
