(line (make-line-stencil underline-thick x1 y x2 y)))
(ly:stencil-add m line)))
+(define-markup-command (tie layout props arg)
+ (markup?)
+ #:category font
+ #:properties ((thickness 1)
+ (offset 2)
+ (direction UP)
+ (shorten-pair '(0 . 0)))
+ "
+@cindex tie-ing text
+
+Adds a horizontal bow created with @code{make-tie-stencil} at bottom or top
+of @var{arg}. Looks at @code{thickness} to determine line thickness, and
+@code{offset} to determine y-offset. The added bow fits the extent of
+@var{arg}, @code{shorten-pair} may be used to modify this.
+@var{direction} may be set using an @code{override} or direction-modifiers or
+@code{voiceOne}, etc.
+
+@lilypond[verbatim,quote]
+\\markup {
+ \\override #'(direction . 1)
+ \\tie \"above\"
+ \\override #'(direction . -1)
+ \\tie \"below\"
+}
+@end lilypond"
+ (let* ((line-thickness (ly:output-def-lookup layout 'line-thickness))
+ (thick (* thickness line-thickness))
+ (stil (interpret-markup layout props arg))
+ (x1 (car (ly:stencil-extent stil X)))
+ (x2 (cdr (ly:stencil-extent stil X)))
+ (y-ext (ly:stencil-extent stil Y))
+ (y (+ (* line-thickness offset direction)
+ ;; we put out zero for positive text-direction, to make it
+ ;; consistent with `underline-markup'
+ ;; TODO: this will be problematic for args like "Eng"
+ ;; fix it here _and_ in `underline-markup'
+ (if (negative? direction) 0 (cdr y-ext))))
+ (tie
+ (make-tie-stencil
+ (cons (+ x1 (car shorten-pair) line-thickness) y)
+ (cons (- x2 (cdr shorten-pair) line-thickness) y)
+ thick
+ direction)))
+ (ly:stencil-add stil tie)))
+
+(define-markup-command (undertie layout props arg)
+ (markup?)
+ #:category font
+ #:properties (tie-markup)
+ "
+@cindex undertie-ing text
+
+@lilypond[verbatim,quote]
+\\markup \\line {
+ \\undertie \"undertied\"
+ \\override #'(offset . 5)
+ \\override #'(thickness . 1)
+ \\undertie \"undertied\"
+ \\override #'(offset . 1)
+ \\override #'(thickness . 5)
+ \\undertie \"undertied\"
+}
+@end lilypond"
+ (interpret-markup layout (prepend-alist-chain 'direction DOWN props)
+ (make-tie-markup arg)))
+
+(define-markup-command (overtie layout props arg)
+ (markup?)
+ #:category font
+ #:properties (tie-markup)
+ "
+@cindex overtie-ing text
+
+Overtie @var{arg}.
+
+@lilypond[verbatim,quote]
+\\markup \\line {
+ \\overtie \"overtied\"
+ \\override #'(offset . 5)
+ \\override #'(thickness . 1)
+ \\overtie \"overtied\"
+ \\override #'(offset . 1)
+ \\override #'(thickness . 5)
+ \\overtie \"overtied\"
+}
+@end lilypond"
+ (interpret-markup layout (prepend-alist-chain 'direction UP props)
+ (make-tie-markup arg)))
+
(define-markup-command (box layout props arg)
(markup?)
#:category font
(define-markup-command (whiteout layout props arg)
(markup?)
#:category other
- #:properties ((thickness 3))
+ #:properties ((style 'box)
+ (thickness '()))
"
@cindex adding a white background to text
-Provide a white background for @var{arg}.
+Provide a white background for @var{arg}. The shape of the white
+background is determined by @code{style}. The default
+is @code{box} which produces a white rectangle. @code{outline}
+approximates the outline of the markup.
@lilypond[verbatim,quote]
\\markup {
\\combine
- \\filled-box #'(-1 . 10) #'(-3 . 4) #1
- \\override #'(thickness . 1.5) \\whiteout whiteout
+ \\filled-box #'(-1 . 15) #'(-3 . 4) #1
+ \\override #'(thickness . 1.5)
+ \\whiteout whiteout-box
}
-@end lilypond"
- (stencil-whiteout
- (interpret-markup layout props arg)
- (* thickness
- (ly:output-def-lookup layout 'line-thickness))))
-
-(define-markup-command (whiteout-box layout props arg)
- (markup?)
- #:category other
- "
-@cindex adding a rounded rectangular white background to text
-
-Provide a rounded rectangular white background for @var{arg}.
-
-@lilypond[verbatim,quote]
\\markup {
\\combine
- \\filled-box #'(-1 . 10) #'(-3 . 4) #1
- \\whiteout-box whiteout-box
+ \\filled-box #'(-1 . 18) #'(-3 . 4) #1
+ \\override #'(style . outline)
+ \\override #'(thickness . 3)
+ \\whiteout whiteout-outline
}
@end lilypond"
- (stencil-whiteout-box (interpret-markup layout props arg)))
+ (stencil-whiteout
+ (interpret-markup layout props arg)
+ style
+ thickness
+ (ly:output-def-lookup layout 'line-thickness)))
(define-markup-command (pad-markup layout props amount arg)
(number? markup?)
@end lilypond"
(define (concat-string-args arg-list)
(fold-right (lambda (arg result-list)
- (let ((result (if (pair? result-list)
- (car result-list)
- '())))
- (if (and (pair? arg) (eqv? (car arg) simple-markup))
- (set! arg (cadr arg)))
+ (let ((result (and (pair? result-list)
+ (car result-list))))
+ (cond ((not (pair? arg)))
+ ((eq? (car arg) simple-markup)
+ (set! arg (cadr arg)))
+ ((eq? (car arg) char-markup)
+ (set! arg (ly:wide-char->utf-8 (cadr arg)))))
(if (and (string? result) (string? arg))
(cons (string-append arg result) (cdr result-list))
(cons arg result-list))))
Print two markups on top of each other.
Note: @code{\\combine} cannot take a list of markups enclosed in
-curly braces as an argument; the follow example will not compile:
-
-@example
-\\combine @{ a list @}
-@end example
+curly braces as an argument; for this purpose use @code{\\overlay} instead.
@lilypond[verbatim,quote]
\\markup {
(s2 (interpret-markup layout props arg2)))
(ly:stencil-add s1 s2)))
+(define-markup-command (overlay layout props args)
+ (markup-list?)
+ #:category align
+ "
+@cindex merging text
+
+Takes a list of markups combining them.
+
+@lilypond[verbatim,quote]
+\\markup {
+ \\fontsize #5
+ \\override #'(thickness . 2)
+ \\overlay {
+ \\draw-line #'(0 . 4)
+ \\arrow-head #Y #DOWN ##f
+ \\translate #'(0 . 4)\\arrow-head #Y #UP ##f
+ }
+}
+@end lilypond"
+ (apply ly:stencil-add (interpret-markup-list layout props args)))
+
;;
;; TODO: should extract baseline-skip from each argument somehow..
;;
(procedure? markup?)
#:category other
"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))))
+@var{procedure} takes the same arguments as @code{interpret-markup}
+and returns a stencil."
+ (procedure layout props arg))
(define-markup-command (footnote layout props mkup note)
(markup? markup?)
(flag-stencil (buildflags stencil (- log 3) stencil spacing)))
flag-stencil))
- (let* ((font (ly:paper-get-font layout (cons '((font-encoding . fetaMusic))
+ (let* ((font (ly:paper-get-font layout (cons '((font-encoding . fetaMusic)
+ (font-name . #f))
props)))
(size-factor (magstep font-size))
(blot (ly:output-def-lookup layout 'blot-diameter))
(let* ((font
(ly:paper-get-font layout
- (cons '((font-encoding . fetaMusic)) props)))
+ (cons '((font-encoding . fetaMusic)
+ (font-name . #f))
+ props)))
(rest-glyph-name
(let ((result
(get-glyph-name font