[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting the direction when defining a new markup command
From: |
David Kastrup |
Subject: |
Re: Getting the direction when defining a new markup command |
Date: |
Sat, 12 Nov 2016 00:07:44 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Kevin Barry <address@hidden> writes:
> Dear All,
>
> I am trying to set the direction of an arrow in a markup function
> based on whether the markup is placed above or below the staff, but I
> am ready to give up. Here is a condensed version of my most recent
> attempt. Does anyone know how to do this?
>
> \version "2.19.45"
>
> #(define-markup-command (test layout props arg)
> (integer?)
> (let ((dir (lambda (grob)
> (if (= UP (ly:grob-property grob 'direction))
> -1
> 1))))
> (interpret-markup layout props
> #{
> \markup { \arrow-head #Y #dir ##f }
> #})))
>
> \markup \test #1
"based on whether the markup is placed above or below the staff"? What
staff? Your example is a bit too minimal.
How about
\version "2.19.45"
#(define-markup-command (test layout props arg)
(integer?) #:properties ((direction))
(interpret-markup layout props
#{
\markup { \arrow-head #Y #direction ##f }
#}))
\new Staff {
c^\markup \test #1 _\markup \test #2
}
--
David Kastrup