Status: Accepted
Owner: ----
Labels: Type-Documentation Frog
New issue 2322 by [email protected]: Add "layout-from" function to
documentation
http://code.google.com/p/lilypond/issues/detail?id=2322
David Kastrup wrote a function that extracts settings from a music
expression and transform them to something that can be used inside \layout
block.
"layout-from" =
#(define-void-function (parser location music)
(ly:music?)
(_i "To be used in output definitions. Take the layout instruction
events from @var{music} and do the equivalent of context modifications
duplicating their effect.")
(define (musicop m mods)
(if (music-is-of-type? m 'layout-instruction-event)
(ly:add-context-mod
mods
(case (ly:music-property m 'name)
((PropertySet)
(list 'assign
(ly:music-property m 'symbol)
(ly:music-property m 'value)))
((PropertyUnset)
(list 'unset
(ly:music-property m 'symbol)))
((OverrideProperty)
(list 'push
(ly:music-property m 'symbol)
(ly:music-property m 'grob-property-path)
(ly:music-property m 'grob-value)))
((RevertProperty)
(list 'pop
(ly:music-property m 'symbol)
(ly:music-property m 'grob-property-path)))))
(case (ly:music-property m 'name)
((SequentialMusic SimultaneousMusic)
(for-each (lambda (x)
(musicop x mods))
(ly:music-property m 'elements)))
((ContextSpeccedMusic)
(module-set! (current-module)
(ly:music-property m 'context-type)
#{ \context { $(module-ref (current-module)
(ly:music-property m
'context-type))
$(musicop (ly:music-property m
'element)
(ly:make-context-mod))
} #}))))
mods)
(musicop music (ly:make-context-mod)))
it would be good to add it to documentation, perhaps as a snippet in NR
4.2.1.
more information in
http://thread.gmane.org/gmane.comp.gnu.lilypond.devel/43324/focus=43449
_______________________________________________
bug-lilypond mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-lilypond