[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Simulating parametrized `macros' for single context overrides
From: |
Nicolas Sceaux |
Subject: |
Re: Simulating parametrized `macros' for single context overrides |
Date: |
Thu, 15 Apr 2004 18:48:43 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Bonjour Matthias!
Wed, 14 Apr 2004 20:08:45 +0200, tu as dit :
> Hi all,
> earlier this day, Roland did ask me (per PM) a question leading to an
> IMHO very usable little helper.
> Ronald wanted some feature like the following:
> - At top level, define
> textshift = \once\override TextScript #'extra-offset = #'(#1 . #2)
> - Within music expressions, use
> \textshift{0}{-1.5}
I use the following:
----------------------------------------
#(use-modules (ice-9 optargs))
#(define*-public (mus:make-context context element #:key id (operations '()))
"Base function for building ContextSpeccedMusic objects."
(apply make-music (append (list 'ContextSpeccedMusic
'property-operations operations
'context-type context
'element element)
(if id (list 'context-id id) '()))))
#(define*-public (mus:override context layout property val #:optional once)
"Layout property override.
\once \override Voice.Fingering #'padding = #3
<=>
(mus:override 'Voice 'Fingering 'padding 3 #t)"
(mus:make-context context (make-music 'OverrideProperty
'once once
'grob-property property
'grob-value val
'symbol layout)))
#(define* (textshift dx dy #:optional once)
(ly:export
(mus:override 'Bottom 'TextScript 'extra-offset (cons dx dy) once)))
\score {
\notes {
\fatText
c'^"normal text"
#(textshift 3 2 #t)
c'^"shifted text once"
c'^"normal text"
}
}
----------------------------------------
nicolas