]> git.donarmstrong.com Git - lilypond.git/commitdiff
stencil.cc: Backspacing stencils are not empty
authorKeith OHara <k-ohara5a5a@oco.net>
Wed, 5 Dec 2012 05:34:32 +0000 (21:34 -0800)
committerKeith OHara <k-ohara5a5a@oco.net>
Thu, 13 Dec 2012 04:23:40 +0000 (20:23 -0800)
lily/stencil.cc
scm/define-markup-commands.scm

index a488c598137106339e3dc12951ce5ae6ff520a01..eb3420d0723e00aff81f78c36e9647a29fc30b75 100644 (file)
@@ -66,10 +66,13 @@ Stencil::extent (Axis a) const
 
 bool
 Stencil::is_empty () const
+/* If only one of X- or Y-extent is empty; such a stencil can be useful
+ * for backspacing, as with \hspace #-2, so we do not consider it empty.
+ */
 {
   return (expr_ == SCM_EOL
-          || dim_[X_AXIS].is_empty ()
-          || dim_[Y_AXIS].is_empty ());
+          || (dim_[X_AXIS].is_empty ()
+              && dim_[Y_AXIS].is_empty ()));
 }
 
 SCM
index 2c6ca98aa031801d4f9ebefe4947e3c10640eade..ff11b20451599fe88280062b4094742b0134a19a 100755 (executable)
@@ -548,7 +548,6 @@ Create a box of the same height as the space in the current font."
                     (ly:stencil-extent m X)
                     )))
 
-;; todo: fix negative space
 (define-markup-command (hspace layout props amount)
   (number?)
   #:category align
@@ -568,11 +567,8 @@ Create an invisible object taking up horizontal space @var{amount}.
 }
 @end lilypond"
   (let ((corrected-space (- amount word-space)))
-    (if (> corrected-space 0)
-       (ly:make-stencil "" (cons 0 corrected-space) '(0 . 0))
-       (ly:make-stencil "" (cons corrected-space corrected-space) '(0 . 0)))))
+    (ly:make-stencil "" (cons 0 corrected-space) '(0 . 0))))
 
-;; todo: fix negative space
 (define-markup-command (vspace layout props amount)
  (number?)
  #:category align
@@ -594,9 +590,7 @@ of @var{amount} multiplied by 3.
 }
 @end lilypond"
   (let ((amount (* amount 3.0)))
-    (if (> amount 0)
-        (ly:make-stencil "" (cons 0 0) (cons 0 amount))
-        (ly:make-stencil "" (cons 0 0) (cons amount amount)))))
+    (ly:make-stencil "" (cons 0 0) (cons 0 amount))))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;