From: Keith OHara Date: Wed, 5 Dec 2012 05:34:32 +0000 (-0800) Subject: stencil.cc: Backspacing stencils are not empty X-Git-Tag: release/2.17.9-1~6 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a10833e185f24d63ba084634e24933347e347185;p=lilypond.git stencil.cc: Backspacing stencils are not empty --- diff --git a/lily/stencil.cc b/lily/stencil.cc index a488c59813..eb3420d072 100644 --- a/lily/stencil.cc +++ b/lily/stencil.cc @@ -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 diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 2c6ca98aa0..ff11b20451 100755 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -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)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;