X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fnote-head.cc;h=445abc8a635eec7332b0eeaac8ef1b66b736ef25;hb=062b17ac5868311ee1e31655da86da1c931ffe31;hp=2cc60c17b691860bd1dd6227b57c14afdbba191d;hpb=baf32731650d510882eeb52d02f4ca0c816c7c29;p=lilypond.git diff --git a/lily/note-head.cc b/lily/note-head.cc index 2cc60c17b6..445abc8a63 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1997--2002 Han-Wen Nienhuys + (c) 1997--2003 Han-Wen Nienhuys */ #include #include @@ -14,7 +14,7 @@ #include "warn.hh" #include "font-interface.hh" #include "molecule.hh" -#include "musical-request.hh" +#include "event.hh" #include "rhythmic-head.hh" #include "staff-symbol-referencer.hh" #include "lookup.hh" @@ -57,6 +57,10 @@ */ +/* + TODO: ledger lines are also a property of the staff. Maybe move them + to there? + */ Molecule Note_head::brew_ledger_lines (Grob *me, int pos, @@ -103,37 +107,26 @@ Note_head::brew_ledger_lines (Grob *me, } Molecule -internal_brew_molecule (Grob *me, bool ledger_take_space) +internal_brew_molecule (Grob *me, bool ledger_take_space) { SCM style = me->get_grob_property ("style"); if (!gh_symbol_p (style)) { - return Molecule(); + return Molecule (); } - /* - ugh: use gh_call () / scm_apply (). - - UGH: use grob-property. - */ 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); - SCM scm_pair = scm_primitive_eval (exp); - SCM scm_font_char = ly_car (scm_pair); - SCM scm_font_family = ly_cdr (scm_pair); + SCM proc = me->get_grob_property ("glyph-name-procedure"); + SCM scm_font_char = scm_call_2 (proc, log, style); 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())); + + Font_metric * fm = Font_interface::get_default_font (me); + Molecule out = fm->find_by_name (font_char); + if (out.empty_b()) + { + me->warning (_f ("note head `%s' not found", font_char.to_str0 ())); } - + int interspaces = Staff_symbol_referencer::line_count (me)-1; int pos = (int)rint (Staff_symbol_referencer::get_position (me)); if (abs (pos) - interspaces > 1) @@ -186,7 +179,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); } @@ -206,7 +200,7 @@ Note_head::brew_ez_molecule (SCM smob) Pitch* pit = unsmob_pitch (spitch); char s[2] = "a"; - s[0] = (pit->notename_ + 2)%7 + 'a'; + s[0] = (pit->get_notename () + 2)%7 + 'a'; s[0] = toupper (s[0]); SCM charstr = scm_makfrom0str (s); @@ -253,7 +247,6 @@ Note_head::stem_attachment_coordinate (Grob *me, Axis a) return gh_number_p (result) ? gh_scm2double (result) : 0.0; } - int Note_head::get_balltype (Grob*me) { @@ -263,5 +256,5 @@ Note_head::get_balltype (Grob*me) ADD_INTERFACE (Note_head,"note-head-interface", "Note head", - "accidental-grob style stem-attachment-function"); + "glyph-name-procedure accidental-grob style stem-attachment-function");