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: i...@kierenmacmillan.info


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to