lilypond-user
[Top][All Lists]
Advanced

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

Re: Define new articulation with markup or path (instead of glyph)


From: Urs Liska
Subject: Re: Define new articulation with markup or path (instead of glyph)
Date: Sat, 13 Oct 2018 00:00:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Hi Harm,

sorry, I forgot to reply to that until now.


Am 12.10.2018 um 14:35 schrieb Thomas Morley:
Hi Urs,

sorry for the late reply.
Right now I've a cold (not working in my regular job), so I've more
time to look into lilypond-tasks.
While waiting for a guile-complie to finish...

Am So., 30. Sep. 2018 um 12:01 Uhr schrieb Urs Liska <address@hidden>:

Creating a new articulation (or overwriting the definition of an existing one) 
seems tempting using something like

     #(append! default-script-alist
        (list
         `("scriptDownbow"
            . ((script-stencil . (feta . ("dfermata" . "ufermata")))
               ; any other properties
               (toward-stem-shift-in-column . 0.0)
               (padding . 1)
               (avoid-slur . around)
               (direction . ,UP)
               ))
         ))

     % create postfix commands to use the articulations
     downbow = #(make-articulation "scriptDownbow")

This successfully makes \downbow use the fermata instead of the regular glyph. 
However, it seems there's no way to make that use a markup or a path instead of 
an Emmentaler glyph (if this old information 
(https://www.mail-archive.com/address@hidden/msg64645.html) still holds true).
Still true.
As long as you try to fill "script-stencil" you are limited to the
script-glyphs Emmentaler provides.
But there is no need to go for script-stencil, you may let it unset
and define only stencil, perhaps with different result for up/down.
See below.

That is good to know. I think this would make for a very useful tutorial post, explaining things a bit more in-depth so others (like me) may become somewhat more familiar with the stuff.


[...]
So, is there any reasonable way to create something (function, articulation, 
dynamics) with the following characteristics:

can be written like articulations/dynamics (i.e. with or without postfix 
operator)
can be forced to a common vertical baseline with other elements
pushes notecolumns to obtain the necessary space (like \textLengthOn does for 
markup)

?

Any advice would be appreciated!
Urs
In the code below two new articulations are defined: path and polygon.
The polygon-definition is after a idea by Torsten, I even extended it
a bit. Probably too complicated for a simple
proof-of-concept-example...

Probably right, but nevertheless I managed to boil it down to do (only) what I currently need.


Nevertheless here all the code:

\version "2.19.82"

%% Not sure if needed, though, better be paranoid and work on a copy of
%% default-script-alist to avoid possible bleed-over.
#(define my-script-alist default-script-alist)

Except that this doesn't *create* a copy but only a reference, isn't it? So your changes to my-script-alist also affect default-script-alist.



HTH,
   Harm

Indeed, thank you very much. Here's my solution, I created the "strich" articulation:

#(define strich-stencil
   (lambda (grob)
     (grob-interpret-markup grob
       #{
         \markup
         \path
         #0.19
         #`((moveto 0 0)
            (lineto 0 0.75))
       #})))

#(define strich-list
   `("strich" .
      ((avoid-slur . inside)
       (padding . 0.5)
       (stencil . ,strich-stencil)
       (side-relative-direction . ,DOWN))))

%% A macro setting the lists from above in the copy of `default-script-alist´
%% For now, every new script has to be inserted in a single run.
%% TODO
%% Probably better to do simpler list processing with append, cons etc
#(define-macro (set-my-script-alist! ls-1 ls-2)
   "Creates a new key-value-pair, taken from ls-2, in ls-1"
   `(set! ,ls-1
          (if (and (pair? ,ls-2) (pair? (cadr ,ls-2)))
              (assoc-set! ,ls-1 (car ,ls-2) (cdr ,ls-2))
              (begin
               (ly:warning (_"Unsuitable list\n\t~a \n\tdetected, ignoring. ") 
,ls-2)
               ,ls-1))))

#(set-my-script-alist! default-script-alist strich-list)

\layout {
  \context {
    \Score
    scriptDefinitions = #default-script-alist
  }
}

strich = #(make-articulation "strich")

Best
Urs



reply via email to

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