lilypond-user
[Top][All Lists]
Advanced

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

Re: Shorthand for "once override"?


From: Aaron Hill
Subject: Re: Shorthand for "once override"?
Date: Thu, 03 Sep 2020 22:47:28 -0700
User-agent: Roundcube Webmail/1.4.2

On 2020-09-03 5:22 pm, Alasdair McAndrew wrote:
Many thanks, both for the event function, and to the blog post. The latter
looks quite tricky, but when I feel brave enough I'll give it a go.
Meanwhile, I'll experiment with the event function - which might in fact be
preferable given that some of the marks are going to have to be
individually tweaked anyway.

Something to consider is whether a Fingering grob is a better fit than TextScript for your custom ornamentation. With a little logic, you can automatically align the child to its parent:

%%%%
\version "2.20.0"

makeRightOrnament =
#(define-scheme-function
  (text)
  (markup?)
  (define (relative-extent grob source axis)
    (ly:grob-robust-relative-extent
      grob
      (ly:grob-common-refpoint grob source axis)
      axis))
  (define (proc grob)
    (let* ((pad (ly:grob-property grob 'padding))
           (nh (ly:grob-parent grob X))
           (dot (ly:grob-object nh 'dot))
           (nh-xex (ly:grob-property nh 'X-extent))
           (dot-xex (if (ly:grob? dot)
                      (relative-extent dot nh X)
                      empty-interval)))
      (ly:grob-set-property! grob 'X-offset
        (+ pad (apply max (map cdr (list nh-xex dot-xex)))))
      (ly:grob-set-property! grob 'Y-offset
        (ly:grob-property nh 'Y-offset))))
  #{ -\tweak before-line-breaking #proc
     -\finger \markup \normal-text #text #})

mx = \makeRightOrnament \markup \vcenter \teeny \sans x
mzzz = \makeRightOrnament \markup \vcenter \huge \bold zzz

{ f8 -\tweak padding #0.8 -\mx f'4. -\mx
  f''16 -\mzzz f'''4.. -\mx }
%%%%


-- Aaron Hill

Attachment: ornament.cropped.png
Description: PNG image


reply via email to

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