This is what I came up with. It's kind of hacky, I would love to know a
more straightforward way. Basically, I deleted the stencil of the
Accidentals so that the Ties do not detect collisions with them, and I
"post processed" them in again after the Ties have been positioned. A
little scaling and some extra-offsets later this is the result:

> \version "2.19.80"\language "english"
> \relative c'' {
>   <as~ fs~> <cs as fs cs>}
> accidentalTrick =
> #(define-music-function (y-offsets) (list?)
>    #{ \override NoteColumn.before-line-breaking =
>       #(lambda (note-column)
>          (let* ((noteheads (ly:grob-array->list (ly:grob-object note-column 
> 'note-heads)))
>                 (accidentals (filter ly:grob? (map
>                               (lambda (notehead)
>                                 (ly:grob-object notehead 'accidental-grob))
>                               noteheads)))
>                 (accidentals-length (length accidentals))
>                 (y-offsets-length (length y-offsets)))
>            (if (not (= accidentals-length y-offsets-length))
>                (ly:warning (format "\\accidentalTrick warning: NoteColumn has 
> ~a accidentals, given list of y-offsets has ~a\n" accidentals-length 
> y-offsets-length))
>                (for-each
>                 (lambda (accidental y-offset)
>                   (let* ((orig-stil (ly:grob-property accidental 'stencil))
>                          (scld-stil (ly:stencil-scale orig-stil 1 0.9)))
>                     (ly:grob-set-property! accidental 'stencil #f)
>                     (ly:grob-set-property! accidental 'after-line-breaking
>                       (lambda (grob)
>                         (ly:grob-set-property! grob 'stencil scld-stil)
>                         (ly:grob-set-property! grob 'extra-offset `(-1.6 . 
> ,y-offset))))))
>                 accidentals
>                 y-offsets)))) #} )
> \relative c'' {
>   \override Tie.minimum-length = 4
>   \override TieColumn.tie-configuration = #`((-3 . ,DOWN) (-1.05 . ,DOWN))
>   \override Tie.details.height-limit = 0.4
>   <as fs>~ \accidentalTrick #'(0.3 -0.25) <cs as fs cs>}
>
>
Comments and/or different approaches are, as always, greatly appreciated!

2018-02-27 13:58 GMT-03:00 Stefano Troncaro <[email protected]>:

> Hello everyone!
>
> I was wondering about how do you usually solve situations like the
> following, where you have ties to chords and the accidentals cause the ties
> to be too short (sometimes almost invisible).
>
> \version "2.19.80"\language "english"
>> %What tweaks do you apply to this situations?\relative c'' {
>>   <as fs>~ <cs as fs cs>}
>> %I tried this but the accidentals prevent the ties from reaching the 
>> noteheads\relative c'' {
>>   \override TieColumn.tie-configuration = #`((-1 . ,DOWN) (-3 . ,DOWN))
>>   \override Tie.minimum-length = #4
>>   <as fs>~ <cs as fs cs>}
>>
>>
> Maybe one way would be to make it so that ties do not calculate collisions
> with accidentals? Or making the accidentals smaller? The latter I imagine
> you would do by overriding the stencil, the former I have no idea how to do.
>
> I welcome any insight in how to deal with these situations. Thank you in
> advance!
> Stéfano
>
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to