X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fnote-head.cc;h=73a2255d9040a91199e994cf05c2fe0e6f9a74b5;hb=b872748c6aa8bb721ced458691b38ac2fac5dfc8;hp=de22c1c8cd3960b829e1b04e10b607de7415ae20;hpb=fced4c8b6dd10bbf16e7f6196d5ef8eb9e00b1c9;p=lilypond.git diff --git a/lily/note-head.cc b/lily/note-head.cc index de22c1c8cd..73a2255d90 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 1997--2011 Han-Wen Nienhuys + Copyright (C) 1997--2015 Han-Wen Nienhuys 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); - } + string suffix = ::to_string (min (robust_scm2int (me->get_property ("duration-log"), 2), 2)); + if (style != "default") + suffix = robust_scm2string (me->get_property ("glyph-name"), ""); Font_metric *fm = Font_interface::get_default_font (me); @@ -57,24 +51,45 @@ internal_print (Grob *me, string *font_char) Stencil out = fm->find_by_name (idx_either + suffix); if (out.is_empty ()) { - Grob *stem = unsmob_grob (me->get_object ("stem")); + Grob *stem = unsmob (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"); - 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 () - && !Staff_symbol_referencer::on_line - (me, - robust_scm2int (me->get_property ("staff-position"), 0))) - 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; + } + } + } + + if (style == "kievan" + && 3 == robust_scm2int (me->get_property ("duration-log"), 2)) + { + Grob *stem = unsmob (me->get_object ("stem")); + Grob *beam = unsmob (stem->get_object ("beam")); + if (beam) + out = fm->find_by_name (idx_either + "2kievan"); + } 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", @@ -94,8 +109,8 @@ MAKE_SCHEME_CALLBACK (Note_head, stem_x_shift, 1); SCM Note_head::stem_x_shift (SCM smob) { - Grob *me = unsmob_grob (smob); - Grob *stem = unsmob_grob (me->get_object ("stem")); + Grob *me = unsmob (smob); + Grob *stem = unsmob (me->get_object ("stem")); if (stem) (void) stem->get_property ("positioning-done"); @@ -106,7 +121,7 @@ MAKE_SCHEME_CALLBACK (Note_head, print, 1); SCM Note_head::print (SCM smob) { - Grob *me = unsmob_grob (smob); + Grob *me = unsmob (smob); string idx; return internal_print (me, &idx).smobbed_copy (); @@ -116,7 +131,7 @@ MAKE_SCHEME_CALLBACK (Note_head, include_ledger_line_height, 1); SCM Note_head::include_ledger_line_height (SCM smob) { - Grob *me = unsmob_grob (smob); + Grob *me = unsmob (smob); Grob *staff = Staff_symbol_referencer::get_staff_symbol (me); if (staff) @@ -147,7 +162,7 @@ Note_head::stem_attachment_coordinate (Grob *me, Axis a) } Offset -Note_head::get_stem_attachment (Font_metric *fm, string key) +Note_head::get_stem_attachment (Font_metric *fm, const string &key) { Offset att; @@ -175,7 +190,7 @@ MAKE_SCHEME_CALLBACK (Note_head, calc_stem_attachment, 1); SCM Note_head::calc_stem_attachment (SCM smob) { - Grob *me = unsmob_grob (smob); + Grob *me = unsmob (smob); Font_metric *fm = Font_interface::get_default_font (me); string key; internal_print (me, &key); @@ -189,10 +204,13 @@ ADD_INTERFACE (Note_head, " @ruser{Note head styles}.", /* properties */ + "duration-log " "note-names " "accidental-grob " + "ignore-ambitus " "glyph-name " "stem-attachment " "style " + "ledger-positions " );