lilypond-user
[Top][All Lists]
Advanced

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

Re: Creating custom articulation using regular text font


From: Urs Liska
Subject: Re: Creating custom articulation using regular text font
Date: Wed, 20 Feb 2019 18:38:41 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

Hi Jan-Peter,

thank you very much, this was exactly what I needed!
And your solution came *exactly* in the moment when I had to decide whether I should skip the three affected snippets instead of including them in the upcoming set for review :-)

Best
Urs

Am 20.02.19 um 18:25 schrieb Jan-Peter Voigt:
Hi Urs,

in an articulation event the font is emmentaler and not a normal one.
So in the trill-list part you have to switch back to normal text with
\markup \normal-text "T"

HTH
Jan-Peter

Am 20.02.19 um 17:23 schrieb Urs Liska:
Hi,

I haven't got any further, but ...

Am 20.02.19 um 11:53 schrieb Urs Liska:
I'm trying to create an articulation printing a glyph from the
"regular" text font.

...

I moved all the relevant code into an MWE, which might trigger more
ideas than the abstract excerpt I originally posted.

The problem is that I can create a custom articulation using a stencil
made from \markup \musicglyph "something" but not from \markup "Something".

I'd be really thankful about any push in the right direction, since I
have no clue as to where even start searching.

Best
Urs

\version "2.19.82"

% The "asterisk" *does* work properly
#(define asterisk-list
    `("asterisk"
       . ((stencil . ,ly:text-interface::print)
          (text . ,#{ \markup \musicglyph "pedal.*" #})
          ; any other properties
          (padding . 0.5)
          (avoid-slur . around)
          (direction . ,DOWN)
          (script-priority . 125)
          )))

% The "trill" fails, complaining in a programming error that it "Cannot get a text 
stencil from this font"
#(define trill-list
    `("trill"
       . ((stencil . ,ly:text-interface::print)
          (text . ,#{ \markup "T" #})
          ; any other properties
          (padding . 0.5)
          (avoid-slur . around)
          (direction . ,DOWN)
          (script-priority . 75)
          )))

%% A macro setting the lists from above in the copy of `default-script-alist´
%% For now, every new script has to be inserted in a single run.
%% TODO
%% Probably better to do simpler list processing with append, cons etc
#(define-macro (set-my-script-alist! ls-1 ls-2)
    "Creates a new key-value-pair, taken from ls-2, in ls-1"
    `(set! ,ls-1
           (if (and (pair? ,ls-2) (pair? (cadr ,ls-2)))
               (assoc-set! ,ls-1 (car ,ls-2) (cdr ,ls-2))
               (begin
                (ly:warning (_"Unsuitable list\n\t~a \n\tdetected, ignoring. ") 
,ls-2)
                ,ls-1))))

#(set-my-script-alist! default-script-alist asterisk-list)
#(set-my-script-alist! default-script-alist trill-list)

\layout {
   \context {
     \Score
     scriptDefinitions = #default-script-alist
   }
}

asterisk-artic = #(make-articulation "asterisk")
trill-artic = #(make-articulation "trill")



tt =
#(define-event-function ()()
    #{
      -\trill-artic
    #})

asterisk =
#(define-event-function ()()
      #{
        -\tweak font-size 0
        -\asterisk-artic
      #})


\relative {
   c'' \asterisk
   c \tt
}


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


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



reply via email to

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