]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/note-head.cc
Fix [a8 a32].
[lilypond.git] / lily / note-head.cc
index 2b2983be9223d6261a7ebfa14a5959faad0afa09..4b2596c298f19376dcf4b35d74e51fa5a44cb3d9 100644 (file)
@@ -11,7 +11,7 @@
 #include "misc.hh"
 #include "dots.hh"
 #include "note-head.hh"
-#include "debug.hh"
+#include "warn.hh"
 #include "font-interface.hh"
 #include "molecule.hh"
 #include "musical-request.hh"
@@ -73,9 +73,9 @@ Note_head::brew_ledger_lines (Grob *me,
   if (lines_i)
     {
       Real ledgerlinethickness =
-       (me->paper_l ()->get_var ("ledgerlinethickness"));
+       (me->get_paper ()->get_var ("ledgerlinethickness"));
       Real blotdiameter = ledgerlinethickness;
-      //       (me->paper_l ()->get_var ("blotdiameter"));
+      //       (me->get_paper ()->get_var ("blotdiameter"));
       Interval y_extent =
        Interval (-0.5*(ledgerlinethickness),
                  +0.5*(ledgerlinethickness));
@@ -116,19 +116,26 @@ internal_brew_molecule (Grob *me,  bool ledger_take_space)
 
     UGH: use grob-property.
   */
-  SCM log = gh_int2scm (Note_head::balltype_i (me));
+  SCM log = gh_int2scm (Note_head::get_balltype (me));
   SCM exp = scm_list_n (ly_symbol2scm ("find-notehead-symbol"), log,
                        ly_quote_scm (style),
                        SCM_UNDEFINED);
-  String name = "noteheads-" + ly_scm2string (scm_primitive_eval (exp));
-  Molecule out = Font_interface::get_default_font (me)->find_by_name (name);
-  if (out.empty_b())
-    {
-      warning (_f("Symbol not found, ", name.ch_C()));
+  SCM scm_pair = scm_primitive_eval (exp);
+  SCM scm_font_char = ly_car (scm_pair);
+  SCM scm_font_family = ly_cdr (scm_pair);
+  String font_char = "noteheads-" + ly_scm2string (scm_font_char);
+  String font_family = ly_scm2string (scm_font_family);
+  
+   me->set_grob_property("font-family", ly_symbol2scm (font_family.to_str0 ()));
+   Molecule out =
+     Font_interface::get_default_font (me)->find_by_name (font_char);
+   if (out.empty_b())
+     {
+       warning (_f("Symbol not found, ", font_char.to_str0()));
     }
   
   int interspaces = Staff_symbol_referencer::line_count (me)-1;
-  int pos = (int)rint (Staff_symbol_referencer::position_f (me));
+  int pos = (int)rint (Staff_symbol_referencer::get_position (me));
   if (abs (pos) - interspaces > 1)
     {
       Interval hd = out.extent (X_AXIS);
@@ -179,7 +186,8 @@ Note_head::brew_molecule (SCM smob)
 Interval
 Note_head::head_extent (Grob *me, Axis a)
 {
-  return me->get_molecule()->extent (a);
+  Molecule * mol = me->get_molecule();
+  return mol ? mol ->extent (a) : Interval(0,0);
 }
 
 
@@ -190,7 +198,7 @@ SCM
 Note_head::brew_ez_molecule (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-  int l = Note_head::balltype_i (me);
+  int l = Note_head::get_balltype (me);
 
   int b = (l >= 2);
 
@@ -199,10 +207,10 @@ Note_head::brew_ez_molecule (SCM smob)
   Pitch* pit =  unsmob_pitch (spitch);
 
   char s[2] = "a";
-  s[0] = (pit->notename_i_ + 2)%7 + 'a';
+  s[0] = (pit->notename_ + 2)%7 + 'a';
   s[0] = toupper (s[0]);
   
-  SCM charstr = ly_str02scm (s);
+  SCM charstr = scm_makfrom0str (s);
   
   SCM at = scm_list_n (ly_symbol2scm ("ez-ball"),
                       charstr,
@@ -212,7 +220,7 @@ Note_head::brew_ez_molecule (SCM smob)
   Box bx (Interval (0, 1.0), Interval (-0.5, 0.5));
   Molecule m (bx, at);
 
-  int pos = (int)rint (Staff_symbol_referencer::position_f (me));
+  int pos = (int)rint (Staff_symbol_referencer::get_position (me));
   int interspaces = Staff_symbol_referencer::line_count (me)-1;
   if (abs (pos) - interspaces > 1)
     {
@@ -235,7 +243,8 @@ Note_head::stem_attachment_coordinate (Grob *me, Axis a)
     return 0.0;
 
   SCM st = me->get_grob_property ("style");
-  SCM result = gh_apply (v, scm_list_n (st, SCM_UNDEFINED));
+  SCM log = gh_int2scm (get_balltype (me));
+  SCM result = gh_apply (v, scm_list_n (st, log, SCM_UNDEFINED));
 
   if (!gh_pair_p (result))
     return 0.0;
@@ -247,7 +256,7 @@ Note_head::stem_attachment_coordinate (Grob *me, Axis a)
 
 
 int
-Note_head::balltype_i (Grob*me) 
+Note_head::get_balltype (Grob*me) 
 {
   SCM s = me->get_grob_property ("duration-log");
   return gh_number_p (s) ? gh_scm2int (s) <? 2 : 0;