]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/note-head.cc
Display postevents on drum notes, rests and spacer rests
[lilypond.git] / lily / note-head.cc
index 0ddba1fe1390353140eda215e1f833b609d7c1a1..fb93e40eeb82f02574c2fa670183d19054214fd6 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1997--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -36,17 +36,11 @@ using namespace std;
 static Stencil
 internal_print (Grob *me, string *font_char)
 {
-  SCM style = me->get_property ("style");
-  if (!scm_is_symbol (style))
-    style = ly_symbol2scm ("default");
+  string style = robust_symbol2string (me->get_property ("style"), "default");
 
   string suffix = to_string (min (robust_scm2int (me->get_property ("duration-log"), 2), 2));
-  if (style != ly_symbol2scm ("default"))
-    {
-      SCM gn = me->get_property ("glyph-name");
-      if (scm_is_string (gn))
-        suffix = ly_scm2string (gn);
-    }
+  if (style != "default")
+    suffix = robust_scm2string (me->get_property ("glyph-name"), "");
 
   Font_metric *fm = Font_interface::get_default_font (me);
 
@@ -63,18 +57,30 @@ internal_print (Grob *me, string *font_char)
       if (stem_dir == CENTER)
         programming_error ("must have stem dir for note head");
 
-      idx_either = idx_directed = prefix + ((stem_dir == UP) ? "u" : "d");
+      idx_either = idx_directed = prefix + (stem_dir == UP ? "u" : "d");
+      out = fm->find_by_name (idx_either + suffix);
     }
 
-  out = fm->find_by_name (idx_either + "r" + suffix);
-  if (!out.is_empty () && scm_is_false (
-                            scm_zero_p (
-                              scm_modulo (me->get_property ("staff-position"),
-                                          scm_from_int (2)))))
-      idx_either += "r";
+  if (style == "mensural"
+      || style == "neomensural"
+      || style == "petrucci"
+      || style == "baroque"
+      || style == "kievan")
+    {
+      if (!Staff_symbol_referencer::on_line
+          (me,
+           robust_scm2int (me->get_property ("staff-position"), 0)))
+        {
+          Stencil test = fm->find_by_name (idx_either + "r" + suffix);
+          if (!test.is_empty ())
+            {
+              idx_either += "r";
+              out = test;
+            }
+        }
+    }
 
   idx_either += suffix;
-  out = fm->find_by_name (idx_either);
   if (out.is_empty ())
     {
       me->warning (_f ("none of note heads `%s' or `%s' found",