lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue 4931 make deadNote work with other font-settings (issue 309780043


From: thomasmorley65
Subject: Issue 4931 make deadNote work with other font-settings (issue 309780043 by address@hidden)
Date: Wed, 27 Jul 2016 05:30:42 -0700

Reviewers: ,

Description:
Issue 4931 make deadNote work with other font-settings

This is done by temporarily setting font-name to '(), causing the
default-font (usually Feta) to take over, reverting this later.
The regtest dead-notes.ly is altered accordingly.
Also, ly-syntax is used where possible.
palmMute and harmonic are not affected by this patch and still
work nicely.

Please review this at https://codereview.appspot.com/309780043/

Affected files (+62, -31 lines):
  M input/regression/dead-notes.ly
  M ly/property-init.ly


Index: input/regression/dead-notes.ly
diff --git a/input/regression/dead-notes.ly b/input/regression/dead-notes.ly
index 62e94fdb8ede149ac1c6b58852b1cb9c2ba46aab..50cd9c2efb241831e92bb558974268255a3c7a26 100644
--- a/input/regression/dead-notes.ly
+++ b/input/regression/dead-notes.ly
@@ -1,7 +1,8 @@
 \version "2.16.0"

 \header{ texidoc = "Muted notes (also called dead notes) are supported
-                    within normal staves and tablature."
+                    within normal staves and tablature.  They are printed
+ correctly, even if another font for TabNoteHead is used. "
        }

 mynotes = \relative c,, {
@@ -15,25 +16,49 @@ mynotes = \relative c,, {
    \bar "|."
 }

-\context StaffGroup <<
-  \context Staff {
-    \context Voice {  % Warning: explicit voice instantiation is required
-                      %   to have deadNotesOff work properly
-                      %   when deadNotesOn comes at the beginning
-                      %   of the piece
-      \clef "bass_8"
-      \mynotes
+\score {
+  \new StaffGroup <<
+    \new Staff {
+      \new Voice {  % Warning: explicit voice instantiation is required
+                        %   to have deadNotesOff work properly
+                        %   when deadNotesOn comes at the beginning
+                        %   of the piece
+        \clef "bass_8"
+        \mynotes
+      }
     }
-  }
-  \context TabStaff {
-    \context TabVoice {  % Warning:  explicit voice instantiation is
-                         %   required to have deadNotesOff work properly
-                         %   when deadNotesOn comes at the beginning
-                         %   of the piece
-      \set TabStaff.stringTunings = #bass-tuning
-      \mynotes
+    \new TabStaff
+      \with {
+        instrumentName = \markup \tiny "default-font"
+      }{
+      \new TabVoice {  % Warning:  explicit voice instantiation is
+                           %   required to have deadNotesOff work properly
+                           %   when deadNotesOn comes at the beginning
+                           %   of the piece
+        \mynotes
+      }
+    }
+    \new TabStaff
+      \with {
+        \override TabNoteHead.font-name = #"Luxi Mono"
+        instrumentName =
+ \markup \tiny \center-column { "TabNoteHead-" "font:" "Luxi Mono" }
+      }{
+      \new TabVoice {  % Warning:  explicit voice instantiation is
+                           %   required to have deadNotesOff work properly
+                           %   when deadNotesOn comes at the beginning
+                           %   of the piece
+        \mynotes
+      }
+    }
+  >>
+  \layout {
+    indent = 20
+    \context {
+      \TabStaff
+      stringTunings = #bass-tuning
     }
   }
->>
+}


Index: ly/property-init.ly
diff --git a/ly/property-init.ly b/ly/property-init.ly
index 85adb52bb08b5b3314cecfed4d249097a2de86f2..e6fa8e94d2d11d1f99a46adea355afb82f31f786 100644
--- a/ly/property-init.ly
+++ b/ly/property-init.ly
@@ -8,11 +8,12 @@

 %% 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
+  \revert NoteHead.font-name
+  \revert TabNoteHead.font-name
+}

 accidentalStyle =
 #(define-music-function
@@ -748,17 +749,22 @@ 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))
+%% Set the default note head style to a cross-shaped style.
+%% Revert 'font-name in order to use the default.
+xNotesOn = {
+  \temporary \override NoteHead.style = #'cross
+  \temporary \override TabNoteHead.style = #'cross
+  \temporary \override NoteHead.font-name = #'()
+  \temporary \override TabNoteHead.font-name = #'()
+}
 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. Unset @code{font-name}
+to get default font.")
+  (if (eq? (ly:music-property note 'name) 'NoteEvent)
+      #{ \tweak font-name #'() \tweak style #'cross $note #}
+      #{ \xNotesOn $note \xNotesOff #}))

 %% dead notes (these need to come after "x notes")






reply via email to

[Prev in Thread] Current Thread [Next in Thread]