+1.3.96.jcn1
+===========
+
+* Added slope-limit and attachment-offset properties to slur.
+
+* Slur's broken trend now weighs in the number of note-columns.
+
+* Spacing tweaks:
+
1.3.95.jcn5
===========
MAJOR_VERSION=1
MINOR_VERSION=3
PATCH_LEVEL=96
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=jcn1
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
--- /dev/null
+cpp -P -traditional -o l-fake.ly -DFAKE_GRACE les-nereides.ly
\ No newline at end of file
#(define (grace-beam-space-function multiplicity)
(* (if (<= multiplicity 3) 0.816 0.844) 0.8))
+%% cpp: don't start on first column
+%% hmm, why doesn't this work?
+ #(define (make-text-checker text)
+ (lambda (elt)
+ (and (not (eq? #f (memq 'text-item-interface (ly-get-elt-property elt 'interfaces))))
+ (not (#f (string-match text (ly-get-elt-property elt 'text)))))
+ ))
+
global = \notes{
\partial 2;
\key a \major;
\property Voice.NoteColumn \push #'horizontal-shift = #0
\outputproperty #(make-type-checker 'text-item-interface)
#'extra-offset = #'(-6 . 2)
+ %% *Style* = Large??
+ \property Voice.TextScript \push #'style = #"Large"
r2^"Allegretto scherzando"
+ \property Voice.TextScript \pop #'style
%2
\property Voice.Stem \pop #'direction
\property Voice.Stem \push #'direction = #1
%3
r4 <cis\arpeggio fis a cis> r8.
\translator Staff=bass
+ \outputproperty #(make-text-checker "m")
+ #'extra-offset = #'(-6 . 2)
cis,16^2^"m.d."( <fis8 fis,> <e! e,!>
%4
<)dis,4 a' dis>
\property Voice.Slur \push #'direction = #1
\property PianoStaff.connectArpeggios = ##t
\property Voice.TextSpanner \pop #'type
+
+ %% Ghostview is ok, but xdvi shows a solid line
+ \property Voice.TextSpanner \push #'line-thickness = #2
+ \property Voice.TextSpanner \push #'dash-period = #0.5
+
\property Voice.TextSpanner \push #'type = #"dotted-line"
\property Voice.TextSpanner \push #'edge-height = #'(0 . 1.5)
- \property Voice.TextSpanner \push #'edge-text = #'("8va " . "")
+ \property Voice.TextSpanner \push #'edge-text = #'("8 " . "")
\property Staff."c0-position" = #-13
+ \outputproperty #(make-text-checker "m")
+ #'extra-offset = #'(-6 . 2)
cis''''4^"m.g."\arpeggio \spanrequest \start "text" (
#ifndef FAKE_GRACE
#else % FAKE_GRACE
+ \property Score.PaperColumn \push #'space-factor = #0.6
+ \property Score.PaperColumn \push #'to-musical-spacing-factor = #0.04
\property Voice.NoteHead \push #'font-size = #-1
\property Voice.Stem \push #'font-size = #-1
+ \property Voice.Stem \push #'length = #6
+ \property Voice.Stem \push #'beamed-lengths =
+ #(map (lambda (x) (* 1.25 x)) '(0.0 2.5 2.0 1.5))
+ \property Voice.Stem \push #'beamed-minimum-lengths =
+ #(map (lambda (x) (* 1.25 x)) '(0.0 1.5 1.25 1.0))
+
\property Voice.Beam \push #'font-size = #-1
\property Voice.TextScript \push #'font-size = #-1
+ \property Voice.Fingering \push #'font-size = #-1
\property Voice.Slur \push #'font-size = #-1
- \property Voice.LocalKey \push #'font-size = #-1
+ \property Staff.Accidentals \push #'font-size = #-1
\property Voice.Beam \push #'space-function = #grace-beam-space-function
)cis16
\property Voice.NoteHead \pop #'font-size
\property Voice.Stem \pop #'font-size
+ \property Voice.Stem \pop #'length
+ \property Voice.Stem \pop #'beamed-lengths
+ \property Voice.Stem \pop #'beamed-minimum-lengths
\property Voice.Beam \pop #'font-size
\property Voice.TextScript \pop #'font-size
+ \property Voice.Fingering \pop #'font-size
\property Voice.Slur \pop #'font-size
- \property Voice.LocalKey \pop #'font-size
+ \property Staff.Accidentals \pop #'font-size
\property Voice.Beam \pop #'space-function
-
+ \property Score.PaperColumn \pop #'space-factor
+ \property Score.PaperColumn \pop #'to-musical-spacing-factor
#endif % FAKE_GRACE
}
trebleTwo = \context Voice=trebleTwo \notes\relative c''{
- % Broken?
\property Voice.NoteColumn \push #'horizontal-shift = #1
s2
s1*2
s4
\property Voice.Stem \pop #'direction
\property Voice.Stem \push #'direction = #-1
- <cis4\arpeggio a fis dis>
+ <cis'4\arpeggio a fis dis>
#ifdef FAKE_GRACE
s32*16
#endif
\property Voice.NoteColumn \push #'force-hshift = #-0.2
- <e2 gis, e d>
- %r8 cis4. d4 [<cis8-5-4( e,-1> <b-3 d,-1> |
- r8 cis4. d4
+ <e,2 gis, e d>
+ % Hmm s/r?
+ %r8 cis4. d4
+ s8 cis4. d4
\property Voice.NoteColumn \pop #'force-hshift
[<cis8( e,> <b-3 d,-1> |
\property Voice.NoteColumn \push #'force-hshift = #-0.2
}
bass = \context Voice=bass \notes\relative c{
- \property Voice.Slur \pop #'details
\property Voice.Slur \push #'details =
-% #'((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 1.0))
- #'((height-limit . 6.0) (ratio . 0.333) (force-blowfit . 1.0) (beautiful . 0.1))
- \property Voice.Slur \pop #'de-uglify-parameters
- \property Voice.Slur \push #'de-uglify-parameters =
-% #'(1.5 0.8 -2.0)
- #'(2.4 0.8 4.0)
+ #'((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 5.0))
+ \property Voice.Slur \push #'attachment-offset = #'((0 . -3) . (0 . -6))
\property Voice.Stem \pop #'direction
\property Voice.Slur \push #'direction = #-1
% huh, auto-beamer?
r2
%4
\property Voice.Slur \pop #'details
- \property Voice.Slur \push #'details =
- #'((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 0.5))
+ \property Voice.Slur \pop #'attachment-offset
\property Voice.Stem \pop #'direction
\property Voice.Stem \push #'direction = #-1
<b,,4 b,>
%Hmm
%\grace { s16 s s s s32 s s s s \clef bass; s }
\clef bass;
+ \grace { <e,,,32( e,> } <)gis'2 e>
#else
- s4 s8 s32 s s \clef bass; s
-#endif
+ s4 s8 s32 s s \clef bass;
+ \property Score.PaperColumn \push #'space-factor = #0.6
+ \property Score.PaperColumn \push #'to-musical-spacing-factor = #0.1
+ \property Voice.NoteHead \push #'font-size = #-1
+ \property Voice.Stem \push #'font-size = #-1
+ \property Voice.Stem \push #'length = #6
+ \property Voice.Slur \push #'font-size = #-1
+ \property Voice.Slur \push #'attachment-offset = #'((-0.5 . 0) . (0.5 . 0))
+ <e,,,32( e,>
- \grace { <e,,,32( e,> } <)gis'2 e>
- %5%
+ \property Voice.NoteHead \pop #'font-size
+ \property Voice.Stem \pop #'font-size
+ \property Voice.Stem \pop #'length
+ \property Voice.Slur \pop #'font-size
+ \property Score.PaperColumn \pop #'space-factor
+ \property Score.PaperColumn \pop #'to-musical-spacing-factor
+ <)gis'2 e>
+ \property Voice.Slur \pop #'attachment-offset
+#endif
+ %5
\property Voice.Slur \pop #'direction
\property Voice.Slur \push #'direction = #1
a,8 [e'-5(<)a-2 cis-3>]
s8 s4
\outputproperty #(make-type-checker 'dynamic-interface)
- #'extra-offset = #'(0 . 3.5)
- s1\mf-"a tempo"
- s8
+ #'extra-offset = #'(0 . 4)
+ %s1\mf-"a tempo"
+ s2\mf-"a tempo" s4
+ \outputproperty #(make-type-checker 'crescendo-interface)
+ #'extra-offset = #'(0.5 . -1)
+ s\> \!s8
\outputproperty #(make-type-checker 'dynamic-interface)
- #'extra-offset = #'(-1 . 3.5)
+ #'extra-offset = #'(-1 . 4)
s8\mf s4 s4 s8\> s32 s s \!s
}
>
>
\paper {
+ %%BURP
+ magnification_italic = 1.;
\translator {
\ScoreContext
TimeSignature \push #'style = #"C"
+ SpacingSpanner \push #'maximum-duration-for-spacing = #(make-moment 1 4)
+
+ \remove Bar_number_engraver;
}
\translator {
\type "Engraver_group_engraver";
\name Dynamics;
\consists "Output_property_engraver";
Generic_property_list = #generic-voice-properties
- %Generic_property_list = #generic-lyrics-properties
\consists "Property_engraver";
DynamicsMinimumVerticalExtent = #(cons -3 -3)
- %VerticalAlignment \push #'threshold = #'(8 . 8)
- %VerticalAlignment \push #'threshold = #'(10 . 10)
VerticalAlignment \push #'threshold = #'(9 . 9)
startSustain = #"Ped."
stopStartSustain = #"*Ped."
startUnaChorda = #"una chorda"
stopUnaChorda = #"tre chorde"
- % should make separate lists for stopsustain and startsustain
\consists "Piano_pedal_engraver";
\consists "Script_engraver";
\consists "Text_engraver";
%GURGURGU, text is initialised using TextScript
TextScript \push #'style = #"italic"
- TextScript \push #'font-size = #2
+ %%% TextScript \push #'font-size = #2
\consists "Skip_req_swallow_translator";
\consistsend "Axis_group_engraver";
}
- \translator {
- \VoiceContext
- %TextScript \push #'style = #"italic"
- %TextScript \push #'font-size = #3
- TextScript \push #'size = #"Large"
- TextScript \push #'font-size = #"Large"
- }
\translator {
\PianoStaffContext
\accepts Dynamics;
- %VerticalAlignment \push #'threshold = #'(8 . 8)
- %VerticalAlignment \push #'threshold = #'(6 . 6)
VerticalAlignment \push #'threshold = #'(7 . 7)
}
\translator {
/*
We have to do a callback, because brew_molecule () triggers a
vertical alignment if it is cross-staff.
+ This callback alos adds padding.
*/
MAKE_SCHEME_CALLBACK(Arpeggio, width_callback,2);
SCM
assert (a == X_AXIS);
Molecule arpeggio = me->paper_l ()->lookup_l (0)->afm_find ("scripts-arpeggio");
- return ly_interval2scm (arpeggio.extent (X_AXIS));
+ return ly_interval2scm (arpeggio.extent (X_AXIS) * 1.5);
}
class Slur
{
public:
- static void add_column (Score_element*me,Score_element*col);
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ static void add_column (Score_element *me, Score_element *col);
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
static void set_interface (Score_element*);
static bool has_interface (Score_element*);
- static Array<Offset> get_encompass_offset_arr (Score_element*me) ;
- static Bezier get_curve (Score_element*me) ;
- static Direction get_default_dir (Score_element*me) ;
- DECLARE_SCHEME_CALLBACK(after_line_breaking, (SCM ));
- DECLARE_SCHEME_CALLBACK(set_spacing_rods, (SCM ));
+ static Array<Offset> get_encompass_offset_arr (Score_element *me);
+ static Bezier get_curve (Score_element *me);
+ static Direction get_default_dir (Score_element *me);
+ DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
+ DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM ));
+
private:
static Real get_first_notecolumn_y (Score_element *me, Direction dir);
static Offset broken_trend_offset (Score_element *me, Direction dir);
- static Offset get_attachment (Score_element*me,Direction dir, Score_element**common) ;
- static void de_uglyfy (Score_element*me,Slur_bezier_bow* bb, Real default_height);
- static void set_extremities (Score_element*me);
- static void set_control_points (Score_element*me);
- static Offset encompass_offset (Score_element*me,Score_element *col,Score_element**common);
+ static Offset get_attachment (Score_element *me,Direction dir, Score_element **common);
+ static void de_uglyfy (Score_element *me,Slur_bezier_bow* bb, Real default_height);
+ static void set_extremities (Score_element *me);
+ static void set_control_points (Score_element *me);
+ static void check_slope (Score_element *me);
+ static Offset encompass_offset (Score_element *me, Score_element *col, Score_element **common);
};
#endif // SLUR_HH
{
Global_translator::prepare (w);
- SCM props = get_property (ly_symbol2scm ("PaperColumn"));
- set_columns (new Paper_column (props), new Paper_column (props));
+ set_columns (new Paper_column (get_property (ly_symbol2scm ("NonMusicalPaperColumn"))),
+ new Paper_column (get_property (ly_symbol2scm ("PaperColumn"))));
command_column_l_->set_elt_property ("when", w.make_scm());
musical_column_l_->set_elt_property ("when", w.make_scm());
[TODO]
* fix broken interstaff slurs
* begin and end should be treated as a/acknowledge Scripts.
- * broken slur should have uniform trend
* smart changing of endings
* smart changing of (Y-?)offsets to avoid ugly beziers
(along-side-stem)
return SCM_UNSPECIFIED;
}
+
void
-Slur::set_extremities (Score_element*me)
+Slur::check_slope (Score_element *me)
+{
+ /*
+ Avoid too steep slurs.
+ */
+ SCM s = me->get_elt_property ("slope-limit");
+ if (gh_number_p (s))
+ {
+ Array<Offset> encompass = get_encompass_offset_arr (me);
+ Drul_array<Offset> attachment;
+ attachment[LEFT] = encompass[0];
+ attachment[RIGHT] = encompass.top ();
+
+ Real dx = attachment[RIGHT][X_AXIS] - attachment[LEFT][X_AXIS];
+ Real dy = attachment[RIGHT][Y_AXIS] - attachment[LEFT][Y_AXIS];
+ if (!dx)
+ return;
+
+ Real slope = slope = abs (dy / dx);
+
+ Real limit = gh_scm2double (s);
+
+ if (slope > limit)
+ {
+ Real staff_space = Staff_symbol_referencer::staff_space ((Score_element*)me);
+ Direction dir = (Direction)gh_scm2int (me->get_elt_property ("direction"));
+ Direction d = (Direction)(- dir * (sign (dy)));
+ SCM a = me->get_elt_property ("attachment-offset");
+ Drul_array<Offset> o;
+ o[LEFT] = ly_scm2offset (index_cell (a, LEFT));
+ o[RIGHT] = ly_scm2offset (index_cell (a, RIGHT));
+ o[d][Y_AXIS] -= (limit - slope) * dx * dir / staff_space;
+ //o[d][Y_AXIS] = attachment[-d][Y_AXIS] + (dx * limit * dir / staff_space);
+ me->set_elt_property ("attachment-offset",
+ gh_cons (ly_offset2scm (o[LEFT]),
+ ly_offset2scm (o[RIGHT])));
+ }
+ }
+}
+
+void
+Slur::set_extremities (Score_element *me)
{
if (!Directional_element_interface::get (me))
- Directional_element_interface ::set (me,get_default_dir (me));
+ Directional_element_interface::set (me, get_default_dir (me));
Direction dir = LEFT;
do
}
}
while (flip (&dir) != LEFT);
+
+ check_slope (me);
}
+
Real
Slur::get_first_notecolumn_y (Score_element *me, Direction dir)
{
me->get_elt_property ("direction"));
Real neighbour_y = get_first_notecolumn_y (neighbour, dir);
Real y = get_first_notecolumn_y (me, -dir);
- o = Offset (0, (y + neighbour_y) / 2);
+ int neighbour_cols = scm_ilength (neighbour->get_elt_property ("note-columns"));
+ int cols = scm_ilength (me->get_elt_property ("note-columns"));
+ o = Offset (0, (y*neighbour_cols + neighbour_y*cols) /
+ (cols + neighbour_cols));
break;
}
}
}
Offset
-Slur::get_attachment (Score_element*me,Direction dir,
+Slur::get_attachment (Score_element *me, Direction dir,
Score_element **common)
{
SCM s = me->get_elt_property ("attachment");
SCM a = dir == LEFT ? gh_car (s) : gh_cdr (s);
Spanner*sp = dynamic_cast<Spanner*>(me);
String str = ly_symbol2string (a);
- Real ss = Staff_symbol_referencer::staff_space ((Score_element*)me);
- Real hs = ss / 2.0;
+ Real staff_space = Staff_symbol_referencer::staff_space ((Score_element*)me);
+ Real hs = staff_space / 2.0;
Offset o;
Score_element *stem = 0;
Default position is centered in X, on outer side of head Y
*/
o += Offset (0.5 * n->extent (n,X_AXIS).length (),
- 0.5 * ss * Directional_element_interface::get (me));
+ 0.5 * staff_space
+ * Directional_element_interface::get (me));
}
else if (str == "alongside-stem")
{
*/
o += Offset (n->extent (n,X_AXIS).length ()
* (1 + Stem::get_direction (stem)),
- 0.5 * ss * Directional_element_interface::get (me));
+ 0.5 * staff_space
+ * Directional_element_interface::get (me));
}
else if (str == "stem")
{
if (l != SCM_BOOL_F)
{
- o += ly_scm2offset (gh_cdr (l)) * ss * dir;
+ o += ly_scm2offset (gh_cdr (l)) * staff_space * dir;
}
/*
- me->relative_coordinate (common[Y_AXIS], Y_AXIS);
}
+ o += ly_scm2offset (index_cell (me->get_elt_property ("attachment-offset"),
+ dir)) * staff_space;
return o;
}
}
Array<Offset>
-Slur::get_encompass_offset_arr (Score_element*me)
+Slur::get_encompass_offset_arr (Score_element *me)
{
Spanner*sp = dynamic_cast<Spanner*>(me);
SCM eltlist = me->get_elt_property ("note-columns");
- Score_element *common[] = {me->common_refpoint (eltlist,X_AXIS),
- me->common_refpoint (eltlist,Y_AXIS)};
+ Score_element *common[] = {me->common_refpoint (eltlist, X_AXIS),
+ me->common_refpoint (eltlist, Y_AXIS)};
common[X_AXIS] = common[X_AXIS]->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
Item* combinations[4][2]={{l,r}, {lb,r}, {l,rb},{lb,rb}};
+
+ /*
+ left refers to the space that is associated with items of the left column, so you have
+
+ LC <- left_space -><- right_space -> RC
+ <- total space ->
+
+
+ typically, right_space is non-zero when there are
+ accidentals in RC
+
+ */
for (int j=0; j < 4; j++)
{
Paper_column * lc = dynamic_cast<Paper_column*> (combinations[j][0]);
We want the space before barline to be like the note
spacing in the measure.
*/
+ SCM sfac =lc->get_elt_property ("space-factor");
if (Item::breakable_b (lc) || lc->original_l_)
- s.strength_f_ = non_musical_space_strength;
- else if (!lc->musical_b ())
- left_distance *= me->paper_l ()->get_var ("decrease_nonmus_spacing_factor");
+ s.strength_f_ = non_musical_space_strength;
+ else if (gh_number_p (sfac))
+ left_distance *= gh_scm2double (sfac);
Real right_dist = 0.0;
/*
don't want to create too much extra space for accidentals
*/
- if (lc->musical_b () && rc->musical_b ())
- {
- if (!to_boolean (rc->get_elt_property ("contains-grace")))
- right_dist *= me->paper_l ()->get_var ("musical_to_musical_left_spacing_factor");
- }
+ if (rc->musical_b ())
+ {
+ if (to_boolean (rc->get_elt_property ("contains-grace")))
+ right_dist *= me->paper_l ()->get_var ("before_grace_spacing_factor"); // fixme.
+ else
+ right_dist *= gh_scm2double (lc->get_elt_property ("before-musical-spacing-factor"));
+ }
- if (rc->musical_b () && to_boolean (rc->get_elt_property ("contains-grace")))
- right_dist *= me->paper_l ()->get_var ("before_grace_spacing_factor");
-
s.distance_f_ = left_distance + right_dist;
Real stretch_dist = 0.;
(molecule-callback . ,Arpeggio::brew_molecule)
(Y-offset-callbacks . (,Staff_symbol_referencer::callback))
(X-offset-callbacks . (,Side_position::aligned_side))
+ (right-padding . 0.4) ; Hmm, not generic?
(direction . -1)
(staff-position . 0.0)
(name . "Arpeggio")
PaperColumn = #`(
(interfaces . (paper-column-interface axis-group-interface))
(axes 0)
- (rank . -1)
+ (before-musical-spacing-factor . 0.4)
+ (name . "PaperColumn")
+ )
+ NonMusicalPaperColumn = #`(
+ (interfaces . (paper-column-interface axis-group-interface))
+ (axes 0)
+ (before-musical-spacing-factor . 1.0)
(name . "PaperColumn")
)
(name . "ScriptColumn")
)
- Slur = #default-basic-slur-properties
+ Slur = #`(
+ (interfaces . (slur-interface))
+ (molecule-callback . ,Slur::brew_molecule)
+ (thickness . 1.2)
+ (spacing-procedure . ,Slur::set_spacing_rods)
+ (minimum-length . 1.5)
+ (after-line-breaking-callback . ,Slur::after_line_breaking)
+ (extremity-rules . ,default-slur-extremity-rules)
+ (extremity-offset-alist . ,default-slur-extremity-offset-alist)
+ (de-uglify-parameters . ( 1.5 0.8 -2.0))
+ (details . ((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 0.5)))
+ (y-free . 0.75)
+ (slope-limit . 0.8)
+ (attachment-offset . ((0 . 0) . (0 . 0)))
+ (name . "Slur")
+ )
SpacingSpanner =#`(
(spacing-procedure . ,Spacing_spanner::set_springs)
;
(define (default-beam-flag-width-function type)
(cond
- ((eq? type 1) 1.98)
- ((eq? type 1) 1.65)
+ ((eq? type 1) 1.98)
+ ((eq? type 1) 1.65) ;; FIXME: check what this should be and why
(else 1.32)
))
))
-(define default-basic-slur-properties
- `(
- (interfaces . (slur-interface))
- (molecule-callback . ,Slur::brew_molecule)
- (thickness . 1.2)
- (spacing-procedure . ,Slur::set_spacing_rods)
- (minimum-length . 1.5)
- (after-line-breaking-callback . ,Slur::after_line_breaking)
- (extremity-rules . ,default-slur-extremity-rules)
- (extremity-offset-alist . ,default-slur-extremity-offset-alist)
- (de-uglify-parameters . ( 1.5 0.8 -2.0))
- (details . ((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 0.5)))
- (y-free . 0.75)
- (name . "Slur")
- )
- )
+