Position_stem_segments_map stem_segments;
Real lt = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
+ /* There are two concepts of "rank" that are used in the following code.
+ The beam_rank is the vertical position of the beam (larger numbers are
+ closer to the noteheads). Beam_stem_segment.rank_, on the other hand,
+ is the horizontal position of the segment (this is incremented by two
+ for each stem; the beam segment on the right side of the stem has
+ a higher rank (by one) than its neighbour to the left). */
Slice ranks;
for (vsize i = 0; i < stems.size (); i++)
{
Direction d = LEFT;
do
{
+ // Find the maximum and minimum beam ranks.
+ // Given that RANKS is never reset to empty, the interval will always be
+ // smallest for the left beamlet of the first stem, and then it might grow.
+ // Do we really want this? (It only affects the tremolo gaps) --jneem
for (SCM s = index_get_cell (beaming, d);
scm_is_pair (s); s = scm_cdr (s))
{
Beam_segment current;
+ // Iterate over all of the segments of the current beam rank,
+ // merging the adjacent Beam_stem_segments into one Beam_segment
+ // when appropriate.
int vertical_count = (*i).first;
for (vsize j = 0; j < segs.size (); j++)
{
- /*
- event_dir == LEFT: left edge of a beamsegment.
- */
+ // Keeping track of the different directions here is a little tricky.
+ // segs[j].dir_ is the direction of the beam segment relative to the stem
+ // (ie. segs[j].dir_ == LEFT if the beam segment sticks out to the left of
+ // its stem) whereas event_dir refers to the edge of the beam segment that
+ // we are currently looking at (ie. if segs[j].dir_ == event_dir then we
+ // are looking at that edge of the beam segment that is furthest from its
+ // stem).
Direction event_dir = LEFT;
+ Beam_stem_segment const& seg = segs[j];
do
{
- bool on_line_bound = (segs[j].dir_ == LEFT) ? segs[j].stem_index_ == 0
- : segs[j].stem_index_ == stems.size() - 1;
+ Beam_stem_segment const& neighbor_seg = segs[j + event_dir];
+ // TODO: make names clearer? --jneem
+ // on_line_bound: whether the current segment is on the boundary of the WHOLE beam
+ // on_beam_bound: whether the current segment is on the boundary of just that part
+ // of the beam with the current beam_rank
+ bool on_line_bound = (seg.dir_ == LEFT) ? seg.stem_index_ == 0
+ : seg.stem_index_ == stems.size() - 1;
bool on_beam_bound = (event_dir == LEFT) ? j == 0 :
j == segs.size () - 1;
bool inside_stem = (event_dir == LEFT)
- ? segs[j].stem_index_ > 0
- : segs[j].stem_index_ + 1 < stems.size () ;
+ ? seg.stem_index_ > 0
+ : seg.stem_index_ + 1 < stems.size () ;
bool event = on_beam_bound
- || abs (segs[j].rank_ - segs[j+event_dir].rank_) > 1
- || (abs (vertical_count) >= segs[j].max_connect_
- || abs (vertical_count) >= segs[j + event_dir].max_connect_);
+ || abs (seg.rank_ - neighbor_seg.rank_) > 1
+ || (abs (vertical_count) >= seg.max_connect_
+ || abs (vertical_count) >= neighbor_seg.max_connect_);
if (!event)
+ // Then this edge of the current segment is irrelevent because it will
+ // be connected with the next segment in the event_dir direction.
continue;
current.vertical_count_ = vertical_count;
- current.horizontal_[event_dir] = segs[j].stem_x_;
- if (segs[j].dir_ == event_dir)
+ current.horizontal_[event_dir] = seg.stem_x_;
+ if (seg.dir_ == event_dir)
+ // then we are examining the edge of a beam segment that is furthest
+ // from its stem.
{
if (on_line_bound
&& me->get_bound (event_dir)->break_status_dir ())
}
else
{
- Real notehead_width =
- Stem::duration_log (segs[j].stem_) == 1
- ? 1.98
- : 1.32; // URG.
-
+ Grob *stem = stems[seg.stem_index_];
+ Drul_array<Real> beamlet_length =
+ robust_scm2interval (stem->get_property ("beamlet-default-length"), Interval (1.0, 1.0));
+ Drul_array<Real> max_proportion =
+ robust_scm2interval (stem->get_property ("beamlet-max-length-proportion"), Interval (0.5, 0.5));
+ Real length = beamlet_length[seg.dir_];
if (inside_stem)
{
- Grob *neighbor_stem = stems[segs[j].stem_index_ + event_dir];
- Real neighbor_stem_x
- = neighbor_stem->relative_coordinate (commonx, X_AXIS);
+ Grob *neighbor_stem = stems[seg.stem_index_ + event_dir];
+ Real neighbor_stem_x = neighbor_stem->relative_coordinate (commonx, X_AXIS);
- notehead_width = min (notehead_width,
- fabs (neighbor_stem_x - segs[j].stem_x_)/2.5);
+ length = min (length,
+ fabs (neighbor_stem_x - seg.stem_x_) * max_proportion[seg.dir_]);
}
- current.horizontal_[event_dir] += event_dir * notehead_width;
+ current.horizontal_[event_dir] += event_dir * length;
}
}
else
+ // we are examining the edge of a beam segment that is closest
+ // (ie. touching, unless there is a gap) its stem.
{
- current.horizontal_[event_dir] += event_dir * segs[j].width_/2;
- if (segs[j].gapped_)
+ current.horizontal_[event_dir] += event_dir * seg.width_/2;
+ if (seg.gapped_)
{
current.horizontal_[event_dir] -= event_dir * gap_length;
- if (Stem::is_invisible (segs[j].stem_))
+ if (Stem::is_invisible (seg.stem_))
{
/*
Need to do this in case of whole notes. We don't want the
heads to collide with the beams.
*/
- extract_grob_set (segs[j].stem_, "note-heads", heads);
+ extract_grob_set (seg.stem_, "note-heads", heads);
for (vsize k = 0; k < heads.size (); k ++)
current.horizontal_[event_dir]
*/
MAKE_SCHEME_CALLBACK (Beam, calc_least_squares_positions, 2);
SCM
- Beam::calc_least_squares_positions (SCM smob, SCM posns)
+ Beam::calc_least_squares_positions (SCM smob, SCM /* posns */)
{
- (void) posns;
-
Grob *me = unsmob_grob (smob);
int count = normal_stem_count (me);
MAKE_SCHEME_CALLBACK (Stem, pure_height, 3)
SCM
- Stem::pure_height (SCM smob, SCM start, SCM end)
+ Stem::pure_height (SCM smob,
+ SCM /* start */,
+ SCM /* end */)
{
- (void) start;
- (void) end;
-
Grob *me = unsmob_grob (smob);
Interval iv;
"avoid-note-head "
"beam "
"beaming "
+ "beamlet-default-length "
+ "beamlet-max-length-proportion "
"default-direction "
"details "
"direction "
@code{1}@tie{}is the next beam toward the note, etc. This
information is used to determine how to connect the beaming patterns
from stem to stem inside a beam.")
+ (beamlet-default-length ,pair? "A pair of numbers. The first number
+specifies the default length of a beamlet that sticks out of the left hand
+side of this stem; the second number specifies the default length of the
+beamlet to the right. The actual length of a beamlet is determined by
+taking either the default length or the length specified by
+@code{beamlet-max-length-proportion}, whichever is smaller.")
+ (beamlet-max-length-proportion ,pair? "The maximum length of a beamlet,
+as a proportion of the distance between two adjacent stems.")
(before-line-breaking ,boolean? "Dummy property, used to trigger
a callback function.")
(between-cols ,pair? "Where to attach a loose column to.")
(c0-position ,integer? "An integer indicating the position of
middle@tie{}C.")
+ (circled-tip ,boolean? "Put a circle at start/end of hairpins (al/del
+ niente).")
(clip-edges ,boolean? "Allow outward pointing beamlets at the
edges of beams?")
(collapse-height ,ly:dimension? "Minimum height of system start
Choices include @code{curved}, @code{straight}, and
@code{none}. Default @code{curved}.
@item
+ @code{capo-thickness} -- Thickness of capo indicator, in
+ multiples of fret-space. Default value 0.5.
+ @item
@code{dot-color} -- Color of dots. Options include
@code{black} and @code{white}. Default @code{black}.
@item
tightly as possible.")
(padding ,ly:dimension? "Add this much extra space between
objects that are next to each other.")
+ (padding-pairs ,list? "An alist mapping @code{(@var{name} . @var{name})}
+ to distances.")
(page-break-penalty ,number? "Penalty for page break at this
column. This affects the choices of the page breaker; it avoids a
page break at a column with a positive penalty and prefers a page break
values may also be specified.")
(self-alignment-Y ,number? "Like @code{self-alignment-X} but for
the Y@tie{}axis.")
+ (toward-stem-shift ,number? "Amount by which scripts are shifted
+ toward the stem if their direction coincides with the stem direction.
+ @code{0.0} means keep the default position (centered on the note head),
+ @code{1.0} means centered on the stem. Interpolated values are possible.")
(shorten-pair ,number-pair? "The lengths to shorten a
text-spanner on both sides, for example a pedal bracket. Positive
values shorten the text-spanner, while negative values lengthen it.")
@code{direction-source} with this to get the direction of this
object.")
(size ,number? "Size of object, relative to standard size.")
+ (skyline-horizontal-padding ,number? "For determining the vertical
+ distance between two staves, it is possible to have a configuration which
+ would result in a tight interleaving of grobs from the top staff and the
+ bottom staff. The larger this parameter is, the farther apart the staves
+ are placed in such a configuration.")
(slash-negative-kern ,number? "The space to remove between
slashes in percent repeat glyphs. Larger values bring the two
elements closer together.")
(note-columns ,pair? "A list of @code{NoteColumn} grobs.")
(note-head ,ly:grob? "A single note head.")
(note-heads ,ly:grob-array? "A list of note head grobs.")
-
- (padding-pairs ,list? "An alist mapping @code{(@var{name} . @var{name})}
- to distances.")
(pedal-text ,ly:grob? "A pointer to the text of a mixed-style piano
pedal.")
(pure-Y-common ,ly:grob? "A cache of the
(cause ,scheme? "Any kind of causation objects (i.e., music, or perhaps
translator) that was the cause for this grob.")
- (circled-tip ,boolean? "Put a circle at start/end of hairpins (al/del
- niente).")
-
(delta-position ,number? "The vertical position difference.")
(details ,list? "Alist of parameters for detailed grob behavior.
Internally used to distribute beam shortening over stems.")
(skyline-distance ,number? "The distance between this staff and the
next one, as determined by a skyline algorithm.")
- (skyline-horizontal-padding ,number? "For determining the vertical
- distance between two staves, it is possible to have a configuration which
- would result in a tight interleaving of grobs from the top staff and the
- bottom staff. The larger this parameter is, the farther apart the staves
- are placed in such a configuration.")
(stem-info ,pair? "A cache of stem parameters.")
(use-breve-rest ,boolean? "Use breve rests for measures longer
(thickness . 1.3)
(cross-staff . ,ly:stem::calc-cross-staff)
(flag . ,ly:stem::calc-flag)
+ (beamlet-default-length . (1.0 . 1.0))
+ (beamlet-max-length-proportion . (0.5 . 0.5))
(details
. (
;; 3.5 (or 3 measured from note head) is standard length
- ;; 32nd, 64th flagged stems should be longer
- (lengths . (3.5 3.5 3.5 4.5 5.0))
+ ;; 32nd, 64th, 128th flagged stems should be longer
+ (lengths . (3.5 3.5 3.5 4.5 5.0 6.0))
;; FIXME. 3.5 yields too long beams (according to Ross and
;; looking at Baerenreiter examples) for a number of common