lilypond-user
[Top][All Lists]
Advanced

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

Re: Defining custom symbols


From: Andrew Bernard
Subject: Re: Defining custom symbols
Date: Mon, 16 Apr 2018 19:17:37 +1000

Hi Robert,

Hmm. I have played around with this a bit. I think if you are using safe mode of necessity then you simply can't use lilypond for this use case. Sooner or later you have to mix Lilypond and Scheme, and it is forbidden in safe mode.

Transforming the code for the cut from the repo in question, I came up with this:

====

\version "2.19.81"


#(define larsenSymbolsOutlineWidth 0.065)
#(define larsenSymbolsScale 1.5)
#(define larsenSymbolsOutlineWidth 0.065)

#(define larsenSymbolsHalignFactor (+ (* larsenSymbolsScale ( / 2 3 ) ) .15 ))
#(define larsenSymbolsHalfSize (* .5 larsenSymbolsScale))
#(define larsenSymbolsFlipVertical (* -1 larsenSymbolsScale))

cutCoordinates =   #'(
                       (.4 .9)
                       (.55 .825)
                       )

cutStencil =
\markup \halign #(/ -3 larsenSymbolsHalignFactor) \stencil
#(make-connected-path-stencil
  cutCoordinates
  larsenSymbolsOutlineWidth
  larsenSymbolsScale
  larsenSymbolsScale
  #t
  #t
  )

#(append! default-script-alist
   (list
    `("cut"
       . (
           (text . ,#{ \cutStencil #})
           (stencil . ,ly:text-interface::print)
           ; any other properties
           (toward-stem-shift-in-column . 0.0)
           (padding . 0.20)
           (avoid-slur . around)
           (direction . ,UP)))))

%cut = #(make-articulation "cut")
#(define cut (make-articulation "cut"))

test = {
  \time 2/4
  c''2\cut
  c''
  c''\cut
}

\score {
  \new Staff \test
}
====

But under safe mode Guile throws errors, in accordance with the NR statements.

At this point, we need to turn to greater experts than me. I am sure that my posting this weak code above will stimulate somebody of greater knowledge to show if this really is possible.

In the meantime, the set of Larsen ornamentation glyphs is a really nice library if one is using it in a 'normal' context.

Andrew




reply via email to

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