[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Ottava printing at beginning of system
From: |
Thomas Morley |
Subject: |
Re: Ottava printing at beginning of system |
Date: |
Tue, 30 Nov 2021 00:16:22 +0100 |
Am Mo., 29. Nov. 2021 um 22:49 Uhr schrieb Valentin Petzel <valentin@petzel.at>:
>
> Basically grob.after-line-breaking is a function that get’s called on grob
> after line breaks are determined and allows us to do tweaks related to line-
> breaking. So what this function does is:
>
> If the ottava bracket is broken we check if the grob is a broken part. This is
> done by getting all broken parts (the siblings) and checking if grob is the
> first of these (implying that it is the first part which we do not want to
> change) or not (in which case it is a broken part which we want to change).
>
> Then we we remove the text from these broken properties and recalculate the
> stencil (which will then be without text).
>
> Cheers,
> Valentin
Well, actually you set 'stencil for the _first_ of siblings.
Simply delete that:
#(define (my-callback grob)
(let* (
; have we been split?
(orig (ly:grob-original grob))
; if yes, get the split pieces (our siblings)
(siblings (if (ly:grob? orig)
(ly:spanner-broken-into orig) '() )))
(if (and (>= (length siblings) 2)
(not (eq? (car siblings) grob)))
(ly:grob-set-property! grob 'text #f))))
Furthermore, I think ly:grob-original will always return a grob, thus
the check for it could be removed.
Probably a different if-condition may be cheaper (not sure about it,
though), making for:
#(define (my-callback grob)
(let* ((orig (ly:grob-original grob))
(siblings (ly:spanner-broken-into orig)))
(if (and (pair? siblings) (member grob (cdr siblings)))
(ly:grob-set-property! grob 'text #f))))
Cheers,
Harm