[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-user
Subject:    Re: Conditional markup? UP|DOWN
From:       Aaron Hill <lilypond () hillvisions ! com>
Date:       2024-04-29 16:43:07
Message-ID: abad423edfbb816eb5955e2b70503209 () hillvisions ! com
[Download RAW message or body]


On 2024-04-29 7:50 am, Pierre-Luc Gauthier wrote:
> Can a markup command introspect its direction ?
> 
> Is it possible to set in a markup command some conditionals (not paper
> related) ?
> 
> \version "2.25.15"
> 
> #(define-markup-command (conditionalMrkp layout props)
>    ()
>    (interpret-markup layout props #{
>      \markup {
>        %\if #DOWN
>        "↑"
>        %\if #UP
>        "↓"
>                      }#}))
> 
> {b'^\markup \conditionalMrkp b'_\markup \conditionalMrkp}


%%%%
\version "2.24.3"

is-directional =
#(lambda (layout props)
   (number? (chain-assoc-get 'direction props #f)))

is-upward =
#(lambda (layout props)
   (eq? UP (chain-assoc-get 'direction props #f)))

is-downward =
#(lambda (layout props)
   (eq? DOWN (chain-assoc-get 'direction props #f)))

asdf = \markup \circle \overlay {
   \if \is-upward ↑ \if \is-downward ↓
   \unless \is-directional \pad-around #0.25 *
}

\layout { indent = 0 }
\asdf
{ b'4-\asdf 4_\asdf 2^\asdf }
%%%%


-- Aaron Hill
["markup-direction.cropped.png" (image/png)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic