Thanks for another suggestion. I’m not so sure whether rotating the parentheses would improve the legibility or not, however. I understand that people have different preferences. What I had in mind was Vivaldi’s urtext edition published by Ricordi, in which the editorial slurs are enclosed by parentheses but the parentheses are not rotated.
Jun > 2020/09/12 21:27、Werner LEMBERG <w...@gnu.org>のメール: > > >>> Is there an easy way to have a slur enclosed by parentheses or >>> brackets? Some urtext editions use parenthesized slurs to indicate >>> editorial additions. >> >> \parenthesize does not currently handle spanners, so you would need to >> do some manual work. >> >> Consider: [...] > > Here is a slightly improved version with rotated parentheses. There's > certainly room for more improvements... > > > Werner > > ------------------------------------------------------------------------------- > > \version "2.20.0" > > parenthesizeSlur = > -\tweak stencil > #(lambda (grob) > (let* ((cp (ly:grob-property grob 'control-points)) > (lp (grob-interpret-markup grob (markup #:fontsize -7 "("))) > (rp (grob-interpret-markup grob (markup #:fontsize -7 ")"))) > (cp1 (first cp)) > (cp2 (second cp)) > (cpn-1 (list-ref cp (- (length cp) 2))) > (cpn (last cp)) > (langle (/ (atan (- (cdr cp2) (cdr cp1)) > (- (car cp2) (car cp1))) PI-OVER-180)) > (rangle (/ (atan (- (cdr cpn) (cdr cpn-1)) > (- (car cpn) (car cpn-1))) PI-OVER-180))) > > (set! lp (ly:stencil-aligned-to lp Y CENTER)) > (set! lp (ly:stencil-aligned-to lp X 0.5)) > (set! lp (ly:stencil-translate lp (first cp))) > > (set! rp (ly:stencil-aligned-to rp Y CENTER)) > (set! rp (ly:stencil-aligned-to rp X -0.5)) > (set! rp (ly:stencil-translate rp cpn)) > > (list-set! cp 0 > (cons (cdr (ly:stencil-extent lp X)) > (cdr cp1))) > (set! lp (ly:stencil-rotate lp langle 0 0)) > (list-set! cp (1- (length cp)) > (cons (car (ly:stencil-extent rp X)) > (cdr cpn))) > (set! rp (ly:stencil-rotate rp rangle 0 0)) > (ly:grob-set-property! grob 'control-points cp) > > (apply ly:stencil-add (list lp rp > (ly:slur::print grob))))) > \etc > > { g'4\parenthesizeSlur ( > \parenthesizeSlur \( b' c''2 ) | > g'2\parenthesizeSlur ( f'4 e' ) \) } > <parenslur.png>