lilypond-user
[Top][All Lists]
Advanced

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

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


From: Urs Liska
Subject: Define new articulation with markup or path (instead of glyph)
Date: Sun, 30 Sep 2018 12:00:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Hi,

I need to define new items to attach to notes that center-align to the note heads. These should be either regular texts or drawn paths. I know a few approaches but haven't found a working solution for me, so I'd be happy to get some hints (or solutions).

As I want *some* of the objects to be used as a drop-in replacement for existing commands like \upbow the following solution doesn't work:

    upbow =
    #(define-music-function ()()
       #{
         \tweak self-alignment-X #CENTER
         -\markup "hin."
       #})

because

    c4 \upbow

will fail with the complaint about an unexpected post-event (I have to write -\upbow)

The second limitation to this is that it doesn't align to the notehead's center but to the stem. Therefore I thought creating either an articulation or a dynamic text.

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).

Creating a dynamic script is easy:

    upbow =
    #(make-dynamic-script
      (markup
       (#:normal-text "hin.")))

However, I have two problems with this approach:

How can I make sure the dynamics stay on one vertical line? Attaching them directly to the note gives the result as in the attached "horizontal-shift.png" while dynamics printed in a Dynamics context don't seem to avoid collisions, and I don't know how to avoid that.

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

Attachment: horizontal-shift.png
Description: PNG image

Attachment: dynamics-clash.png
Description: PNG image


reply via email to

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