lilypond-user
[Top][All Lists]
Advanced

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

Re: Spannerize glyphs, markups etc. ?


From: Dimitris Marinakis
Subject: Re: Spannerize glyphs, markups etc. ?
Date: Thu, 4 Feb 2021 18:15:11 +0200

Thank you. This certainly works for simple scenarios.

Here is my incomplete take. I just need to find out how to automatically change the number that repeats the stencil based on the spanner length. 
Sorry if this doesn't make sense. I just started learning bit by bit how to make things work in Scheme. 
trillsymb = \markup {
\concat
{
\scale #'(1.5 . 1)
\musicglyph #"scripts.trillelement"
\musicglyph #"scripts.turn"
 }
}
 #(define (alterspan grob)
   (if (ly:stencil? (ly:line-spanner::print grob))
     (let* ((stencil (ly:line-spanner::print grob))
            (dot (ly:font-get-glyph (ly:grob-default-font grob) "scripts.turn"))
         (X-ext (ly:stencil-extent stencil X))
            (Y-ext (ly:stencil-extent stencil Y))
            (width 0.1)
            (len (interval-length X-ext)))
       (ly:stencil-translate
         (grob-interpret-markup grob
           (markup
; really crude method but I think it can work just fine
; spanner length / stencil extend ??
       (#:pattern (inexact->exact (round (* len
  ;need a way to automatically change this number based on the stencil dimensions
                                           0.3 ))) X 0
      (markup #:scale (cons 1 1) trillsymb)
            )
)
           )
          (cons (interval-start X-ext) (interval-start Y-ext))))
     #f))




{
\override Score.TextSpanner.stencil = #alterspan
<c' g'>4\startTextSpan
<c' g'>4
<c' g'>4
c'4
d'
e'
f'
g'\stopTextSpan
}

On Thu, Feb 4, 2021 at 9:35 AM Pierre Perol-Schneider <pierre.schneider.paris@gmail.com> wrote:
Hi Dimitris,
Here's a trial (every adjsutment are manual):

%%
\version "2.22.0"

curl =
\markup
  \stencil
    #(make-path-stencil
      '(M 0 0 C 4 0 4 5 2.5 5 C 1 5 1 0 5 0)
      .15 .6 .6 #f)
   
mors =
\markup
  \stencil
    #(make-path-stencil
      '(M 0 0 L .5 0 M 1.5 0 L 3 0)
      .15 .6 .6 #f)

\layout { ragged-right = ##f }

{
  a4 -\tweak extra-offset #'(.5 . 3)
  -\markup {
    \with-dimensions-from\null
    \rotate #25
    \pattern #7 #X #0 \curl
  }
  a'''
  a -\tweak extra-offset #'(1 . 3.5)
  -\markup {
    \with-dimensions-from\null
    \rotate #25
    \pattern #9 #X #.5 \mors
  }
  a'''
}
%%

Cheers,
Pierre

Le jeu. 4 févr. 2021 à 02:43, Dimitris Marinakis <dtsmarin02@gmail.com> a écrit :
Does anyone have any code that allows us to "spannerize" repeated or alternating paths and musicglyphs ?
e.g. - • - • - • -  or even asymmetric patterns like - - • - > - •
I think an effort for such a code would also be really useful for evolving spanners. (trills with various speeds etc.)

If I'm not mistaken, the trill spanner is made from concatenated individual glyphs so at least the basic repeated symbol seems easier to achieve. 

It would be really cool having a flexible solution that works like this:
\evolvingspanner 
arg1 left text (trill symbol etc.)
arg2 how many of the 1st symbol
arg3 how many of the 2nd symbol
.... ? manually enter how many glyphs are needed or perhaps a more automatic way to divide the spanner into segments and then just specify how many segments and glyphs will be used
arg4 right text (end cap)

-------
\repeatspanner
arguments that specify the type of pattern and how many symbols are used

I understand this could get really complicated so I tried to keep it fairly modest.

reply via email to

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