From: Han-Wen Nienhuys Date: Mon, 18 Apr 2005 12:29:24 +0000 (+0000) Subject: * lily/text-spanner.cc: add bound-padding. X-Git-Tag: release/2.5.20~14 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=3a2fc230eea4606a1c33cf520b4fb99da9c7a635;p=lilypond.git * lily/text-spanner.cc: add bound-padding. * lily/paper-book.cc (systems): accept Paper_score iso. Paper_system vector. * lily/line-interface.cc (make_arrow): new function. Patch by Jonatan Liljedahl (arrows): idem. * lily/line-spanner.cc (line_stencil): add arrows. --- diff --git a/ChangeLog b/ChangeLog index c3a7b33cea..67ec9a0694 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-04-18 Han-Wen Nienhuys + * 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 diff --git a/lily/include/paper-book.hh b/lily/include/paper-book.hh index 982d5f241f..310a321d99 100644 --- a/lily/include/paper-book.hh +++ b/lily/include/paper-book.hh @@ -26,6 +26,7 @@ class Paper_book SCM systems_; SCM pages_; + void add_score_title (SCM); public: SCM header_; SCM header_0_; diff --git a/lily/line-interface.cc b/lily/line-interface.cc index 9fd5d4ca6e..c2dc7b9854 100644 --- a/lily/line-interface.cc +++ b/lily/line-interface.cc @@ -13,26 +13,22 @@ #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 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)); } diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc index 07bd16fcc7..9005056429 100644 --- a/lily/line-spanner.cc +++ b/lily/line-spanner.cc @@ -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; diff --git a/lily/paper-book.cc b/lily/paper-book.cc index 19669737e7..b2da7e16f4 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -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 (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 (), diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index aa7a95c9a7..fe43ea8007 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -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");