thickness))
(x (car dest))
(y (cdr dest)))
- (ly:make-stencil
- `(draw-line
- ,th
- 0 0
- ,x ,y)
- (cons (min x 0) (max x 0))
- (cons (min y 0) (max y 0)))))
+ (make-line-stencil th 0 0 x y)))
(define-builtin-markup-command (draw-circle layout props radius thickness fill)
(number? number? boolean?)
(x1 (car (ly:stencil-extent markup X)))
(x2 (cdr (ly:stencil-extent markup X)))
(y (* thick -2))
- (line (ly:make-stencil
- `(draw-line ,thick ,x1 ,y ,x2 ,y)
- (cons (min x1 0) (max x2 0))
- (cons thick thick))))
+ (line (make-line-stencil thick x1 y x2 y)))
(ly:stencil-add markup line)))
(define-builtin-markup-command (box layout props arg)
(corner-radius 1)
(font-size 0)
(box-padding 0.5))
- "@cindex enclosing text in a bow with rounded corners
+ "@cindex enclosing text in a box with rounded corners
@cindex drawing boxes with rounded corners around text
Draw a box with rounded corners around @var{arg}. Looks at @code{thickness},
@code{box-padding} and @code{font-size} properties to determine line
thickness and padding around the markup; the @code{corner-radius} property
-makes possible to define another shape for the corners (default is 1).
+makes it possible to define another shape for the corners (default is 1).
@lilypond[quote,verbatim,relative=2]
c4^\\markup {
@lilypond[verbatim,quote]
\\markup {
\\line {
- A simple line of text
+ one two three
}
}
@end lilypond"
@lilypond[verbatim,quote]
\\markup {
- \\bold {
- au
- \\concat {
- Mouv
- \\super
- t
- }
+ \\concat {
+ one
+ two
+ three
}
}
@end lilypond"
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))
@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?)
@lilypond[verbatim,quote]
\\markup {
- \\arrow-head #X #RIGHT ##f
+ one
\\vcenter
- Centered
- \\arrow-head #X #LEFT ##f
+ two
+ three
}
@end lilypond"
(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
()
@lilypond[verbatim,quote]
\\markup {
\\column {
- ↓
- \\hcenter
- centered
+ one
+ \\center-align
+ two
+ three
}
}
@end lilypond"
@lilypond[verbatim,quote]
\\markup {
\\column {
- ↓
+ one
\\right-align
- right-aligned
+ two
+ three
}
}
@end lilypond"
@lilypond[verbatim,quote]
\\markup {
\\column {
- ↓
+ one
\\left-align
- left-aligned
+ two
+ three
}
}
@end lilypond"
@lilypond[verbatim,quote]
\\markup {
\\column {
- ↓
+ one
\\general-align #X #LEFT
- \\line { X, Left }
- ↓
+ two
+ three
+ \\null
+ one
\\general-align #X #CENTER
- \\line { X, Center }
+ two
+ three
\\null
\\line {
- \\arrow-head #X #RIGHT ##f
- \\general-align #Y #DOWN
- \\line { Y, Down }
- \\arrow-head #X #LEFT ##f
+ one
+ \\general-align #Y #UP
+ two
+ three
}
+ \\null
\\line {
- \\arrow-head #X #RIGHT ##f
+ one
\\general-align #Y #3.2
- \\line {
- \\line { Y, Arbitrary alignment }
- }
- \\arrow-head #X #LEFT ##f
+ two
+ three
}
}
}
@lilypond[verbatim,quote]
\\markup {
\\column {
- ↓
+ one
\\halign #LEFT
- Left
- ↓
+ two
+ three
+ \\null
+ one
\\halign #CENTER
- Center
- ↓
+ two
+ three
+ \\null
+ one
\\halign #RIGHT
- Right
- ↓
- \\halign #1.2
- \\line {
- Arbitrary alignment
- }
+ two
+ three
+ \\null
+ one
+ \\halign #-5
+ two
+ three
}
}
@end lilypond"
(make-pad-to-box-markup
(cons (/ length -2) (/ length 2))
'(0 . 0)
- (make-hcenter-markup arg))))
+ (make-center-align-markup arg))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; property
;; fonts.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(define-builtin-markup-command (bigger layout props arg)
- (markup?)
- font
- ()
- "Increase the font size relative to current setting.
-
-@lilypond[verbatim,quote]
-\\markup {
- \\huge {
- huge
- \\hspace #2
- \\bigger {
- bigger
- }
- \\hspace #2
- huge
- }
-}
-@end lilypond"
- (interpret-markup layout props
- `(,fontsize-markup 1 ,arg)))
(define-builtin-markup-command (smaller layout props arg)
(markup?)
(markup?)
font
()
- "Copy of the @code{\\bigger} command.
+ "Increase the font size relative to current setting.
@lilypond[verbatim,quote]
\\markup {
larger
}
@end lilypond"
- (interpret-markup layout props (make-bigger-markup arg)))
+ (interpret-markup layout props
+ `(,fontsize-markup 1 ,arg)))
(define-builtin-markup-command (finger layout props arg)
(markup?)
(num-y (interval-widen (cons center center) (abs dy)))
(is-sane (and (interval-sane? num-x) (interval-sane? num-y)))
(slash-stencil (if is-sane
- (ly:make-stencil
- `(draw-line ,thickness
- ,(car num-x) ,(- (interval-center num-y) dy)
- ,(cdr num-x) ,(+ (interval-center num-y) dy))
- num-x num-y)
+ (make-line-stencil thickness
+ (car num-x) (- (interval-center num-y) dy)
+ (cdr num-x) (+ (interval-center num-y) dy))
#f)))
(if (ly:stencil? slash-stencil)
(begin
@lilypond[verbatim,quote]
\\markup {
- default
- \\lower #3 {
- three spaces lower
- }
+ one
+ \\lower #3
+ two
+ three
}
@end lilypond"
(ly:stencil-translate-axis (interpret-markup layout props arg)