From: Han-Wen Nienhuys Date: Thu, 1 Feb 2007 10:19:29 +0000 (+0100) Subject: Padding for key-signature-interface; more accurate outline for mirroredflat. X-Git-Tag: release/2.11.15-2~10 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=364b9b4cec5581f40b05d25ed0de3719bfc8f3c8;p=lilypond.git Padding for key-signature-interface; more accurate outline for mirroredflat. --- diff --git a/lily/accidental.cc b/lily/accidental.cc index 571c33cbea..3e5d0475f7 100644 --- a/lily/accidental.cc +++ b/lily/accidental.cc @@ -72,9 +72,13 @@ Accidental_interface::accurate_boxes (Grob *me, Grob **common) if (!to_boolean (me->get_property ("restore-first")) && !parens) { - Rational alteration - = robust_scm2rational (me->get_property ("alteration"), 0); - if (alteration == FLAT_ALTERATION) + SCM alist = me->get_property ("glyph-name-alist"); + SCM alt = me->get_property ("alteration"); + string glyph_name = robust_scm2string (ly_assoc_get (alt, alist, SCM_BOOL_F), + ""); + + if (glyph_name == "accidentals.flat" + || glyph_name == "accidentals.mirroredflat") { Box stem = b; Box bulb = b; @@ -83,7 +87,9 @@ Accidental_interface::accurate_boxes (Grob *me, Grob **common) we could make the stem thinner, but that places the flats really close. */ - stem[X_AXIS][RIGHT] *= .5; + Direction bulb_dir = + glyph_name=="accidentals.mirroredflat" ? LEFT : RIGHT; + stem[X_AXIS][bulb_dir] = stem[X_AXIS].center (); /* To prevent vertical alignment for 6ths @@ -94,7 +100,7 @@ Accidental_interface::accurate_boxes (Grob *me, Grob **common) boxes.push_back (bulb); boxes.push_back (stem); } - else if (alteration == NATURAL_ALTERATION) + else if (glyph_name == "accidentals.natural") { Box lstem = b; Box rstem = b; diff --git a/lily/key-signature-interface.cc b/lily/key-signature-interface.cc index d4ddb075e8..1e67331961 100644 --- a/lily/key-signature-interface.cc +++ b/lily/key-signature-interface.cc @@ -65,15 +65,17 @@ Key_signature_interface::print (SCM smob) ? scm_from_int (0) : scm_cdar (s); - SCM glyph_name = ly_assoc_get (alt, alist, SCM_BOOL_F); - if (!scm_is_string (glyph_name)) + SCM glyph_name_scm = ly_assoc_get (alt, alist, SCM_BOOL_F); + if (!scm_is_string (glyph_name_scm)) { me->warning (_f ("No glyph found for alteration: %s", ly_scm2rational (alt).to_string ().c_str ())); continue; } - - Stencil acc (fm->find_by_name (ly_scm2string (glyph_name))); + + string glyph_name = ly_scm2string (glyph_name_scm); + + Stencil acc (fm->find_by_name (glyph_name)); if (acc.is_empty ()) me->warning (_ ("alteration not found")); @@ -91,11 +93,12 @@ Key_signature_interface::print (SCM smob) has vertical edges on both sides. A little padding is needed to prevent collisions. */ - Real padding = 0.0; - if (is_cancellation + Real padding = robust_scm2double (me->get_property ("padding"), + 0.0); + if (glyph_name == "accidentals.natural" && last_pos < pos + 2 && last_pos > pos - 6) - padding = 0.3; + padding += 0.3; mol.add_at_edge (X_AXIS, LEFT, acc, padding); last_pos = pos; @@ -113,5 +116,6 @@ ADD_INTERFACE (Key_signature_interface, "alteration-alist " "c0-position " "glyph-name-alist " + "padding " "style " );