]> git.donarmstrong.com Git - lilypond.git/blobdiff - ly/property-init.ly
Issue 5167/6: Changes: show \markup xxx = ... \etc assignments
[lilypond.git] / ly / property-init.ly
index 7a06995ffebee55775de6c26f6295110fb4b3aac..4923420ffef5181bf0ade63b3d3f8904075017fa 100644 (file)
@@ -8,11 +8,10 @@
 
 %% common definition for all note head styles reverting
 %% (palm mute, harmonics, dead notes, ...)
-defaultNoteHeads =
-#(define-music-function () ()
-  (_i "Revert to the default note head style.")
-  (context-spec-music
-   (revert-head-style '(NoteHead TabNoteHead)) 'Bottom))
+defaultNoteHeads = {
+  \revert NoteHead.style
+  \revert TabNoteHead.style
+}
 
 accidentalStyle =
 #(define-music-function
@@ -26,7 +25,7 @@ piano styles, which use @samp{GrandStaff} as a context." )
     ((1) (set-accidental-style (car style)))
     ((2) (set-accidental-style (cadr style) (car style)))
     (else
-     (ly:parser-error (*parser*) (_ "not an accidental style")
+     (ly:parser-error (_ "not an accidental style")
       (*location*))
      (make-music 'Music))))
 
@@ -405,6 +404,21 @@ palmMute =
    (_i "Print @var{note} with a triangle-shaped note head.")
    (style-note-heads 'NoteHead 'do note))
 
+%% part combiner
+
+partcombineForce =
+#(define-music-function (type) ((symbol?))
+   (_i "Override the part-combiner.")
+   (if type (propertySet 'partCombineForced type)
+       (propertyUnset 'partCombineForced)))
+
+partcombineApart = \partcombineForce #'apart
+partcombineChords = \partcombineForce #'chords
+partcombineUnisono = \partcombineForce #'unisono
+partcombineSoloI = \partcombineForce #'solo1
+partcombineSoloII = \partcombineForce #'solo2
+partcombineAutomatic = \partcombineForce \default
+
 
 %% phrasing slurs
 
@@ -733,17 +747,36 @@ allowVoltaHook =
 
 %% x notes
 
-xNotesOn =
-#(define-music-function () ()
-  (_i "Set the default note head style to a cross-shaped style.")
-  (context-spec-music
-   (override-head-style '(TabNoteHead NoteHead) 'cross) 'Bottom))
+#(define (cross-style grob)
+;; Returns the symbol 'cross to set the 'style-property for (Tab-)NoteHead.
+;; If the current text-font doesn't contain the glyph set 'font-name to '()
+;; and 'font-family to 'feta.
+;; If 'feta is replaced by another music-font without cross-style-glyphs
+;; note-head.cc throws a warning and no visual output happens.
+  (let* ((layout (ly:grob-layout grob))
+         (props (ly:grob-alist-chain grob))
+         (font (ly:paper-get-font layout props))
+         (font-unknown? (string=? (ly:font-name font) "unknown")))
+    (if font-unknown?
+        (begin
+          (ly:grob-set-property! grob 'font-name '())
+          (ly:grob-set-property! grob 'font-family 'feta)))
+    'cross))
+
+%% Set the default note head style to a cross-shaped style.
+xNotesOn = {
+  \temporary \override NoteHead.style = #cross-style
+  \temporary \override TabNoteHead.style = #cross-style
+}
+
 xNotesOff = \defaultNoteHeads
+
 xNote =
 #(define-music-function (note) (ly:music?)
-   (_i "Print @var{note} with a cross-shaped note head.")
-   (style-note-heads '(TabNoteHead NoteHead) 'cross note))
-
+  (_i "Print @var{note} with a cross-shaped note head.")
+   (if (eq? (ly:music-property note 'name) 'NoteEvent)
+       #{ \tweak style #cross-style $note #}
+       #{ \xNotesOn $note \xNotesOff #}))
 
 %% dead notes (these need to come after "x notes")