From: Valentin Villenave Date: Mon, 5 Oct 2009 22:03:35 +0000 (+0200) Subject: New `vspace' markup command, after Nicolas Sceaux X-Git-Tag: release/2.13.6-1~50 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=9bb4c3125ff72cc401e9444e4d7834645041e1b1;p=lilypond.git New `vspace' markup command, after Nicolas Sceaux This commits adds a new builtin-markup-command, as used by Nicolas in his scores. This command takes a positive number as argument, and makes an invisible stencil of three times this number (which is somehow equivalent to the vertical space taken by a character). The command definition includes a docstring and an example, and changes.tely has been updated accordingly. --- diff --git a/Documentation/changes.tely b/Documentation/changes.tely index f93fcf8ca8..4675f0caaf 100644 --- a/Documentation/changes.tely +++ b/Documentation/changes.tely @@ -63,6 +63,12 @@ which scares away people. @end ignore +@item +In addition to the existing @code{\hspace} markup command, +a new @code{\vspace} command has been added to provide an easy +and flexible way to add vertical space in markups. This feature +is based on Nicolas Sceaux's work. + @item The direction of manual beams can be set with @code{^[} and @code{_[}. diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 933bfb27fb..1c63498c88 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -401,6 +401,33 @@ Create an invisible object taking up horizontal space @var{amount}. (ly:make-stencil "" (cons 0 amount) '(-1 . 1)) (ly:make-stencil "" (cons amount amount) '(-1 . 1)))) +;; todo: fix negative space +(define-builtin-markup-command (vspace layout props amount) + (number?) + align + () + " +@cindex creating vertical spaces in text + +Create an invisible object taking up vertical space +of @var{amount} multiplied by 3. + +@lilypond[verbatim,quote] +\\markup { + \\center-column { + one + \\vspace #2 + two + \\vspace #5 + three + } +} +@end lilypond" + (let ((amount (* amount 3.0))) + (if (> amount 0) + (ly:make-stencil "" (cons -1 1) (cons 0 amount)) + (ly:make-stencil "" (cons -1 1) (cons amount amount))))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; importing graphics.