\version "2.19.8" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% DIAGONAL-STROKE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% taken from: %% http://lilypond.org/doc/v2.18/Documentation/music-glossary/functional-harmony #(define-markup-command (diagonal-stroke layout props arg) (markup?) #:category font #:properties ((font-size 0) (thickness 1.5) (extension 0.07)) " Draw a diagonal stroke through @var{arg} arg. " (let* ((thick (* (magstep font-size) (ly:output-def-lookup layout 'line-thickness))) (underline-thick (* thickness thick)) (markup (interpret-markup layout props arg)) (x1 (car (ly:stencil-extent markup X))) (x2 (cdr (ly:stencil-extent markup X))) (y1 (car (ly:stencil-extent markup Y))) (y2 (cdr (ly:stencil-extent markup Y))) (dx (* extension (- x2 x1))) (dy (* extension (- y2 y1))) (line (make-line-stencil underline-thick (- x1 dx) (- y1 dy) (+ x2 dx) (+ y2 dy)))) (ly:stencil-add markup line))) stroke = #(define-scheme-function (parser location color x-ext y-ext) ((symbol? #f) pair? pair?) " Returns a diagonal stroke. For use with @code{\\mark} " #{ \markup { \null \with-dimensions #empty-interval #empty-interval \with-color #(x11-color color) \diagonal-stroke \with-dimensions #x-ext #y-ext \null } #}) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% BRACKETS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % after: http://lsr.di.unimi.it/LSR/Item?id=377 #(define-markup-command (square-bracket layout props dir) (number?) #:properties ((up 0) (down 0) (color #f)) " Draw a square-bracket. The vertical extension may be adjusted by overriding @var{up} and/or @var{down} " (let* ((th 0.2) (width (* 2.5 dir th)) (ext (cons (+ -2.8 down) (+ 2.8 up)))) (stencil-with-color (ly:bracket Y ext th width) (x11-color color)))) leftBracket = { \once\override BreathingSign.text = \markup \with-dimensions #'(0 . 0 ) #'(0 . 0) \override #'(color . grey) \override #'(down . -18) \square-bracket #1 \once\override BreathingSign.break-visibility = #end-of-line-invisible \once\override BreathingSign.Y-offset = ##f \once\override Score.Clef.space-alist.breathing-sign = #'(extra-space . 1.0) \once\override Score.KeyCancellation.space-alist.breathing-sign = #'(extra-space . 1.0) \once\override Score.KeySignature.space-alist.breathing-sign = #'(extra-space . 1.0) \once\override Score.TimeSignature.space-alist.breathing-sign = #'(extra-space . 1.0) \once\override Score.BarLine.space-alist.breathing-sign = #'(extra-space . 1.0) %% rearrange the order items \once \override Score.BreakAlignment #'break-align-orders = ##( (left-edge cue-end-clef ambitus breathing-sign clef cue-clef staff-bar key-cancellation key-signature time-signature custos) (left-edge cue-end-clef ambitus breathing-sign clef cue-clef staff-bar key-cancellation key-signature time-signature custos) (left-edge ambitus clef key-cancellation key-signature time-signature staff-bar cue-clef custos breathing-sign)) \breathe } rightBracket = { \once\override BreathingSign.text = \markup \with-dimensions #'(0 . 0 ) #'(0 . 0) \override #'(down . -18) \square-bracket #-1 \once\override BreathingSign.Y-offset = ##f \breathe } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% FONT-SIZE AND COLOR %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % after: http://lsr.di.unimi.it/LSR/Item?id=889 mapList = #(define-music-function (parser location fun lst) (ly:music-function? list?) " Apply @var{fun}, which is supposed to be a music-function to all elements of @var{lst} " #{ $@(map (lambda (s) #{ $fun $s #}) lst) #}) foo = #(define-music-function (parser location item) (symbol-list-or-music?) ;; TODO: make the color variable #{ \tweak font-size #-3 #item \tweak color #grey #item #}) revfoo= #(define-music-function (parser location item) (symbol-list-or-music?) #{ \tweak font-size ##f #item \tweak color ##f #item #}) grey-tiny-grobs = #(define-music-function (parser location music)(ly:music?) " Return music with smaller font-size and colored grey. Note: some grobs can't be colored this way, p.e. @code{RehearsalMark} " #{ \mapList #foo #(map car all-grob-descriptions) $music \mapList #revfoo #(map car all-grob-descriptions) #}) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% EXAMPLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \new StaffGroup << \new Staff \relative c' { c1 \leftBracket \grey-tiny-grobs { %% If there is a RehearsalMark already, use \markup instead, with %% slightly different values %% %% you'll have to manually insert the values, %% the color-argument is optional \mark \stroke #'grey #'(4 . 46) #'(-22 . 2) d8 ^\markup \with-dimensions #empty-interval #empty-interval "grobs, stroke, bracket are colored grey" d2.. \break \mark \stroke #'(4 . 43) #'(-22 . 2) e1 ^\markup \with-color #black \with-dimensions #empty-interval #empty-interval "stroke and bracket have default color" } \rightBracket f } \new Staff \relative c' { c \grey-tiny-grobs { d e } f } \new Staff \relative c' { c \grey-tiny-grobs { d e } f } >>