lilypond-user
[Top][All Lists]
Advanced

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

Re: tweaks don't apply to post-function grob


From: Kieren MacMillan
Subject: Re: tweaks don't apply to post-function grob
Date: Tue, 15 Aug 2017 09:41:47 -0400

Hi David (et al.),

>> Can \dynText or similar be fashioned in such a way that leaves open
>> the possibility of [effectively] tweaking the grob later in the
>> process?
> 
> I repeat: If you want self-alignment-X to be heeded in there in some
> manner, you need to incorporate it in the callback for the offset.

I do appreciate the "teach a man to fish" approach…

I've poked around at the \dynText function, and the \dynamic function in 
OpenLilyLib (see snippet, below, for original version), but have been as yet 
unable to incorporate self-alignment-X into the callback(s) for the offset in a 
way that seems to work.

Any further help or pointers (e.g., to a callback function which *does* 
incorporate self-alignment-X) would be welcome.

Thanks,
Kieren.

%%%  SNIPPET BEGINS
\version "2.19.64"

#(use-modules (ice-9 regex))

dynamic =
#(define-event-function (text) (markup?)
   (if (string? text)
       (let* ((underscores-replaced
               (string-map
                (lambda (x) (if (eq? x #\_) #\space x))
                text))
              (split-text (string-split underscores-replaced #\space))
              (formatted (map
                          (lambda (word)
                            (if (string-match "^[mrzfps]*$" word)
                                (markup #:dynamic word)
                                (markup #:normal-text #:fontsize 0.625 #:italic 
word)))
                          split-text)))
         #{
           -\tweak X-offset #0
               #(make-dynamic-script (make-line-markup formatted))
         #})

       ;; user provided a full-blown markup, so we don't mess with it:
       #{
         #(make-dynamic-script (markup #:normal-text text))
       #}))

{ c''1-\tweak self-alignment-X #RIGHT -\dynamic "p (non cresc.)" }
%%%  SNIPPET ENDS

________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: address@hidden




reply via email to

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