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}

Since that isn't possible in LilyPond, I searched the documentation and
the LilyPond sources some minutes, found ly:context-pushpop-property
and an example of it in wilhelmus.ly.

After a first quick hack I sent to Roland, I tried the following refined
(yet not working) solution:

  % Helper for single context-overrides.
  #(define (single-context-override context-name property-name)
    (lambda (value)
      (lambda (context)
        (ly:context-pushpop-property context context-name property-name value)
      )
    )
  )

That function can be used for defining context-overriding functions. For
example (to use Rolands use case):

  #(define textshift (single-context-override 'TextScript 'extra-offset))

That can be used in the music expressions by

  \applycontext #(textshift '(0 . -1.5))

Unfortunately, that doesn't imply the semantic of \once. There seems to
be an internal *music* property named 'once', but I've no idea wether
or how that can be used here.

Has anyone an idea of how to get the property really set *once*?

Ciao,
        Kili


_______________________________________________
Lilypond-user mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/lilypond-user

Reply via email to