]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/vaticana-ligature.cc
* scm/editor.scm: add char argument.
[lilypond.git] / lily / vaticana-ligature.cc
index ff6289feb2982887f6b9db4d4e6db0c450c4e032..fd73f5405a3c0044c631685f3ee250927d5eb3e5 100644 (file)
@@ -1,16 +1,17 @@
 /*
   vaticana-ligature.cc -- implement Vaticana_ligature
-  
+
   source file of the GNU LilyPond music typesetter
-  
-  (c) 2003--2004 Juergen Reuter <reuter@ipd.uka.de>
+
+  (c) 2003--2005 Juergen Reuter <reuter@ipd.uka.de>
 */
 
+#include "vaticana-ligature.hh"
+
 #include <math.h>
+
 #include "item.hh"
-#include "vaticana-ligature.hh"
 #include "font-interface.hh"
-#include "stencil.hh"
 #include "lookup.hh"
 #include "staff-symbol-referencer.hh"
 #include "note-head.hh"
@@ -26,7 +27,7 @@ vaticana_brew_cauda (Grob *me,
                     Real blotdiameter)
 {
   bool on_staffline = Staff_symbol_referencer::on_staffline (me, pos);
-  int interspaces = Staff_symbol_referencer::line_count (me)-1;
+  int interspaces = Staff_symbol_referencer::line_count (me) - 1;
   bool above_staff = pos > interspaces;
 
   if (delta_pitch > -1)
@@ -78,12 +79,12 @@ vaticana_brew_flexa (Grob *me,
   SCM flexa_height_scm = me->get_property ("flexa-height");
   if (flexa_height_scm != SCM_EOL)
     {
-      interval = ly_scm2int (flexa_height_scm);
+      interval = scm_to_int (flexa_height_scm);
     }
   else
     {
       me->warning ("Vaticana_ligature: "
-                  "flexa-height undefined; assuming 0");
+                  + _ ("flexa-height undefined; assuming 0"));
       interval = 0.0;
     }
 
@@ -92,23 +93,23 @@ vaticana_brew_flexa (Grob *me,
       me->warning (_ ("ascending vaticana style flexa"));
     }
 
-  Real width = robust_scm2double ( me->get_property ("flexa-width"), 2);
+  Real width = robust_scm2double (me->get_property ("flexa-width"), 2);
 
   /*
    * Compensate curve thickness that appears to be smaller in steep
    * section of bend.
    */
-  Real left_height =
-    right_height +
-    min (0.12 * abs (interval), 0.3) * staff_space;
+  Real left_height
+    = right_height
+    min (0.12 * abs (interval), 0.3) * staff_space;
 
   /*
    * Compensate optical illusion regarding vertical position of left
    * and right endings due to curved shape.
    */
-  Real ypos_correction = -0.1*staff_space * sign (interval);
-  Real interval_correction = 0.2*staff_space * sign (interval);
-  Real corrected_interval = interval*staff_space + interval_correction;
+  Real ypos_correction = -0.1 * staff_space * sign (interval);
+  Real interval_correction = 0.2 * staff_space * sign (interval);
+  Real corrected_interval = interval * staff_space + interval_correction;
 
   /*
    * middle curve of flexa shape
@@ -122,29 +123,29 @@ vaticana_brew_flexa (Grob *me,
   Bezier top_curve = curve, bottom_curve = curve;
   for (int i = 0; i < 4; i++)
     {
-      Real curve_thickness = 0.33 * ((3 - i)*left_height + i*right_height);
+      Real curve_thickness = 0.33 * ((3 - i) * left_height + i * right_height);
       top_curve.control_[i] += Offset (0, 0.5 * curve_thickness);
       bottom_curve.control_[i] -= Offset (0, 0.5 * curve_thickness);
     }
 
   if (solid)
     {
-      Stencil solid_head =
-       Lookup::bezier_sandwich (top_curve, bottom_curve);
+      Stencil solid_head
+       Lookup::bezier_sandwich (top_curve, bottom_curve);
       stencil.add_stencil (solid_head);
     }
   else // outline
     {
       Bezier inner_top_curve = top_curve;
       inner_top_curve.translate (Offset (0.0, -line_thickness));
-      Stencil top_edge =
-       Lookup::bezier_sandwich (top_curve, inner_top_curve);
+      Stencil top_edge
+       Lookup::bezier_sandwich (top_curve, inner_top_curve);
       stencil.add_stencil (top_edge);
 
       Bezier inner_bottom_curve = bottom_curve;
       inner_bottom_curve.translate (Offset (0.0, +line_thickness));
-      Stencil bottom_edge =
-       Lookup::bezier_sandwich (bottom_curve, inner_bottom_curve);
+      Stencil bottom_edge
+       Lookup::bezier_sandwich (bottom_curve, inner_bottom_curve);
       stencil.add_stencil (bottom_edge);
 
       /*
@@ -156,12 +157,12 @@ vaticana_brew_flexa (Grob *me,
        * the left end of the bezier curve.
        */
       Box left_edge_box (Interval (0, line_thickness),
-                        Interval (-0.5*left_height, +0.5*left_height));
+                        Interval (-0.5 * left_height, +0.5 * left_height));
       Stencil left_edge = Lookup::filled_box (left_edge_box);
       stencil.add_stencil (left_edge);
 
       Box right_edge_box (Interval (-line_thickness, 0),
-                         Interval (-0.5*right_height, +0.5*right_height));
+                         Interval (-0.5 * right_height, +0.5 * right_height));
       Stencil right_edge = Lookup::filled_box (right_edge_box);
       right_edge.translate_axis (width, X_AXIS);
       right_edge.translate_axis (corrected_interval / 2.0, Y_AXIS);
@@ -183,8 +184,8 @@ vaticana_brew_join (Grob *me, int delta_pitch,
       return Stencil ();
     }
   Interval x_extent = Interval (0, join_thickness);
-  Interval y_extent = (delta_pitch > 0) ?
-    Interval (0, delta_pitch * 0.5 * staff_space) : // ascending join
+  Interval y_extent = (delta_pitch > 0)
+    Interval (0, delta_pitch * 0.5 * staff_space) : // ascending join
     Interval (delta_pitch * 0.5 * staff_space, 0); // descending join
   Box join_box (x_extent, y_extent);
   return Lookup::round_filled_box (join_box, blotdiameter);
@@ -204,25 +205,24 @@ vaticana_brew_primitive (Grob *me)
   String glyph_name = ly_scm2string (glyph_name_scm);
 
   Stencil out;
-  int flexa_height = 0;
-  Real thickness = robust_scm2double ( me->get_property ("thickness"), 1);
+  Real thickness = robust_scm2double (me->get_property ("thickness"), 1);
 
-  Real line_thickness =
-    thickness * me->get_paper ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real line_thickness
+    = thickness * me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
 
-  Real blotdiameter =
-    (me->get_paper ()->get_dimension (ly_symbol2scm ("blotdiameter")));
+  Real blotdiameter
+    = (me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter")));
 
   int pos = Staff_symbol_referencer::get_rounded_position (me);
 
   SCM delta_pitch_scm = me->get_property ("delta-pitch");
   int delta_pitch;
   if (delta_pitch_scm != SCM_EOL)
-    delta_pitch = ly_scm2int (delta_pitch_scm);
+    delta_pitch = scm_to_int (delta_pitch_scm);
   else
     delta_pitch = 0;
 
-  Real x_offset = robust_scm2double ( me->get_property ("x-offset"), 0);
+  Real x_offset = robust_scm2double (me->get_property ("x-offset"), 0);
 
   bool add_stem = to_boolean (me->get_property ("add-stem"));
   bool add_cauda = to_boolean (me->get_property ("add-cauda"));
@@ -238,9 +238,9 @@ vaticana_brew_primitive (Grob *me)
        * flexa_width.)
        */
       Real staff_space = Staff_symbol_referencer::staff_space (me);
-      Real flexa_width  = robust_scm2double ( me->get_property ("flexa-width"), 2)  *staff_space;
-      out =
-       Lookup::blank (Box (Interval (0, 0.5*flexa_width), Interval (0,0)));
+      Real flexa_width = robust_scm2double (me->get_property ("flexa-width"), 2) * staff_space;
+      out
+       = Lookup::blank (Box (Interval (0, 0.5 * flexa_width), Interval (0, 0)));
     }
   else if (!String::compare (glyph_name, "flexa"))
     {
@@ -248,34 +248,34 @@ vaticana_brew_primitive (Grob *me)
     }
   else
     {
-      out =
-       Font_interface::get_default_font (me)->
-       find_by_name ("noteheads-" + glyph_name);
+      out
+       Font_interface::get_default_font (me)->
+       find_by_name ("noteheads." + glyph_name);
     }
   out.translate_axis (x_offset, X_AXIS);
   Real head_width = out.extent (X_AXIS).length ();
 
   if (add_cauda)
     {
-      Stencil cauda =
-       vaticana_brew_cauda (me, pos, delta_pitch,
-                            line_thickness, blotdiameter);
+      Stencil cauda
+       vaticana_brew_cauda (me, pos, delta_pitch,
+                              line_thickness, blotdiameter);
       out.add_stencil (cauda);
     }
 
   if (add_stem)
     {
-      Stencil stem =
-       vaticana_brew_cauda (me, pos, -1,
-                            line_thickness, blotdiameter);
+      Stencil stem
+       vaticana_brew_cauda (me, pos, -1,
+                              line_thickness, blotdiameter);
       stem.translate_axis (head_width - line_thickness, X_AXIS);
       out.add_stencil (stem);
     }
 
   if (add_join)
     {
-      Stencil join =
-       vaticana_brew_join (me, delta_pitch, line_thickness, blotdiameter);
+      Stencil join
+       vaticana_brew_join (me, delta_pitch, line_thickness, blotdiameter);
       join.translate_axis (head_width - line_thickness, X_AXIS);
       out.add_stencil (join);
     }