2017-02-12 14:17 GMT+01:00 Thomas Morley <thomasmorle...@gmail.com>: > 2017-02-12 2:59 GMT+01:00 Andrew Bernard <andrew.bern...@gmail.com>: > >> Now I observe the same thing when simply changing staves, no cross staff >> stemming involved. Is this a bug, or am I using parenthesize incorrectly? >> The issue is that the parentheses do not enclose the accent properly. > > Hi Andrew, > > I did some research. > > The parantheses are printed with 'parentheses-item::print' for the > stencil. This procedure uses 'parenthesize-elements'. > In both procedures ly:relative-group-extent fails to return a sane > intervall, if \change Staff is in the game. > I don't no why this happens. > > Nevertheless, I tried the fix below getting every extent on his own > and reducing the results afterwards. > > There is some debugging-output returning the values for the proposed > fix and the original. > > Note: > - It is not tested beyond the given example > - skylining is still buggy (see the printed output for Fingering and > StringNumber) > > \version "2.19.54" > > #(ly:set-option 'debug-skylines #t) > > #(define (parenthesize-elements grob . rest) > (let* ((refp (if (null? rest) > grob > (car rest))) > (elts (ly:grob-array->list (ly:grob-object grob 'elements))) > (get-friends > (lambda (g) > (let ((syms (ly:grob-property g 'parenthesis-friends '())) > (get-friend > (lambda (s) > (let ((f (ly:grob-object g s))) > (cond > ((ly:grob? f) (list f)) > ((ly:grob-array? f) (ly:grob-array->list f)) > (else '())))))) > (append-map get-friend syms)))) > (friends (apply append elts (map get-friends elts))) > (common-ref > (ly:grob-common-refpoint grob (ly:grob-parent grob X) X)) > (x-exts > (map > (lambda (elt) > (ly:grob-robust-relative-extent elt common-ref X)) > friends)) > (x-ext > (cons > (reduce min +inf.0 (map car x-exts)) > (reduce max -inf.0 (map cdr x-exts)))) > (x-ext-source > (ly:relative-group-extent friends refp X)) > (stencils (ly:grob-property grob 'stencils)) > (lp (car stencils)) > (rp (cadr stencils)) > (padding (ly:grob-property grob 'padding 0.1))) > > (format > #t > "\n\nThe fix-attempt for 'parenthesize-elements' returns for x-ext: ~a" > x-ext) > (format > #t > "\nThe source-code for 'parenthesize-elements' returns for x-ext: ~a" > x-ext-source) > > (ly:stencil-add > (ly:stencil-translate-axis lp (- (car x-ext) padding) X) > (ly:stencil-translate-axis rp (+ (cdr x-ext) padding) X)))) > > #(define-public (parentheses-item::print me) > (let* ((elts (ly:grob-object me 'elements)) > (y-ref (ly:grob-common-refpoint-of-array me elts Y)) > (x-ref (ly:grob-common-refpoint-of-array me elts X)) > (stencil (parenthesize-elements me x-ref)) > (y-exts > (map > (lambda (elt) > (ly:grob-extent elt y-ref Y)) > (ly:grob-array->list elts))) > (elt-y-ext > (cons > (reduce min +inf.0 (map car y-exts)) > (reduce max -inf.0 (map cdr y-exts)))) > (elt-y-ext-source > (ly:relative-group-extent elts y-ref Y)) > (y-center (interval-center elt-y-ext))) > > (format > #t > "\nThe fix-attempt for 'parentheses-item::print' returns for elt-y-ext: ~a" > elt-y-ext) > (format > #t > "\nThe source-code for 'parentheses-item::print' returns for elt-y-ext: ~a" > elt-y-ext-source) > > (ly:stencil-translate > stencil > (cons > (- (ly:grob-relative-coordinate me x-ref X)) > (- y-center (ly:grob-relative-coordinate me y-ref Y)))))) > > treble = { > \clef treble > \time 1/4 > s4 > } > > bass = { > \clef bass > \time 1/4
%% To avoid: %% programming error: Grob direction requested while calculation in progress. %% put in here: \stemDown > > \override ParenthesesItem.stencil = #parentheses-item::print > > e'16 ^\parenthesize ^> ^\parenthesize ^1 ^\parenthesize ^\3 > \change Staff = treble %% And delete it here: % \stemDown > f' g' a' > } > > \score { > > \new PianoStaff > << > \new Staff = "treble" { \treble } > \new Staff = "bass" { \bass } > >> > > \layout { > } > } > > > HTH a bit, > Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user