lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Align bracket not to notes but to enclosing bars


From: Urs Liska
Subject: Align bracket not to notes but to enclosing bars
Date: Mon, 4 Feb 2019 13:11:37 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

I have created a command that uses \startGroup and \stopGroup to print annotated horizontal brackets:

% Create a horizontal bracket with included text.
% If no text is desired an empty string has to be given.
% By default the bracket is above the staff, otherwise
% #DOWN has to be given as optional argument.

\layout {
  \context {
    \Voice
    \consists "Horizontal_bracket_engraver"
    \override HorizontalBracket.bracket-flare = #'(0 . 0)
    \override HorizontalBracket.staff-padding = 4.5
  }
}

startBracket =
#(define-event-function (direction text)((ly:dir? UP) markup?)
   #{
     -\tweak HorizontalBracketText.text #text
     -\tweak HorizontalBracketText.direction #(* -1 direction)
     -\tweak HorizontalBracketText.Y-offset #(if (= direction UP) -2.5 1)
     -\tweak direction #direction
     \startGroup
   #})

stopBracket = \stopGroup

\relative {
  g'4 g e d
  c \startBracket "Hello" d e f |
  g1 \stopBracket
}

(results attached as document.png).

However, in addition to that I need a way to align the start and end of that bracket not to the notes like in the example but to the enclosing measures, and optionally the whole staffline.

Is there any reasonable approach to doing that short of custom-printing a stencil by searching the current staff to find the neighbouring barlines (it is guaranteed that there are no line breaks)? The only advantage of going that way would be to have more control over how it actually looks like ...

Thanks for any pointers
Urs

Attachment: document.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]