[ << Interfaces for programmers ] | [Top][Contents][Index][ ? ] | [ Literature list >> ] | ||
[ < Scheme procedures as properties ] | [ Up : Interfaces for programmers ] | [ Difficult tweaks > ] |
6.7 Using Scheme code instead of \tweak
The main disadvantage of \tweak
is its syntactical
inflexibility. For example, the following produces a syntax error.
F = \tweak #'font-size #-3 -\flageolet \relative c'' { c4^\F c4_\F }
With other words, \tweak
doesn’t behave like an articulation
regarding the syntax; in particular, it can’t be attached with
^
and _
.
Using Scheme, this problem can be circumvented. The route to the
result is given in Adding articulation to notes (example),
especially how to use \displayMusic
as a helping guide.
F = #(let ((m (make-music 'ArticulationEvent 'articulation-type "flageolet"))) (set! (ly:music-property m 'tweaks) (acons 'font-size -3 (ly:music-property m 'tweaks))) m) \relative c'' { c4^\F c4_\F }
Here, the tweaks
properties of the flageolet object
m
(created with make-music
) are extracted with
ly:music-property
, a new key-value pair to change the
font size is prepended to the property list with the
acons
Scheme function, and the result is finally
written back with set!
. The last element of the
let
block is the return value, m
itself.
[ << Interfaces for programmers ] | [Top][Contents][Index][ ? ] | [ Literature list >> ] | ||
[ < Scheme procedures as properties ] | [ Up : Interfaces for programmers ] | [ Difficult tweaks > ] |
Andere Sprachen: español.