changing symbols used by Measure_grouping_engraver

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

changing symbols used by Measure_grouping_engraver

Flaming Hakama by Elaine


> >
 

\version "2.19.81"

%{
I wonder if anyone can point me in the right direction.

I'd like to modify the sybols used by the Measure_grouping_engraver

In particular, how to change the symbol used to denote the dotted 8th value in compund time:
instead of a triangle, how do I get a vertical bar (or slash)?

%}
\score {
    \new Voice \relative c'' {

        \time 9/8
        %  The default beat grouping is fine.  
        %  But I'd like a vertical bar instead of the triangle 
        %\set Timing.beatStructure = #'(3 3 3) 
        d4. d d |
    }
\layout {
\context {
\Staff
\consists "Measure_grouping_engraver"
}
}
}


Please let me know if you have any thoughts.


Thanks, 

Elaine Alt
415 . 341 .4954                                           "Confusion is highly underrated"
[hidden email]
Producer ~ Composer ~ Instrumentalist
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: changing symbols used by Measure_grouping_engraver

Torsten Hämmerle
Flaming Hakama by Elaine wrote
> In particular, how to change the symbol used to denote the dotted 8th
> value
> in compund time:
> instead of a triangle, how do I get a vertical bar (or slash)?

Hi Elaine,

The two options "triangle" and "bracket" are pretty much hardcoded.
But you can set the height (thus squeezing both forms into a vertical line
when you set height to 0) and thickness (to make this line as thick as you
like):

      \override Staff.MeasureGrouping.height = 0

That way, you'll get a vertical line (unfortunately the bracket will be
indistinguishable then from the triangle).

But you might define a custom stencil quite easily that sets the height to 0
if style is #'triangle and then calls the original print stencil.
In the following example, I've used the original snipped coding as a basis,
because in your example, there were no brackets at all.

%%%%%%%
\version "2.19.81"

#(define (custom-grouping-stencil grob)
   (let ((style (ly:grob-property grob 'style)))
     (if (eq? style 'triangle)
         (ly:grob-set-property! grob 'height 0))
     ly:measure-grouping::print))

\score {
  \new Voice \relative c'' {
    \time 9/8
    g8 g d d g g a( bes g) |
    \set Timing.beatStructure = 2,2,2,3
    g8 g d d g g a( bes g) |
    \time 4,5 9/8
    g8 g d d g g a( bes g) |
    \time 5/8
    a4. g4 |
  }
  \layout {
    \context {
      \Staff
      \consists "Measure_grouping_engraver"
      \override MeasureGrouping.stencil = #custom-grouping-stencil
    }
  }
}
%%%%%%%

<http://lilypond.1069038.n5.nabble.com/file/t3887/measure-grouping-lines.png>

HTH,
Torsten




--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: changing symbols used by Measure_grouping_engraver

Thomas Morley-2
2018-08-03 12:25 GMT+02:00 Torsten Hämmerle <[hidden email]>:

> Flaming Hakama by Elaine wrote
>> In particular, how to change the symbol used to denote the dotted 8th
>> value
>> in compund time:
>> instead of a triangle, how do I get a vertical bar (or slash)?
>
> Hi Elaine,
>
> The two options "triangle" and "bracket" are pretty much hardcoded.
> But you can set the height (thus squeezing both forms into a vertical line
> when you set height to 0) and thickness (to make this line as thick as you
> like):
>
>       \override Staff.MeasureGrouping.height = 0
>
> That way, you'll get a vertical line (unfortunately the bracket will be
> indistinguishable then from the triangle).
>
> But you might define a custom stencil quite easily that sets the height to 0
> if style is #'triangle and then calls the original print stencil.
> In the following example, I've used the original snipped coding as a basis,
> because in your example, there were no brackets at all.
>
> %%%%%%%
> \version "2.19.81"
>
> #(define (custom-grouping-stencil grob)
>    (let ((style (ly:grob-property grob 'style)))
>      (if (eq? style 'triangle)
>          (ly:grob-set-property! grob 'height 0))
>      ly:measure-grouping::print))
>
> \score {
>   \new Voice \relative c'' {
>     \time 9/8
>     g8 g d d g g a( bes g) |
>     \set Timing.beatStructure = 2,2,2,3
>     g8 g d d g g a( bes g) |
>     \time 4,5 9/8
>     g8 g d d g g a( bes g) |
>     \time 5/8
>     a4. g4 |
>   }
>   \layout {
>     \context {
>       \Staff
>       \consists "Measure_grouping_engraver"
>       \override MeasureGrouping.stencil = #custom-grouping-stencil
>     }
>   }
> }
> %%%%%%%
>
> <http://lilypond.1069038.n5.nabble.com/file/t3887/measure-grouping-lines.png>
>
> HTH,
> Torsten


Hi Torsten,

iiuc, this will result in a _horizontal_ line, not vertical. ;)

Here my own attempts: slashes, vertical lines and (just for fun)
tie-style stencils replacing the triangles

\version "2.19.82"

#(define triangle->slash-stencil
  (lambda (grob)
    (let* ((style (ly:grob-property grob 'style))
           (thickness (ly:grob-property grob 'thickness))
           (staff-line-thick (ly:staff-symbol-line-thickness grob))
           (thick (* thickness staff-line-thick))
           (stil (ly:measure-grouping::print grob))
           (stil-x-ext (ly:stencil-extent stil X))
           (height (ly:grob-property grob 'height)))
    (if (eq? style 'triangle)
        (make-line-stencil
          thick ;width
          (car stil-x-ext) ;startx
          0 ;starty
          (cdr stil-x-ext)  ;endx
          height ;endy
          )
        stil))))

#(define triangle->vertical-line-stencil
  (lambda (grob)
    (let* ((style (ly:grob-property grob 'style))
           (thickness (ly:grob-property grob 'thickness))
           (staff-line-thick (ly:staff-symbol-line-thickness grob))
           (thick (* thickness staff-line-thick))
           (height (ly:grob-property grob 'height)))
    (if (eq? style 'triangle)
        (make-line-stencil
          thick ;width
          ;; 0.5 is my choice, probably catch NoteColumn and take half of
          ;; its extent
          0.5 ;startx
          0 ;starty
          0.5  ;endx
          height ;endy
          )
        ly:measure-grouping::print))))


#(define triangle->tie-stencil
  (lambda (grob)
    (let* ((style (ly:grob-property grob 'style))
           (stil (ly:measure-grouping::print grob))
           (stil-x-ext (ly:stencil-extent stil X))
           (length-x (- (cdr stil-x-ext) (car stil-x-ext)))
           (height (ly:grob-property grob 'height)))
    (if (eq? style 'triangle)
        (begin
          (ly:grob-set-property! grob 'control-points
            (list
              (cons 0 0)
              (cons (* 1/3 length-x) height)
              (cons (* 2/3 length-x) height)
              (cons length-x 0)))
          (ly:tie::print grob))
        ly:measure-grouping::print))))

mus =
\relative c'' {
  \time 9/8
  g8 g d d g g a( bes g) |
  \set Timing.beatStructure = 2,2,2,3
  g8 g d d g g a( bes g) |
  \time 4,5 9/8
  g8 g d d g g a( bes g) |
  \time 5/8
  a4. g4 |
  \set Timing.beatStructure = 3,3,3
}

\score {
  \new Voice
    {
      \override Staff.MeasureGrouping.stencil = #triangle->vertical-line-stencil
      \mus
      \break
      \override Staff.MeasureGrouping.stencil = #triangle->slash-stencil
      \mus
      \break
      \override Staff.MeasureGrouping.stencil = #triangle->tie-stencil
      \mus
    }
  \layout {
    \context {
      \Staff
      \consists "Measure_grouping_engraver"
    }
  }
}

All the best,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: changing symbols used by Measure_grouping_engraver

Torsten Hämmerle
Thomas Morley-2 wrote
> Hi Torsten,
>
> iiuc, this will result in a _horizontal_ line, not vertical. ;)


Drat, this tiny detail makes my simplistic attempt rather useless.

Lame excuse: "No, this is not a horizontal line, it's actually a vertical
line, just very thick and very short". ;)

But, as usual, your elaborate solution leaves nothing to be desired.

Thanks,
Torsten



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: changing symbols used by Measure_grouping_engraver

Thomas Morley-2
2018-08-03 13:33 GMT+02:00 Torsten Hämmerle <[hidden email]>:

> Thomas Morley-2 wrote
>> Hi Torsten,
>>
>> iiuc, this will result in a _horizontal_ line, not vertical. ;)
>
>
> Drat, this tiny detail makes my simplistic attempt rather useless.
>
> Lame excuse: "No, this is not a horizontal line, it's actually a vertical
> line, just very thick and very short". ;)


rofl

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: changing symbols used by Measure_grouping_engraver

Thomas Morley-2
In reply to this post by Thomas Morley-2
2018-08-03 13:17 GMT+02:00 Thomas Morley <[hidden email]>:

>   \layout {
>     \context {
>       \Staff
>       \consists "Measure_grouping_engraver"
>     }
>   }
> }

While playing with it I noticed some issues. I just wrote a bug report
about them:
http://lilypond.1069038.n5.nabble.com/Two-issue-with-Measure-grouping-engraver-td215297.html

Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user