Re: Box around multiple markups

2015-10-01 Thread David Nalesnik
Hi Urs,

On Mon, Sep 28, 2015 at 9:19 AM, Urs Liska  wrote:

> Hi David,
>
> thank you very much!
>

You're welcome!


>
> Am 26.09.2015 um 01:25 schrieb David Nalesnik:
>
> Hi,
>
> ...
>
> To do what you want, it would be best of course to have a new grob.
>
> Defining new grobs has no user interface at the moment.  There is a
> regression text, input/regression/scheme-text-spanner.ly which does
> define one in an LY file.
>
> I modeled the attached after that.  I've got the dashed boxes.
>
>
> Did you do that *now* or have you pulled that out from some earlier work???
>

The regression test was originally written by Mike Solomon.

As far as boxes go, I've worked on them from time to time (and all but
given up).  I didn't base this on earlier stuff, partly because I didn't
have the patience to try to find the earlier files, and partly because I
didn't need to add very much to the model.  (Mostly, I just added a stencil
function and changed a few names.)


> I didn't tackle the bracket-with-inner-prong(s)--maybe someone would like
> to give it a go?
>
>
> What would also be very sufficient would be the same dashed box, only
> nested. However, I didn't manage to get that to work, even with additional
> helper voices.
> What will work for this time is the slur you can see in the image. I
> didn't get it to behave properly above the texts but it will do.
>

This is too late, unfortunately, but maybe you'll get some use out of the
attached.

The only way I could see to get nested boxes was to incorporate the idea of
'spanner-id.  I approximated your design by using a nested box with some
changed attributes.  The property 'box-faces is used to hide sides of the
box.  The 'box-dimension-offset property is used to give room for the line.

(Oh, I made \boxSpanStart and the like into post-events so they're like
\startTextSpan, etc.


>
> Very much so.
> The only thing still lacking for now is the box around the synchronuous
> items on the lyrics lines. The way to go for such a thing is probably to
> collect all syllables, then combine all objects at the same musical moment
> then draw boxes around them.
>

Yes.  You could do something like what I did here, but in this case an
engraver which creates an Item rather than a Spanner.

Best,
David

%%
\version "2.19.27"

%\include "lilypond-book-preamble.ly"

\paper {
  indent = 0\cm
}

%% CUSTOM GROB PROPERTIES

% Taken from http://www.mail-archive.com/lilypond-user%40gnu.org/msg97663.html
% (Paul Morris)

% function from "scm/define-grob-properties.scm" (modified)
#(define (cn-define-grob-property symbol type?)
   (set-object-property! symbol 'backend-type? type?)
   (set-object-property! symbol 'backend-doc "custom grob property")
   symbol)

% How much extra space to top, right, bottom, left?  If unspecified,
% this will be taken as '(1.0 1.0 -1.0 -1.0), creating a padding of 1 staff-space
% around box-contents.
#(cn-define-grob-property 'box-dimension-offset number-list?)

% Which faces will be drawn?  Pattern is top, right, bottom, left.  If
% unspecified, this will be taken as '(#t #t #t #t) -- meaning that all
% faces are visible.
#(cn-define-grob-property 'box-faces list?)

% Based on input/regression/scheme-text-spanner.ly

#(define-event-class 'box-span-event 'span-event)

#(define (add-grob-definition grob-name grob-entry)
   (let* ((meta-entry   (assoc-get 'meta grob-entry))
  (class(assoc-get 'class meta-entry))
  (ifaces-entry (assoc-get 'interfaces meta-entry)))
 (set-object-property! grob-name 'translation-type? ly:grob-properties?)
 (set-object-property! grob-name 'is-grob? #t)
 (set! ifaces-entry (append (case class
  ((Item) '(item-interface))
  ((Spanner) '(spanner-interface))
  ((Paper_column) '((item-interface
 paper-column-interface)))
  ((System) '((system-interface
   spanner-interface)))
  (else '(unknown-interface)))
  ifaces-entry))
 (set! ifaces-entry (uniq-list (sort ifaces-entry symbol
  es
  |
   ^\pieceTitle "Arlequin"

   s2\boxSpanEnd
  |
  bes4 ^\pieceTitle "Valse noble"
  g bes
  |
  \time 2/4
  %% left/right/bottom/top
  \once \override BoxTextSpanner.box-dimension-offset = #'(4 1 -1 -1)
   es,4 ^\pieceTitle "Eusebius"\boxSpanStart
  s4
  |
  \time 5/4
  <<
{
   4 ^\pieceTitle "Florestan"
   -\tweak style ##f
   -\tweak thickness 2
   -\tweak box-faces #(list #t #f #f #f) \startBoxSpanOne
}
\new Voice {
  
}
  >>
  s8 \boxSpanEnd
  bes4
  s8
  4
  s4
  \bar ";"
  |
  \time 3/4

  bes4 ^\pieceTitle "Coquette"
  s2
  \bar ";"
  |

  bes4 \stopBoxSpanOne ^\pieceTitle "Réplique"
  s8
  g4 s8
  \bar "||"
}


Re: Box around multiple markups

2015-09-28 Thread Urs Liska
Hi David,

thank you very much!

Am 26.09.2015 um 01:25 schrieb David Nalesnik:
> Hi,
>
> ...
>
> To do what you want, it would be best of course to have a new grob.
>
> Defining new grobs has no user interface at the moment.  There is a
> regression text, input/regression/scheme-text-spanner.ly
>  which does define one in an LY file.
>
> I modeled the attached after that.  I've got the dashed boxes. 

Did you do that *now* or have you pulled that out from some earlier work???

In any case it looks great already (see attachment)!

> I didn't tackle the bracket-with-inner-prong(s)--maybe someone would
> like to give it a go?

What would also be very sufficient would be the same dashed box, only
nested. However, I didn't manage to get that to work, even with
additional helper voices.
What will work for this time is the slur you can see in the image. I
didn't get it to behave properly above the texts but it will do.

>
> The two solid lines surrounding the single text might be done by
> overriding the TextScript stencil.  (Though perhaps you want the
> flexibility to group multiple texts?  Properties might be added to our
> new grob to hide faces of the box.)

I will look into that later, when I'll have time again. These lines are
actually redundant in the current example. I intended to indicate that
this piece is separate from the others, but that becomes clear through
the boxes already ...

>
> Hope this helps...

Very much so.
The only thing still lacking for now is the box around the synchronuous
items on the lyrics lines. The way to go for such a thing is probably to
collect all syllables, then combine all objects at the same musical moment
then draw boxes around them. But I don't have the time to look into it
(this will be shown on Sunday in Berlin (if anybody's there and
interested ...)), and I can explain the facts without the box as well ...

Best
Urs

>
> David
>
> P. S.  I notice the invocation of lilypond-book at the top.  This file
> will raise problems if it is run on a batch of files.  The only way to
> do this right is to define the grob in the orthodox way.  (Since I
> know you work with self-compiled master, you could extract the
> relevant info and stick it in the appropriate files. Let me know if
> you want more info.)
>
> %%%
>
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Box around multiple markups

2015-09-25 Thread Urs Liska
Hi all,

I want to engrave something like the attached scaned image for an
analytical music example. As you can see from the LilyPond attachments I
have achieved most of it already, but I'm out of luck with the different
boxes.

What I'd basically need is boxes that enclose two or more independent
markups, be it in the "free" markups above the staff or in the two
Lyrics lines below.
I don't necessarily need the exact shapes and line structures in of the
hand-written example, it's just about the different enclosings and nestings.

Unfortunately my efforts so far (using boxes or paths) didn't turn up
anything useful.

Any suggestions?

Best
Urs
\version "2.19.28"

%\include "lilypond-book-preamble.ly"

\paper {
  indent = 0\cm
}

pieceTitle =
#(define-event-function (text) (markup?)
   #{
 -\tweak TextScript.self-alignment-X #LEFT
 -\tweak TextScript.self-alignment-Y #DOWN
 -\tweak TextScript.padding 3
 -\markup \rotate #90 #text
   #})

notes = \relative es' {
  \omit Staff.Stem
  \key as \major
  \time 3/4
  es ^ \pieceTitle "Pierrot"
   
  es 
  |
   ^\pieceTitle "Arlequin"
  s2
  |
  bes4 ^\pieceTitle "Valse noble"
  g bes
  |
  \time 2/4
  es,4 ^\pieceTitle "Eusebius"
  s4
  |
  \time 5/4
  <<
{
  4 ^\pieceTitle "Florestan"
}
\new Voice {
  
}
  >>
  s8
  bes4
  s8
  4
  s4
  \bar ";"
  |
  \time 3/4
  bes4 ^\pieceTitle "Coquette"
  s2
  \bar ";"
  |
  bes4 ^\pieceTitle "Réplique"
  s8
  g4 s8
  \bar "||"
}
 
functionsOne = \lyricmode {
  \set stanza = \markup \circle "B:"
  S2.
  D2.
  T2.
  S2 
}

functionsTwo = \lyricmode {
  \set stanza = \markup  \circle  "g:"
  \skip2.*3
  tG2
  \markup { D \hspace #-.8 \super 7 }4*5
  (tP)2.
  t2
}

\score {
  <<
  \new Staff {
\omit Score.TimeSignature
\notes
  }
  \new Lyrics \functionsOne
  \new Lyrics \functionsTwo
  >>
}___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Box around multiple markups

2015-09-25 Thread Klaus Blum
Hi Urs, 

the only thing I can offer is to use HorizontalBracket and replace its
stencil by a box as shown in 
http://lsr.di.unimi.it/LSR/Item?id=1000

Two drawbacks:
1. I don't know how to simulate dashed lines. 
2. Vertical position of the upper and lower edge must be set manually.
However, this allows to keep all boxes at the same height. 
I hope this helps.

Cheers, 
Klaus

dispo-satz-1-HorizontalBracket.ly
<http://lilypond.1069038.n5.nabble.com/file/n181707/dispo-satz-1-HorizontalBracket.ly>
  



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Box-around-multiple-markups-tp181700p181707.html
Sent from the User mailing list archive at Nabble.com.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Box around multiple markups

2015-09-25 Thread David Nalesnik
On Fri, Sep 25, 2015 at 6:25 PM, David Nalesnik 
wrote:


>
> Dashed lines may now (as of 2.19.27) be created using the function
> ly:line-interface::line.  This takes a grob argument from which it extracts
> layout information.  So you'd just override the 'style property. Dashed
> lines would be the default.
>
>

With the file you can do things like:

\once \override BoxTextSpanner.thickness = 4

\once \override BoxTextSpanner.dash-period = 2

\once \override BoxTextSpanner.style = ##f  %% solid line

You can do 'zigzag and 'trill, but those look pretty awful (especially the
last).

David
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Box around multiple markups

2015-09-25 Thread David Nalesnik
Hi,

On Fri, Sep 25, 2015 at 5:58 PM, Klaus Blum  wrote:

> Hi Urs,
>
> the only thing I can offer is to use HorizontalBracket and replace its
> stencil by a box as shown in
> http://lsr.di.unimi.it/LSR/Item?id=1000


You could adapt ("coopt") an existing engraver, or ...  (see below)


>
> Two drawbacks:
> 1. I don't know how to simulate dashed lines.
>

Dashed lines may now (as of 2.19.27) be created using the function
ly:line-interface::line.  This takes a grob argument from which it extracts
layout information.  So you'd just override the 'style property. Dashed
lines would be the default.

To do what you want, it would be best of course to have a new grob.

Defining new grobs has no user interface at the moment.  There is a
regression text, input/regression/scheme-text-spanner.ly which does define
one in an LY file.

I modeled the attached after that.  I've got the dashed boxes.  I didn't
tackle the bracket-with-inner-prong(s)--maybe someone would like to give it
a go?

The two solid lines surrounding the single text might be done by overriding
the TextScript stencil.  (Though perhaps you want the flexibility to group
multiple texts?  Properties might be added to our new grob to hide faces of
the box.)

Hope this helps...

David

P. S.  I notice the invocation of lilypond-book at the top.  This file will
raise problems if it is run on a batch of files.  The only way to do this
right is to define the grob in the orthodox way.  (Since I know you work
with self-compiled master, you could extract the relevant info and stick it
in the appropriate files. Let me know if you want more info.)

%%%
\version "2.19.27"

%\include "lilypond-book-preamble.ly"

\paper {
  indent = 0\cm
}

% Based on input/regression/scheme-text-spanner.ly

#(define-event-class 'box-span-event 'span-event)

#(define (add-grob-definition grob-name grob-entry)
   (let* ((meta-entry   (assoc-get 'meta grob-entry))
  (class(assoc-get 'class meta-entry))
  (ifaces-entry (assoc-get 'interfaces meta-entry)))
 (set-object-property! grob-name 'translation-type? ly:grob-properties?)
 (set-object-property! grob-name 'is-grob? #t)
 (set! ifaces-entry (append (case class
  ((Item) '(item-interface))
  ((Spanner) '(spanner-interface))
  ((Paper_column) '((item-interface
 paper-column-interface)))
  ((System) '((system-interface
   spanner-interface)))
  (else '(unknown-interface)))
  ifaces-entry))
 (set! ifaces-entry (uniq-list (sort ifaces-entry symbol
  es
  |
   ^\pieceTitle "Arlequin"
  \boxSpanEnd s2
  |
  bes4 ^\pieceTitle "Valse noble"
  g bes
  |
  \time 2/4
  \boxSpanStart es,4 ^\pieceTitle "Eusebius"
  s4
  |
  \time 5/4
  <<
{
  4 ^\pieceTitle "Florestan"
}
\new Voice {
  
}
  >>
  \boxSpanEnd s8
  bes4
  s8
  4
  s4
  \bar ";"
  |
  \time 3/4
  bes4 ^\pieceTitle "Coquette"
  s2
  \bar ";"
  |
  bes4 ^\pieceTitle "Réplique"
  s8
  g4 s8
  \bar "||"
}

functionsOne = \lyricmode {
  \set stanza = \markup \circle "B:"
  S2.
  D2.
  T2.
  S2
}

functionsTwo = \lyricmode {
  \set stanza = \markup  \circle  "g:"
  \skip2.*3
  tG2
  \markup { D \hspace #-.8 \super 7 }4*5
  (tP)2.
  t2
}

\score {
  <<
\new Staff {
  \omit Score.TimeSignature
  \notes
}
\new Lyrics \functionsOne
\new Lyrics \functionsTwo
  >>
}
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user