summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
bd26755)
(Issue 3259)
If a grob's extent is empty (undefined), alignment procedures from
Self_alignment_interface don't have any information about grob's
dimensions, so they cannot calculate the offset required to achieve
specified alignment of such grob.
However, this isn't actually a problem: if a grob's extent is empty,
this usually means that the grob itself is empty, and in that case
there is nothing to align at all. Therefore, no programming error
should be reported.
For example, a user may remove some grob from output by overriding
its stencil to #f. This will result in an empty extent, and Lily
shouldn't complain about being unable to align such grob, because
there is nothing to align.
Nevertheless, if the extent is empty but the stencil itself isn't
empty, the situation looks suspicious, so we issue a warning.
if (scm_is_number (align))
{
Interval ext (me->maybe_pure_extent (me, a, pure, start, end));
if (scm_is_number (align))
{
Interval ext (me->maybe_pure_extent (me, a, pure, start, end));
+ // Empty extent doesn't mean an error - we simply don't align such grobs.
+ // However, empty extent and non-empty stencil would be suspicious.
if (!ext.is_empty ())
return scm_from_double (- ext.linear_combination (scm_to_double (align)));
if (!ext.is_empty ())
return scm_from_double (- ext.linear_combination (scm_to_double (align)));
+ else if (me->get_stencil ())
+ warning (me->name () + " has empty extent and non-empty stencil.");
}
return scm_from_double (0.0);
}
}
return scm_from_double (0.0);
}
Real align = scm_to_double (align_prop);
Interval ext (me->extent (me, a));
Real align = scm_to_double (align_prop);
Interval ext (me->extent (me, a));
- if (ext.is_empty ())
- programming_error ("cannot align on self: empty element");
- else
+
+ // Empty extent doesn't mean an error - we simply don't align such grobs.
+ // However, empty extent and non-empty stencil would be suspicious.
+ if (!ext.is_empty ())
x -= ext.linear_combination (align);
x -= ext.linear_combination (align);
+ else if (me->get_stencil ())
+ warning (me->name () + " has empty extent and non-empty stencil.");
if (!he.is_empty ())
x += he.linear_combination (align);
if (!he.is_empty ())
x += he.linear_combination (align);
+ else if (him->get_stencil ())
+ warning (him->name () + " has empty extent and non-empty stencil.");
return scm_from_double (x);
}
return scm_from_double (x);
}