Hi Harm, On Thu, Sep 1, 2011 at 2:30 PM, harm6 <thomasmorle...@googlemail.com> wrote:
> > Hi David, > > don't know anything about the error: > > ERROR: In procedure ly:grob-object: > ERROR: Wrong type argument in position 1 (expecting Grob): () > > This error-warning must be an error! :) > My only guess is that the property I'm calling on to locate everything on a line isn't set until a later stage in the layout process, after X-offsets have been considered. > How about: > > \version "2.14.2" > > #(define (bounding-coords grob-coord bar-coords end-coord) > (if (null? (cdr bar-coords)) > (cons (car bar-coords) end-coord) > (if (and (< (car bar-coords) grob-coord) > (> (cadr bar-coords) grob-coord)) > (cons (car bar-coords)(cadr bar-coords)) > (bounding-coords grob-coord (cdr bar-coords) end-coord)))) > > #(define (center-on-measure grob) > (let* ((sys (ly:grob-system grob)) > (array (ly:grob-object sys 'all-elements)) > (grob-coord (interval-center (ly:grob-extent grob sys X))) > (grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta) > 'name))) > (bars (filter (lambda (x) (eq? 'NonMusicalPaperColumn (grob-name > x))) > (ly:grob-array->list array))) > (bar-coords (sort (map (lambda (x) (interval-center > (ly:grob-extent x sys X))) bars) <)) > (bounds (bounding-coords grob-coord bar-coords (cdr > (ly:grob-extent sys sys X))))) > > (ly:grob-translate-axis! grob (- (- grob-coord (/ (+ (car bounds) (cdr > bounds)) 2))) X) > )) > > { > \override TextScript #'after-line-breaking = #center-on-measure > \repeat unfold 10 { s1_"|"^"|" } > s2_"|"^"|" > } > I like this variation, because after using it I can still tweak the position of the text with an override of 'extra-offset. For reasons I don't understand, though, overrides of 'Y-offset have no effect after your function is called (they do in the version I posted). (Overrides of 'padding work in either case.) Thank you for your ideas! David >
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user