]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/accidental.cc
* lily/accidental.cc: special bboxes for natural.
[lilypond.git] / lily / accidental.cc
index 2377a6a940976a6f569dd7c4b97e744f25040480..54c68cb640b2de30292d6eedd5235b57b020a7f4 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
   
-  (c) 2001--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 2001--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "font-interface.hh"
@@ -28,14 +28,14 @@ parenthesize (Grob*me, Stencil m)
   Stencil open = Font_interface::get_default_font (me)->find_by_name ("accidentals.leftparen");
   Stencil close = Font_interface::get_default_font (me)->find_by_name ("accidentals.rightparen");
 
-  m.add_at_edge (X_AXIS, LEFT, Stencil (open), 0,0);
-  m.add_at_edge (X_AXIS, RIGHT, Stencil (close), 0,0);
+  m.add_at_edge (X_AXIS, LEFT, Stencil (open), 0, 0);
+  m.add_at_edge (X_AXIS, RIGHT, Stencil (close), 0, 0);
 
   return m;
 }
 
 
-MAKE_SCHEME_CALLBACK (Accidental_interface,after_line_breaking,1);
+MAKE_SCHEME_CALLBACK (Accidental_interface, after_line_breaking, 1);
 SCM
 Accidental_interface::after_line_breaking (SCM smob)
 {
@@ -71,7 +71,9 @@ Accidental_interface::accurate_boxes (Grob *a, Grob**common)
       && !parens
       && scm_ilength (accs) == 1)
     {
-      if (scm_to_int (scm_car (accs)) == FLAT)
+      switch (scm_to_int (scm_car (accs))
+      {
+      case FLAT:
        {
          Box stem = b;
          Box bulb = b;
@@ -91,9 +93,28 @@ Accidental_interface::accurate_boxes (Grob *a, Grob**common)
          boxes.push (bulb);
          boxes.push (stem);
        }
-      
+       break;
+      case NATURAL:
+       {
+         Box lstem = b;
+         Box rstem = b;
+         Box belly = b;
+
+         lstem[Y_AXIS] *= 1.1;
+         rstem[Y_AXIS] *= 1.1;
+         
+         belly[Y_AXIS] *= 0.75;
+         lstem[X_AXIS][RIGHT] *= .5;
+         rstem[X_AXIS][LEFT] = lstem[X_AXIS][RIGHT];
+         lstem[Y_AXIS][DOWN] = belly[Y_AXIS][DOWN];
+         rstem[Y_AXIS][UP] = belly[Y_AXIS][UP];
+         boxes.push (belly);
+         boxes.push (lstem);
+         boxes.push (rstem);
+       }
+       break;
       /*
-       TODO: add support for natural, double flat.
+       TODO: add support for, double flat.
        */
     }
 
@@ -164,7 +185,7 @@ Accidental_interface::get_fontcharname (String style, int alteration)
   return style + to_string (alteration);
 }
 
-MAKE_SCHEME_CALLBACK (Accidental_interface,print,1);
+MAKE_SCHEME_CALLBACK (Accidental_interface, print, 1);
 SCM
 Accidental_interface::print (SCM smob)
 {
@@ -224,7 +245,7 @@ Accidental_interface::print (SCM smob)
        }
       else
        {
-         mol.add_at_edge (X_AXIS,  RIGHT, acc, 0.1,0);
+         mol.add_at_edge (X_AXIS,  RIGHT, acc, 0.1, 0);
        }
     }