lilypond-user
[Top][All Lists]
Advanced

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

Re:changing symbols used by Measure_grouping_engraver


From: Flaming Hakama by Elaine
Subject: Re:changing symbols used by Measure_grouping_engraver
Date: Fri, 3 Aug 2018 13:50:32 -0700


---------- Forwarded message ----------
From: Thomas Morley <address@hidden>
Date: Fri, 3 Aug 2018 13:17:54 +0200
Subject: Re: changing symbols used by Measure_grouping_engraver
2018-08-03 12:25 GMT+02:00 Torsten Hämmerle <address@hidden>:
> 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)?
>
 

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


Ding!
Ding!
Ding!

We have a winner!


Thanks you, this works perfectly.

Much appreciated.


Sincerely,

Elaine Alt
415 . 341 .4954                                           "Confusion is highly underrated"
address@hidden
Producer ~ Composer ~ Instrumentalist
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 

reply via email to

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