]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/accidental.cc
NEWS item for table of contents
[lilypond.git] / lily / accidental.cc
index 46db4f4f2f0bf51af1694c30dfc0fe3827d014e2..3e5d0475f7afa671f23187b9616e8f81ef70df0a 100644 (file)
@@ -66,14 +66,19 @@ Accidental_interface::accurate_boxes (Grob *me, Grob **common)
   vector<Box> boxes;
 
   bool parens = to_boolean (me->get_property ("parenthesized"));
+  if (!me->is_live ())
+    return boxes;
 
-  SCM scm_style = me->get_property ("style");
-  if (!scm_is_symbol (scm_style)
-      && !to_boolean (me->get_property ("restore-first"))
+  if (!to_boolean (me->get_property ("restore-first"))
       && !parens)
     {
-      Rational alteration = ly_scm2rational (me->get_property ("alteration"));
-      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;
@@ -82,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
@@ -93,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;
@@ -151,7 +158,7 @@ Accidental_interface::print (SCM smob)
   if (!scm_is_string (glyph_name))
     {
       me->warning (_f ("Could not find glyph-name for alteration %s",
-                      ly_scm2rational (alt).to_string ().c_str ()));
+                      ly_scm_write_string (alt).c_str ()));
       return SCM_EOL;
     }