/*
- line-spanner.cc -- implement Line_spanner
+ This file is part of LilyPond, the GNU music typesetter.
- source file of the GNU LilyPond music typesetter
+ Copyright (C) 2000--2011 Jan Nieuwenhuizen <janneke@gnu.org>
- (c) 2000--2009 Jan Nieuwenhuizen <janneke@gnu.org>
+ LilyPond is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LilyPond is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
*/
#include "align-interface.hh"
Spanner *parent_spanner (Grob *g)
{
if (Spanner::has_interface (g))
- return dynamic_cast<Spanner*> (g);
+ return dynamic_cast<Spanner *> (g);
return parent_spanner (g->get_parent (Y_AXIS));
}
for (SCM s = scm_reverse (extra); scm_is_pair (s); s = scm_cdr (s))
details = scm_cons (scm_car (s), details);
}
-
+
if (details == SCM_BOOL_F)
details = ly_assoc_get (ly_symbol2scm ("default"), bound_details, SCM_EOL);
properties, text),
details);
}
-
+
if (!scm_is_number (ly_assoc_get (ly_symbol2scm ("X"), details, SCM_BOOL_F)))
{
Direction attach = (Direction)
bound_grob = (dir == LEFT)
? columns[0] : columns.back();
}
-
+
details = scm_acons (ly_symbol2scm ("X"),
scm_from_double (robust_relative_extent (bound_grob, commonx, X_AXIS)
.linear_combination (attach)),
details);
}
-
+
if (!scm_is_number (ly_assoc_get (ly_symbol2scm ("Y"), details, SCM_BOOL_F)))
{
Spanner *next_bound_parent = parent_spanner (next_bound);
Interval next_ext = next_bound->extent (next_bound_parent, Y_AXIS);
- /* We want to know what would be the
- y-position of the next bound (relative to my y-parent) if it belonged
- to the same system as this bound. We rely on the fact that
- the y-parent of the next bound is a spanner (probably the
- VerticalAxisGroup of a staff) that extends over the break.
+ /*
+ We want to know what would be the y-position of the next
+ bound (relative to my y-parent) if it belonged to the
+ same system as this bound. We rely on the fact that the
+ y-parent of the next bound is a spanner (probably the
+ VerticalAxisGroup of a staff) that extends over the break.
*/
Spanner *next_bound_parent_on_this_line =
next_bound_parent->broken_neighbor (other_dir (dir));
}
else
{
- /* We fall back to assuming that the distance between staves doesn't
- change over line breaks. */
+ /*
+ We fall back to assuming that the distance between
+ staves doesn't change over line breaks.
+ */
programming_error ("next-bound's parent doesn't extend to this line");
Grob *next_system = next_bound->get_system ();
Grob *this_system = me->get_system ();
properties, text),
alist);
}
-
+
return alist;
}
Drul_array<SCM> bounds (me->get_property ("left-bound-info"),
me->get_property ("right-bound-info"));
-
+
Grob *commonx = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS);
commonx = me->common_refpoint (commonx, X_AXIS);
bounds[d], SCM_BOOL_F), 0.0),
robust_scm2double (ly_assoc_get (ly_symbol2scm ("Y"),
bounds[d], SCM_BOOL_F), 0.0));
-
+
span_points[d] = z;
}
while (flip (&d) != LEFT);
Drul_array<Real> gaps (0, 0);
Drul_array<bool> arrows (0, 0);
Drul_array<Real> anchor_align (0, 0);
- Drul_array<Stencil*> stencils (0,0);
- Drul_array<Grob*> common_y (0, 0);
+ Drul_array<Stencil *> stencils (0,0);
+ Drul_array<Grob *> common_y (0, 0);
+
+ // For scaling of 'padding and 'stencil-offset
+ Real magstep
+ = pow (2, robust_scm2double (me->get_property ("font-size"), 0.0) / 6);
+
do
{
gaps[d] = robust_scm2double (ly_assoc_get (ly_symbol2scm ("padding"),
arrows[d] = to_boolean (ly_assoc_get (ly_symbol2scm ("arrow"),
bounds[d], SCM_BOOL_F));
anchor_align[d] = robust_scm2double (ly_assoc_get (ly_symbol2scm ("anchor-alignment"),
- bounds[d], SCM_BOOL_F), LEFT);
+ bounds[d], SCM_BOOL_F), LEFT);
stencils[d] = unsmob_stencil (ly_assoc_get (ly_symbol2scm ("stencil"),
bounds[d], SCM_BOOL_F));
common_y[d] = unsmob_grob (ly_assoc_get (ly_symbol2scm ("common-Y"),
Stencil line;
do
{
- span_points[d] += -d * gaps[d] * dz.direction ();
+ span_points[d] += -d * gaps[d] * magstep * dz.direction ();
if (stencils[d])
{
if (scm_is_number (align))
s.align_to (Y_AXIS, scm_to_double (align));
- /*
- todo: should use font-size.
- */
if (is_number_pair (off))
- s.translate (ly_scm2offset (off));
-
+ s.translate (ly_scm2offset (off) * magstep);
+
line.add_stencil (s);
}
}
line.translate (Offset (-me->relative_coordinate (commonx, X_AXIS),
-me->relative_coordinate (my_common_y, Y_AXIS)));
-
+
return line.smobbed_copy ();
}
"thickness "
"to-barline "
);
-