* lily/line-spanner.cc (print):
scale padding and stencil-offset by font-size
* scm/define-grobs.scm (all-grob-descriptions):
tweak TrillSpanner bound-details
--- /dev/null
+\version "2.13.14"
+
+\header {
+ texidoc = "
+The horizontal position of the beginning of a trill spanner is
+positioned correctly relative to the note head it is attached to,
+even if scaled to a smaller size.
+"
+}
+
+<<
+ \new Staff \with {
+ fontSize = #-6
+ \override StaffSymbol #'staff-space = #(magstep -6)
+ }
+ \relative c' {
+ c1\startTrillSpan | c\stopTrillSpan |
+ }
+ \new Staff \relative c' {
+ c1\startTrillSpan | c\stopTrillSpan |
+ }
+>>
Spanner *parent_spanner (Grob *g)
{
if (Spanner::has_interface (g))
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));
}
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);
}
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);
if (details == SCM_BOOL_F)
details = ly_assoc_get (ly_symbol2scm ("default"), bound_details, SCM_EOL);
properties, text),
details);
}
properties, text),
details);
}
if (!scm_is_number (ly_assoc_get (ly_symbol2scm ("X"), details, SCM_BOOL_F)))
{
Direction attach = (Direction)
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();
}
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);
}
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)))
{
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);
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));
*/
Spanner *next_bound_parent_on_this_line =
next_bound_parent->broken_neighbor (other_dir (dir));
- /* 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 ();
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);
}
properties, text),
alist);
}
Drul_array<SCM> bounds (me->get_property ("left-bound-info"),
me->get_property ("right-bound-info"));
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);
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));
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);
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<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"),
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"),
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"),
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"),
- span_points[d] += -d * gaps[d] * dz.direction ();
+ span_points[d] += -d * gaps[d] * magstep * dz.direction ();
if (scm_is_number (align))
s.align_to (Y_AXIS, scm_to_double (align));
if (scm_is_number (align))
s.align_to (Y_AXIS, scm_to_double (align));
- /*
- todo: should use font-size.
- */
if (is_number_pair (off))
if (is_number_pair (off))
- s.translate (ly_scm2offset (off));
-
+ s.translate (ly_scm2offset (off) * magstep);
+
line.add_stencil (s);
}
}
line.add_stencil (s);
}
}
line.translate (Offset (-me->relative_coordinate (commonx, X_AXIS),
-me->relative_coordinate (my_common_y, Y_AXIS)));
line.translate (Offset (-me->relative_coordinate (commonx, X_AXIS),
-me->relative_coordinate (my_common_y, Y_AXIS)));
return line.smobbed_copy ();
}
return line.smobbed_copy ();
}
"thickness "
"to-barline "
);
"thickness "
"to-barline "
);
(TrillSpanner
. (
(after-line-breaking . ,ly:spanner::kill-zero-spanned-time)
(TrillSpanner
. (
(after-line-breaking . ,ly:spanner::kill-zero-spanned-time)
- (bound-details . ((left . ((text . ,(make-translate-scaled-markup
- '(0.0 . -1.0)
- (make-musicglyph-markup "scripts.trill")))
+ (bound-details . ((left . ((text . ,(make-musicglyph-markup "scripts.trill"))
- (stencil-offset . (-0.5 . 0))
- (padding . 1.5)
+ (stencil-offset . (-0.5 . -1))
+ (padding . 0.5)
- ;; this isn't CENTER because the trill glyph's origin
- ;; is not centered in its extent; to have the trill
- ;; spanner aligned the same as a trill, we need a slight offset
- (anchor-alignment . 0.15)
))
(left-broken . ((end-on-note . #t)))
(right . ((Y . 0)))
))
(left-broken . ((end-on-note . #t)))
(right . ((Y . 0)))