+;;
+;; TODO: should extract baseline-skip from each argument somehow..
+;;
+(def-markup-command (column layout props args) (markup-list?)
+ "Stack the markups in @var{args} vertically. The property
+@code{baseline-skip} determines the space between each markup in @var{args}."
+ (stack-lines
+ -1 0.0 (chain-assoc-get 'baseline-skip props)
+ (remove ly:stencil-empty?
+ (map (lambda (m) (interpret-markup layout props m)) args))))
+
+(def-markup-command (dir-column layout props args) (markup-list?)
+ "Make a column of args, going up or down, depending on the setting
+of the @code{#'direction} layout property."
+ (let* ((dir (chain-assoc-get 'direction props)))
+ (stack-lines
+ (if (number? dir) dir -1)
+ 0.0
+ (chain-assoc-get 'baseline-skip props)
+ (map (lambda (x) (interpret-markup layout props x)) args))))
+
+(def-markup-command (center-align layout props args) (markup-list?)
+ "Put @code{args} in a centered column. "
+ (let* ((mols (map (lambda (x) (interpret-markup layout props x)) args))
+ (cmols (map (lambda (x) (ly:stencil-aligned-to x X CENTER)) mols)))
+ (stack-lines -1 0.0 (chain-assoc-get 'baseline-skip props) cmols)))
+
+(def-markup-command (vcenter layout props arg) (markup?)
+ "Align @code{arg} to its Y center. "
+ (let* ((mol (interpret-markup layout props arg)))
+ (ly:stencil-aligned-to mol Y CENTER)))
+
+(def-markup-command (hcenter layout props arg) (markup?)
+ "Align @code{arg} to its X center. "
+ (let* ((mol (interpret-markup layout props arg)))
+ (ly:stencil-aligned-to mol X CENTER)))
+
+(def-markup-command (right-align layout props arg) (markup?)
+ "Align @var{arg} on its right edge. "
+ (let* ((m (interpret-markup layout props arg)))
+ (ly:stencil-aligned-to m X RIGHT)))
+
+(def-markup-command (left-align layout props arg) (markup?)
+ "Align @var{arg} on its left edge. "
+ (let* ((m (interpret-markup layout props arg)))
+ (ly:stencil-aligned-to m X LEFT)))
+
+(def-markup-command (general-align layout props axis dir arg) (integer? number? markup?)
+ "Align @var{arg} in @var{axis} direction to the @var{dir} side."
+ (let* ((m (interpret-markup layout props arg)))
+ (ly:stencil-aligned-to m axis dir)))
+
+(def-markup-command (halign layout props dir arg) (number? markup?)
+ "Set horizontal alignment. If @var{dir} is @code{-1}, then it is
+left-aligned, while @code{+1} is right. Values in between interpolate
+alignment accordingly."
+ (let* ((m (interpret-markup layout props arg)))
+ (ly:stencil-aligned-to m X dir)))
+
+
+(def-markup-command (pad-around layout props amount arg) (number? markup?)
+
+ "Add padding @var{amount} all around @var{arg}. "
+
+ (let*
+ ((m (interpret-markup layout props arg))
+ (x (ly:stencil-extent m X))
+ (y (ly:stencil-extent m Y)))
+
+
+ (ly:make-stencil (ly:stencil-expr m)
+ (interval-widen x amount)
+ (interval-widen y amount))
+ ))
+
+
+(def-markup-command (pad-x layout props amount arg) (number? markup?)
+
+ "Add padding @var{amount} around @var{arg} in the X-direction. "
+ (let*
+ ((m (interpret-markup layout props arg))
+ (x (ly:stencil-extent m X))
+ (y (ly:stencil-extent m Y)))
+
+
+ (ly:make-stencil (ly:stencil-expr m)
+ (interval-widen x amount)
+ y)
+ ))
+
+
+(def-markup-command (put-adjacent layout props arg1 axis dir arg2) (markup? integer? ly:dir? markup?)
+
+ "Put @var{arg2} next to @var{arg1}, without moving @var{arg1}. "
+
+ (let* ((m1 (interpret-markup layout props arg1))
+ (m2 (interpret-markup layout props arg2)))
+
+ (ly:stencil-combine-at-edge m1 axis dir m2 0.0 0.0)
+ ))
+
+(def-markup-command (transparent layout props arg) (markup?)
+ "Make the argument transparent"
+ (let*
+ ((m (interpret-markup layout props arg))
+ (x (ly:stencil-extent m X))
+ (y (ly:stencil-extent m Y)))
+
+
+
+ (ly:make-stencil ""
+ x y)))
+
+
+(def-markup-command (pad-to-box layout props x-ext y-ext arg) (number-pair? number-pair? markup?)
+ "Make @var{arg} take at least @var{x-ext}, @var{y-ext} space"
+
+ (let*
+ ((m (interpret-markup layout props arg))
+ (x (ly:stencil-extent m X))
+ (y (ly:stencil-extent m Y)))
+
+
+ (ly:make-stencil (ly:stencil-expr m)
+ (interval-union x-ext x)
+ (interval-union y-ext y))))
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; property
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(def-markup-command (fromproperty layout props symbol) (symbol?)
+ "Read the @var{symbol} from property settings, and produce a stencil
+ from the markup contained within. If @var{symbol} is not defined, it
+ returns an empty markup"
+ (let* ((m (chain-assoc-get symbol props)))
+ (if (markup? m)
+ (interpret-markup layout props m)
+ (ly:make-stencil '() '(1 . -1) '(1 . -1)))))
+
+
+(def-markup-command (on-the-fly layout props procedure arg) (symbol? markup?)
+ "Apply the @var{procedure} markup command to
+@var{arg}. @var{procedure} should take a single argument."
+ (let* ((anonymous-with-signature (lambda (layout props arg) (procedure layout props arg))))
+ (set-object-property! anonymous-with-signature
+ 'markup-signature
+ (list markup?))
+ (interpret-markup layout props (list anonymous-with-signature arg))))
+
+
+
+(def-markup-command (override layout props new-prop arg) (pair? markup?)
+ "Add the first argument in to the property list. Properties may be
+any sort of property supported by @internalsref{font-interface} and
+@internalsref{text-interface}, for example
+
+@verbatim
+\\override #'(font-family . married) \"bla\"
+@end verbatim
+
+"
+ (interpret-markup layout (cons (list new-prop) props) arg))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; fonts.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+(def-markup-command (bigger layout props arg) (markup?)
+ "Increase the font size relative to current setting"
+ (interpret-markup layout props
+ `(,fontsize-markup 1 ,arg)))
+
+(def-markup-command (smaller layout props arg) (markup?)
+ "Decrease the font size relative to current setting"
+ (interpret-markup layout props
+ `(,fontsize-markup -1 ,arg)))
+
+(def-markup-command larger (markup?) bigger-markup)
+
+(def-markup-command (finger layout props arg) (markup?)