]> git.donarmstrong.com Git - lilypond.git/commitdiff
Give ly:stencil-empty? an optional axis argument
authorDavid Kastrup <dak@gnu.org>
Sat, 27 Apr 2013 12:45:11 +0000 (14:45 +0200)
committerDavid Kastrup <dak@gnu.org>
Sun, 26 May 2013 00:33:02 +0000 (02:33 +0200)
lily/stencil-scheme.cc

index 3bc68710eff0d2e62c4956752454d1d8a6e16ab6..1afe56cc2df94a5ee716b90a220508213e6939f9 100644 (file)
@@ -84,12 +84,17 @@ LY_DEFINE (ly_stencil_extent, "ly:stencil-extent",
 }
 
 LY_DEFINE (ly_stencil_empty_p, "ly:stencil-empty?",
-           1, 0, 0, (SCM stil),
-           "Return whether @var{stil} is empty.")
+           1, 1, 0, (SCM stil, SCM axis),
+           "Return whether @var{stil} is empty.  If an optional"
+           " @var{axis} is supplied, the emptiness check is"
+           " restricted to that axis.")
 {
   Stencil *s = unsmob_stencil (stil);
   LY_ASSERT_SMOB (Stencil, stil, 1);
-  return scm_from_bool (s->is_empty ());
+  if (SCM_UNBNDP (axis))
+    return scm_from_bool (s->is_empty ());
+  LY_ASSERT_TYPE (is_axis, axis, 2);
+  return scm_from_bool (s->is_empty (Axis (scm_to_int (axis))));
 }
 
 LY_DEFINE (ly_stencil_combine_at_edge, "ly:stencil-combine-at-edge",