X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Faccidental.cc;h=696673d9d6ea3ed203133a0b54601f35f35e8310;hb=db4dd36b622417b5fe4c4a4660402e0ac7b5beb1;hp=755ce60e1054cd3063cd9d67b4e6c05103d908b2;hpb=e7020dbb36a9e9c10bda48e5197213e8a3bacef6;p=lilypond.git diff --git a/lily/accidental.cc b/lily/accidental.cc index 755ce60e10..696673d9d6 100644 --- a/lily/accidental.cc +++ b/lily/accidental.cc @@ -1,14 +1,16 @@ /* accidental.cc -- implement Accidental_interface - (c) 2001--2004 Han-Wen Nienhuys + source file of the GNU LilyPond music typesetter - */ + (c) 2001--2004 Han-Wen Nienhuys + ofog +*/ #include "font-interface.hh" #include "item.hh" #include "stencil.hh" #include "accidental-interface.hh" -#include "paper-def.hh" +#include "output-def.hh" #include "pitch.hh" /* @@ -19,13 +21,12 @@ accidental-placement.cc */ - - Stencil parenthesize (Grob*me, Stencil m) { Stencil open = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-leftparen")); Stencil close = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-rightparen")); + m.add_at_edge (X_AXIS, LEFT, Stencil (open), 0,0); m.add_at_edge (X_AXIS, RIGHT, Stencil (close), 0,0); @@ -48,7 +49,7 @@ Accidental_interface::after_line_breaking (SCM smob) } Array -Accidental_interface::accurate_boxes (Grob *a,Grob**common) +Accidental_interface::accurate_boxes (Grob *a, Grob**common) { Box b; b[X_AXIS] = a->extent (a, X_AXIS); @@ -61,16 +62,15 @@ Accidental_interface::accurate_boxes (Grob *a,Grob**common) { SCM cstyle = a->get_property ("cautionary-style"); parens = ly_c_equal_p (cstyle, ly_symbol2scm ("parentheses")); - } SCM accs = a->get_property ("accidentals"); SCM scm_style = a->get_property ("style"); - if (!ly_c_symbol_p (scm_style) + if (!scm_is_symbol (scm_style) && !parens && scm_ilength (accs) == 1) { - if (ly_scm2int (ly_car (accs)) == FLAT) + if (scm_to_int (scm_car (accs)) == FLAT) { Box stem = b; Box bulb = b; @@ -156,7 +156,7 @@ Accidental_interface::get_fontcharname (String style, int alteration) case SHARP: return "mensural1"; } - if (style == "neo_mensural") + if (style == "neomensural") style = ""; // currently same as default if (style == "default") style = ""; @@ -181,7 +181,7 @@ Accidental_interface::print (SCM smob) SCM scm_style = me->get_property ("style"); String style; - if (ly_c_symbol_p (scm_style)) + if (scm_is_symbol (scm_style)) { style = ly_symbol2string (scm_style); } @@ -196,21 +196,24 @@ Accidental_interface::print (SCM smob) Font_metric *fm = 0; if (smaller) { - SCM ac = Font_interface::text_font_alist_chain (me); - ac = scm_cons (scm_cons (scm_cons - (ly_symbol2scm ("font-size"), - scm_int2num (-2)), SCM_EOL), - ac); - fm = select_font (me->get_paper (), ac); + SCM ac = Font_interface::music_font_alist_chain (me); + /* + TODO: should calc font-size by adding -2 to current font-size + */ + ac = scm_cons (scm_list_1 (scm_cons + (ly_symbol2scm ("font-size"), + scm_int2num (-2))), + ac); + fm = select_font (me->get_layout (), ac); } else fm = Font_interface::get_default_font (me); Stencil mol; for (SCM s = me->get_property ("accidentals"); - ly_c_pair_p (s); s = ly_cdr (s)) + scm_is_pair (s); s = scm_cdr (s)) { - int alteration = ly_scm2int (ly_car (s)); + int alteration = scm_to_int (scm_car (s)); String font_char = get_fontcharname (style, alteration); Stencil acc (fm->find_by_name ("accidentals-" + font_char)); @@ -231,7 +234,10 @@ Accidental_interface::print (SCM smob) } - +/* + TODO: should move inside-slur into item? + + */ ADD_INTERFACE (Accidental_interface, "accidental-interface", "a single accidental", - "cautionary cautionary-style style tie accidentals"); + "inside-slur cautionary cautionary-style style tie accidentals");