I have hacked into tuplet_spanner.cc in order to get tuplets to look
reasonable. Problems in .38 include inproperly placed numbers,
brackets that collide with the end of stems (so the bracket looks
connected to the stem - yuck), brackets that collide with the inner
stems of a tuplet figure when a middle stem extends farther than the
boundary stems, and brackets that collide with the staff line itself,
rendering it "invisible" except for the tabs on the end.
My hack looks great on triplets (I haven't tested it on anything
else). Unfortunately, it also contains some hardcoded scaling factors
(although no hardcoded absolute offsets). I am concerned that some of
those factors look good with '3', but may not look as good with '7' in
a septuplet or something like that. It seems like the text character
'3' has some kind of origin where the line ends in the lower left
portion of the figure. That would be different for '7', or any other
character.
There is probably a way to eliminate the special casing of 'UP'
vs. 'DOWN' and reduce the complexity of this function.
Here is a test file that shows all sorts of nasties:
\score{
\notes \relative c'' {
c4 c c c
\times 2/3 {g'4 d g}
\times 2/3 {d, g d}
\times 2/3 {c' c c}
\times 2/3 {a a a}
\break
\times 2/3 {d, f a}
\times 2/3 {a f d}
\times 2/3 {g' e c}
\times 2/3 {c e g}
\times 2/3 {e c a}
\times 2/3 {a c e}
\times 2/3 {f, a c}
\times 2/3 {c a f}
\break
\times 2/3 {[g'8 d g]}
\times 2/3 {[d, g d]}
\times 2/3 {[c' c c]}
\break
\times 2/3 {[a a a]}
\times 2/3 {[d, f a]}
\times 2/3 {[a f d]}
\times 2/3 {[g' e c]}
\times 2/3 {[c e g]}
\times 2/3 {[e c a]}
\break
\times 2/3 {[a c e]}
\times 2/3 {[f a c]}
\times 2/3 {[c a f]}
\break
\times 2/3 {g4 g g}
\times 2/3 {d,4 d d}
}
}
and here is my hacked function:
Molecule*
Tuplet_spanner::do_brew_molecule_p () const
{
Molecule* mol_p = new Molecule;
if (column_arr_.size ()){
Real ncw = column_arr_.top ()->extent (X_AXIS).length ();
Real dy = column_arr_.top ()->extent (Y_AXIS) [dir_]
- column_arr_[0]->extent (Y_AXIS) [dir_];
Molecule num (lookup_l ()->text ("italic",
number_str_));
if (beam_l_ && !bracket_visibility_b_)
{
Directional_spanner* ds = dynamic_cast<Directional_spanner*>(beam_l_);
num.translate (ds->center ());
if (column_arr_.top()->dir() == UP)
num.translate_axis (num.extent(Y_AXIS)[dir_] - dy/2.0, Y_AXIS);
else
num.translate_axis(-1.3*num.extent(Y_AXIS)[other_dir(dir_)] +
1.4*dy/2.0, Y_AXIS);
}
if (bracket_visibility_b_)
{
// off_y is a offset factor that is nonzero when one of
// the stems in the tuplet is higher or lower than the
// outside stems. In a triplet, this might be the case
// of \times 2/3 {d, g d}.
Real max_y = -100000.0;
Real min_y = 100000.0;
for(int i = 0; i < column_arr_.size(); i++)
{
min_y = min(min_y, column_arr_[i]->extent(Y_AXIS)[dir_]);
max_y = max(max_y, column_arr_[i]->extent(Y_AXIS)[dir_]);
}
Real off_y = 0.0;
if (dir_ == UP)
{
off_y = max_y -
max(column_arr_[0]->extent(Y_AXIS)[dir_],
column_arr_.top()->extent(Y_AXIS)[dir_]);
num.translate (Offset(-0.5*ncw - 0.4*ncw,
off_y + 0.5*num.extent(Y_AXIS)[dir_]));
}
else
{
off_y = min_y -
min(column_arr_[0]->extent(Y_AXIS)[dir_],
column_arr_.top()->extent(Y_AXIS)[dir_]);
num.translate (Offset(-0.5*ncw - 0.4*ncw,
off_y - 1.0*num.extent(Y_AXIS)[other_dir(dir_)]));
}
// add a little bit more, so horizontal brackets
// never exactly correspond with a staff line
off_y = dir_*column_arr_.top()->stem_l_->staff_line_leading_f()/4;
// The 2.0*ncw factor prevents the vertical part of the
// tuplet symbol from colliding with the note stem by
// introducing an extra offset. There really should
// only be an offset on one side of most tuplets, but
// this is better than it was before.
Real w = extent (X_AXIS).length () + 2.0*ncw;
num.translate (Offset (w/2, dy/2));
mol_p->add_molecule (lookup_l ()->plet (dy, w, dir_));
mol_p->translate(Offset(-0.5*ncw, off_y));
}
if (num_visibility_b_)
mol_p->add_molecule (num);
}
return mol_p;
}
--
John Galbraith email: [EMAIL PROTECTED]
University of Arizona, home phone: (520) 327-6074
Los Alamos National Laboratory work phone: (520) 626-6277
home page: www.ece.arizona.edu:/~john
"As had been true historically, Gates' concern was not making great
products, but keeping the world locked into using his products."
--- Wendy Goldman Rohm, The Microsoft File