]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/text-spanner.cc: add bound-padding.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 18 Apr 2005 12:29:24 +0000 (12:29 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 18 Apr 2005 12:29:24 +0000 (12:29 +0000)
* lily/paper-book.cc (systems): accept Paper_score
iso. Paper_system vector.

* lily/line-interface.cc (make_arrow): new function. Patch by
Jonatan Liljedahl <http://kymatica.com>
(arrows): idem.

* lily/line-spanner.cc (line_stencil): add arrows.

ChangeLog
lily/include/paper-book.hh
lily/line-interface.cc
lily/line-spanner.cc
lily/paper-book.cc
lily/text-spanner.cc

index c3a7b33cea3f8f6ef6cfc9c72a113e18ed4fd107..67ec9a0694d5e4b1fb11ffe2eeb0ee15d3da0232 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2005-04-18  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/text-spanner.cc: add bound-padding.
+
        * lily/paper-book.cc (systems): accept Paper_score
        iso. Paper_system vector. 
 
@@ -12,7 +14,6 @@
        (arrows): idem.
 
        * lily/line-spanner.cc (line_stencil): add arrows.
-       
 
 2005-04-18  Mathieu Giraud  <magiraud@free.fr>
 
index 982d5f241fd4c26089ff6c532875f6f1d5b0111d..310a321d99fa3457d96758495365e1410a854e8f 100644 (file)
@@ -26,6 +26,7 @@ class Paper_book
   SCM systems_;
   SCM pages_;
 
+  void add_score_title (SCM);
 public:
   SCM header_;
   SCM header_0_;
index 9fd5d4ca6e2568669ae1a995b5572505ca23bc18..c2dc7b9854536a3e1ee0aa25c520a114dcc02964 100644 (file)
 #include "output-def.hh"
 
 Stencil
-Line_interface::make_arrow (Offset beg, Offset end,
+Line_interface::make_arrow (Offset begin, Offset end,
                            Real thick,
                            Real length, Real width)
 {
-  Real angle = (end - beg).arg();
+  Real angle = (end - begin).arg();
   Array<Offset> points;
   
   //construct the arrow
   points.push (Offset (0, 0));
-  points.push (Offset (length, width));
-  points.push (Offset (length, -width));
+  points.push (Offset (-length, width));
+  points.push (Offset (-length, -width));
 
   // rotate and translate the arrow
   for (int i = 0; i < points.size(); i++)
-    points[i] = points[i] * complex_exp (Offset (0, angle)) + beg;
+    points[i] = points[i] * complex_exp (Offset (0, angle)) + end;
     
-  // we must shorten the line half of arrow length
-  // to prevent the line from sticking out
-  beg = beg + Offset (length/2,0) * complex_exp (Offset (0, angle));
-  
   return (Lookup::round_filled_polygon (points, thick));
 }
 
index 07bd16fcc768120be1330159731a38844503e7b2..900505642907eb38764f45475d6295c9b90e35fd 100644 (file)
@@ -144,7 +144,7 @@ Line_spanner::line_stencil (Grob *me,
   if (to_boolean (me->get_property ("arrow")))
     line.add_stencil (Line_interface::arrows (me, from, to, false, true));
   
-  return Stencil ();
+  return line;
 }
 
 /*
@@ -188,7 +188,7 @@ Line_spanner::print (SCM smob)
 
   Real gap = robust_scm2double (me->get_property ("gap"), 0.0);
 
-  Offset ofxy (gap, 0); /*offset from start point to start of line*/
+  Offset ofxy (gap, 0); /* offset from start point to start of line */
   Offset dxy;
   Offset my_off;
   Offset his_off;
index 19669737e762a768b24ba27f3560ce249ca8b445..b2da7e16f48d12ac91893809f3f7ad6893964070 100644 (file)
@@ -219,6 +219,21 @@ set_system_penalty (Paper_system *ps, SCM header)
     }
 }
 
+void
+Paper_book::add_score_title (SCM header)
+{
+  Stencil title = score_title (header);
+  if (title.is_empty ())
+    title = score_title (header_);
+  if (!title.is_empty ())
+    {
+      Paper_system *ps = new Paper_system (title, true);
+      systems_ = scm_cons (ps->self_scm (), systems_);
+      scm_gc_unprotect_object (ps->self_scm ());
+      set_system_penalty (ps, header);
+    }
+}
+
 SCM
 Paper_book::systems ()
 {
@@ -253,17 +268,8 @@ Paper_book::systems ()
       else if (Paper_score *pscore
               = dynamic_cast<Paper_score *> (unsmob_music_output (scm_car (s))))
        {
+         add_score_title (header);
          
-         Stencil title = score_title (header);
-         if (title.is_empty ())
-           title = score_title (header_);
-         if (!title.is_empty ())
-           {
-             Paper_system *ps = new Paper_system (title, true);
-             systems_ = scm_cons (ps->self_scm (), systems_);
-             scm_gc_unprotect_object (ps->self_scm ());
-             set_system_penalty (ps, header);
-           }
          header = SCM_EOL;
 
          
@@ -271,6 +277,18 @@ Paper_book::systems ()
          system_list = scm_reverse (system_list);
          systems_ = scm_append (scm_list_2 (system_list, systems_));
        }
+      else if (scm_is_vector (scm_car (s)))
+       {
+         /*
+           UGH. code dup.  
+          */
+         add_score_title (header);
+         header = SCM_EOL;
+         
+         SCM system_list = scm_vector_to_list (scm_car (s));
+         system_list = scm_reverse (system_list);
+         systems_ = scm_append (scm_list_2 (system_list, systems_));
+       }
       else if (Text_interface::markup_p (scm_car (s)))
        {
          SCM t = Text_interface::interpret_markup (paper_->self_scm (),
index aa7a95c9a71713309669c920c82fe253082509c8..fe43ea80074d2f5017fc697a340eec26b35df2b9 100644 (file)
@@ -129,9 +129,10 @@ Text_spanner::print (SCM smob)
       Interval ext = edge[d].extent (X_AXIS);
       if (!ext.is_empty ())
        {
+         Real pad = robust_scm2double (me->get_property ("bound-padding"), 0.0);
          edge[d].translate_axis (span_points[d], X_AXIS);
          m.add_stencil (edge[d]);
-         span_points[d] += -d * ext[-d];
+         span_points[d] += -d * (ext[-d] + pad);
        }
     }
   while (flip (&d) != LEFT);
@@ -159,5 +160,5 @@ Text_spanner::print (SCM smob)
 
 ADD_INTERFACE (Text_spanner, "text-spanner-interface",
               "generic text spanner",
-              "dash-period dash-fraction edge-height bracket-flare edge-text shorten-pair style thickness enclose-bounds");
+              "bound-padding dash-period dash-fraction edge-height bracket-flare edge-text shorten-pair style thickness enclose-bounds");