lilypond-user
[Top][All Lists]
Advanced

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

scaling "normal text" font size inside dynamic


From: Kieren MacMillan
Subject: scaling "normal text" font size inside dynamic
Date: Wed, 2 Aug 2017 21:38:28 -0400

Hello,

Is there any way to change the font size of the "normal text" portion of mixed 
dynamic markings, independently from the font size of the dynamic portion? For 
example, in

   p dolce

I'd like to increase the size of 'dolce' without increasing the size of the 
'p'. I am using various functions to knit together dynamics and text, and I 
have various stylesheets (which use different fonts), so I'd rather not have to 
hard-code the scaling into each function and duplicate every function in each 
stylesheet.

Below is an example of one of the functions I use, and the current effect of 
increasing DynamicText.font-size (which is to increase the entire dynamic).

Thanks,
Kieren.

%%%%  SNIPPET BEGINS
\version "2.19"

dynText = #(define-event-function (parser location dyn expr)
             (markup? markup?)
             (let* (
                     (mark #{ \markup { \dynamic $dyn \hspace #0.2 \normal-text 
\italic $expr } #})
                     (offset (lambda (grob)
                               (let* (
                                       (layout (ly:grob-layout grob))
                                       (props (ly:grob-alist-chain grob
                                                (ly:output-def-lookup layout
                                                  'text-font-defaults)))
                                       (target-X-extent
                                        (ly:stencil-extent

                                         (ly:text-interface::interpret-markup 
layout props dyn)
                                         X))
                                       (width (abs
                                               (- (cdr target-X-extent) (car 
target-X-extent))))
                                       )
                                 (display target-X-extent)
                                 (- 1 (/ width 2))
                                 )
                               )
                       )
                     )
               #{
                 \tweak DynamicText.X-offset #offset
                 #(make-dynamic-script mark)
               #}
               )
             )

{ c''1\dynText "p" "dolce" }

{ \override DynamicText.font-size = #2 c''1\dynText "p" "dolce" }
%%%%  SNIPPET ENDS
________________________________

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




reply via email to

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