]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/note-head.cc
(DECLARE_BASE_SMOBS): add methods
[lilypond.git] / lily / note-head.cc
index abf3599ac2a37838e3b89bae5bb430aa9e1f1ff8..025207991460f21734ec16b93f55e0aa1dc7be33 100644 (file)
@@ -39,37 +39,34 @@ internal_print (Grob *me, String *font_char)
     }
 
   SCM log = scm_int2num (Note_head::get_balltype (me));
-  SCM proc = me->get_property ("glyph-name-procedure");
-
-  String suffix =  to_string (robust_scm2int (me->get_property ("duration-log"), 2));
-  if (ly_is_procedure (proc))
-    suffix = ly_scm2string (scm_call_2 (proc, log, style));
-  
-  Font_metric *fm = Font_interface::get_default_font (me);
-
-  Direction stem_dir = CENTER;
-  if (Grob *stem = unsmob_grob (me->get_object ("stem")))
+  String suffix =  to_string (min (robust_scm2int (me->get_property ("duration-log"), 2), 2));
+  if (style != ly_symbol2scm ("default"))
     {
-      stem_dir = get_grob_direction (stem);
-      if (stem_dir == CENTER)
-       programming_error ("must have stem dir for note head");
-    }
+      SCM proc = me->get_property ("glyph-name-procedure");
+      if (ly_is_procedure (proc))
+       suffix = ly_scm2string (scm_call_2 (proc, log, style));
+    }  
+  Font_metric *fm = Font_interface::get_default_font (me);
 
-  Stencil out;
+  String idx = "noteheads.s" + suffix;
 
-  String prefix = "noteheads.";
-  String idx
-    = prefix + ((stem_dir == UP) ? "u" : "d") + suffix;
-  out = fm->find_by_name (idx);
+  Stencil out = fm->find_by_name (idx);
   if (out.is_empty ())
     {
-      idx = prefix + "s" + suffix;
+      String prefix = "noteheads.";
+      Grob *stem = unsmob_grob (me->get_object ("stem"));
+      Direction stem_dir = stem ? get_grob_direction (stem) : CENTER;
+      
+      if (stem_dir == CENTER)
+       programming_error ("must have stem dir for note head");
+      String idx = prefix + ((stem_dir == UP) ? "u" : "d") + suffix;
       out = fm->find_by_name (idx);
     }
 
   if (out.is_empty ())
     {
       me->warning (_f ("note head `%s' not found", idx.to_str0 ()));
+      out = Stencil (Box(Interval (0, 0),Interval (0, 0)), SCM_EOL);
     }
   else
     {