X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fdefine-markup-commands.scm;h=778569f3d33c25081a0a158493c5e1837688fe2d;hb=c7859653d9e011b140088a39ed1eb2c013b6c0b9;hp=a63dba2995e376dc8374dc6eeceb4d6675a4fef0;hpb=5a5ac06f4f6e8b737a59a25aae0663a32f8215e3;p=lilypond.git diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index a63dba2995..778569f3d3 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -1187,7 +1187,13 @@ of the @code{#'direction} layout property. baseline-skip (interpret-markup-list layout props args))) -(define-builtin-markup-command (center-align 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-column layout props args) (markup-list?) align ((baseline-skip)) @@ -1198,16 +1204,54 @@ Put @code{args} in a centered column. @lilypond[verbatim,quote] \\markup { - \\center-align { + \\center-column { + one + two + three + } +} +@end lilypond" + (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" - (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 RIGHT baseline-skip (interpret-markup-list layout props args))) (define-builtin-markup-command (vcenter layout props arg) (markup?) @@ -1229,7 +1273,7 @@ Align @code{arg} to its Y@tie{}center. (let* ((mol (interpret-markup layout props arg))) (ly:stencil-aligned-to mol Y CENTER))) -(define-builtin-markup-command (hcenter layout props arg) +(define-builtin-markup-command (center-align layout props arg) (markup?) align () @@ -1242,7 +1286,7 @@ Align @code{arg} to its X@tie{}center. \\markup { \\column { one - \\hcenter + \\center-align two three } @@ -1524,7 +1568,7 @@ Add padding @var{amount} around @var{arg} in the X@tie{}direction. (make-pad-to-box-markup (cons (/ length -2) (/ length 2)) '(0 . 0) - (make-hcenter-markup arg)))) + (make-center-align-markup arg)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; property