lilypond-user
[Top][All Lists]
Advanced

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

Re: Barline at beginning of lines of music.


From: Thomas Morley
Subject: Re: Barline at beginning of lines of music.
Date: Wed, 16 Jul 2014 11:19:00 +0200

2014-07-14 20:21 GMT+02:00 James <address@hidden>:
>
> Well I'm still no clearer from this thread if we do or do not need a doc
> improvement.
>
> If so could someone create a tracker issue or give me something I can use
> (or tell me the doc is OK and nothing needs improving).


Well, it seems to be obvious the docs need some improvements.
Though, I'm not sure how and where.

For now I wrote a little tutorial how to create new bar-lines from scratch.
Maybe it could find it's place in a new section of the extending manual.
What do others think?

% TUTORIAL: define new bar-lines from scratch

\version "2.19.8"

%{
To create a new Barline from scratch, you need to define
(1) a procedure which returns how the new bar-line should look.
    Hint: This procedure must have an @var{extent} argument, whether this
    argument is used or not.
(2) assign a glyph to this procedure.
    Hint: This glyph needs to be of @code{string-length} 1
          Otherwise you'll be warned and the glyph is ignored.
(3) which glyph this new bar-line should use mid-line, end-of-line,
    begin-of-line and as span-bar.
    Here the scheme-form is used, @code{defineBarLine} would have worked as well

Consider the following example:
In the end we aim for a bar-line like "X" (quite silly, though you'll hopefully
get the point.)
You'll see that (1), (2), and (3) are done.
Though the printed output isn't nice:
The "x" is somehow and somewhere in the middle of the Staff, not spanning from
bottom- to top-line.
The spanbar is even worse, printed above the top Staff.
%}

#(define (make-x-fail-bar-line grob extent)
      (grob-interpret-markup grob "x"))

#(add-bar-glyph-print-procedure "f" make-x-fail-bar-line)

#(define-bar-line "f" "f" "f" "f")

m =
\new Staff \relative c' {
    c1
    \bar "f"
    d
    \break
    \bar "f"
    e
    \bar "f"
}

\new StaffGroup <<
\m
\m
>>

%{
This happens, because the actual extent of the Staff and the SpanBar isn't taken
into account in any way.
You may want to
(a) scale the BarLine to be extented from the bottom- to the top-line of the
    Staff.
    For the SpanBar, from the top-line of the lower Staff up to the bottom-line
    of the upper Staff.
(b) print the BarLine and the SpanBar at the correct position.

For (a):
In the example below @code{ly:stencil-scale} is used with the value
@code{(interval-length extent)} for scaling in Y-direction.
For (b):
@code{ly:stencil-translate-axis} with the value @code{(interval-length extent)}
is used to move the SpanBar in the correct position in Y-direction.
%}

#(define (make-x-bar-line grob extent)
  "Draw a x-bar line."
  (let* ((extent (bar-line::widen-bar-extent-on-span grob extent)))
    (ly:stencil-translate-axis
       (ly:stencil-scale
         (grob-interpret-markup grob "x")
         1 (interval-length extent))
       (interval-start extent)
       Y)))

#(add-bar-glyph-print-procedure "x" make-x-bar-line)

#(define-bar-line "x" "x" "x" "x")

mII =
\new Staff \relative c' {
    c1
    \bar "x"
    d
    \break
    \bar "x"
    e
}

\new StaffGroup <<
\mII
\mII
>>

%{
Now the new bar-line is ready to use, even in combination with other bar-lines
Example:
%}

#(define-bar-line ":x|." ":x|." "x" " x|.")

mIII =
\relative c' {
    c1
    \bar ":x|."
    d
    \break
    \bar ":x|."
    e
}

\new StaffGroup <<
\new Staff \mIII
\new TabStaff \mIII
\transpose c c''' \mIII
>>

Cheers,
  Harm



reply via email to

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