]> git.donarmstrong.com Git - lilypond.git/commitdiff
New markup commands: \left-column and \right-column.
authorNeil Puttock <n.puttock@gmail.com>
Tue, 19 Aug 2008 21:25:16 +0000 (22:25 +0100)
committerNeil Puttock <n.puttock@gmail.com>
Tue, 19 Aug 2008 21:25:16 +0000 (22:25 +0100)
input/regression/markup-column-align.ly [new file with mode: 0644]
scm/define-markup-commands.scm

diff --git a/input/regression/markup-column-align.ly b/input/regression/markup-column-align.ly
new file mode 100644 (file)
index 0000000..d45f466
--- /dev/null
@@ -0,0 +1,31 @@
+\version "2.11.57"
+\header {
+
+texidoc = "Fixed horizontal alignment of columns of text can be set using
+\left-column, \center-align and \right-column.
+"
+
+}
+
+\markup {
+  \line {
+    \left-column {
+      one
+      two
+      three
+    }
+    \hspace #4
+    \center-align {
+      one
+      \left-align
+      two
+      three
+    }
+    \hspace #6
+    \right-column {
+      one
+      two
+      three
+    }
+  }
+}
index a63dba2995e376dc8374dc6eeceb4d6675a4fef0..68acb63ef6037302530b919ea872f6ea97d815aa 100644 (file)
@@ -1187,6 +1187,12 @@ of the @code{#'direction} layout property.
                baseline-skip
                (interpret-markup-list layout props args)))
 
+(define (general-column align-dir baseline mols)
+  "Stack @var{mols} vertically, aligned to  @var{align-dir} horizontally."
+  
+  (let* ((aligned-mols (map (lambda (x) (ly:stencil-aligned-to x X align-dir)) mols)))
+    (stack-lines -1 0.0 baseline aligned-mols)))
+
 (define-builtin-markup-command (center-align layout props args)
   (markup-list?)
   align
@@ -1205,9 +1211,47 @@ Put @code{args} in a centered column.
   }
 }
 @end lilypond"
-  (let* ((mols (interpret-markup-list layout props args))
-         (cmols (map (lambda (x) (ly:stencil-aligned-to x X CENTER)) mols)))
-    (stack-lines -1 0.0 baseline-skip cmols)))
+  (general-column CENTER baseline-skip (interpret-markup-list layout props args)))
+
+(define-builtin-markup-command (left-column layout props args)
+  (markup-list?)
+  align
+  ((baseline-skip))
+ "
+@cindex text columns, left-aligned 
+
+Put @code{args} in a left-aligned column.
+
+@lilypond[verbatim,quote]
+\\markup {
+  \\left-column {
+    one
+    two
+    three
+  }
+}
+@end lilypond"
+  (general-column LEFT baseline-skip (interpret-markup-list layout props args)))
+
+(define-builtin-markup-command (right-column layout props args)
+  (markup-list?)
+  align
+  ((baseline-skip))
+ "
+@cindex text columns, right-aligned
+
+Put @code{args} in a right-aligned column.
+
+@lilypond[verbatim,quote]
+\\markup {
+  \\right-column {
+    one
+    two
+    three
+  }
+}
+@end lilypond"
+  (general-column RIGHT baseline-skip (interpret-markup-list layout props args)))
 
 (define-builtin-markup-command (vcenter layout props arg)
   (markup?)