]> git.donarmstrong.com Git - lilypond.git/commitdiff
New `vspace' markup command, after Nicolas Sceaux
authorValentin Villenave <valentin@villenave.net>
Mon, 5 Oct 2009 22:03:35 +0000 (00:03 +0200)
committerValentin Villenave <valentin@villenave.net>
Mon, 5 Oct 2009 22:03:35 +0000 (00:03 +0200)
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.

Documentation/changes.tely
scm/define-markup-commands.scm

index f93fcf8ca843f35d18f0185736723649ee318056..4675f0caaf188ab50ab4ff9ee120376163758f32 100644 (file)
@@ -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{_[}.
 
index 933bfb27fb356c8fd71d6e89cebc1485263fdc24..1c63498c883e821b724c1b0aca276583a4799bfd 100644 (file)
@@ -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.