1 ;;;; define-markup-commands.scm -- markup commands
3 ;;;; source file of the GNU LilyPond music typesetter
5 ;;;; (c) 2000--2006 Han-Wen Nienhuys <hanwen@cs.uu.nl>
6 ;;;; Jan Nieuwenhuizen <janneke@gnu.org>
10 ;;; * each markup function should have a doc string with
11 ;; syntax, description and example.
13 (use-modules (ice-9 regex))
15 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19 (define-public empty-stencil (ly:make-stencil '() '(1 . -1) '(1 . -1)))
20 (define-public point-stencil (ly:make-stencil "" '(0 . 0) '(0 . 0)))
23 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
27 (define-markup-command (draw-circle layout props radius thickness fill)
28 (number? number? boolean?)
29 "A circle of radius @var{radius}, thickness @var{thickness} and
31 (make-circle-stencil radius thickness fill))
33 (define-markup-command (triangle layout props filled) (boolean?)
34 "A triangle, filled or not"
36 ((th (chain-assoc-get 'thickness props 0.1))
37 (size (chain-assoc-get 'font-size props 0))
40 (chain-assoc-get 'baseline-skip props 2))))
54 (define-markup-command (circle layout props arg) (markup?)
55 "Draw a circle around @var{arg}. Use @code{thickness},
56 @code{circle-padding} and @code{font-size} properties to determine line
57 thickness and padding around the markup."
58 (let* ((th (chain-assoc-get 'thickness props 0.1))
59 (size (chain-assoc-get 'font-size props 0))
62 (chain-assoc-get 'circle-padding props 0.2)))
63 (m (interpret-markup layout props arg)))
64 (circle-stencil m th pad)))
66 (define-markup-command (with-url layout props url arg) (string? markup?)
67 "Add a link to URL @var{url} around @var{arg}. This only works in
69 (let* ((stil (interpret-markup layout props arg))
70 (xextent (ly:stencil-extent stil X))
71 (yextent (ly:stencil-extent stil Y))
72 (old-expr (ly:stencil-expr stil))
73 (url-expr (list 'url-link url `(quote ,xextent) `(quote ,yextent))))
74 (ly:stencil-add (ly:make-stencil url-expr xextent yextent) stil)))
77 (define-markup-command (beam layout props width slope thickness)
78 (number? number? number?)
79 "Create a beam with the specified parameters."
80 (let* ((y (* slope width))
81 (yext (cons (min 0 y) (max 0 y)))
82 (half (/ thickness 2)))
87 width (+ (* width slope) (/ thickness -2))
88 width (+ (* width slope) (/ thickness 2))
90 ,(ly:output-def-lookup layout 'blot-diameter)
93 (cons (+ (- half) (car yext))
94 (+ half (cdr yext))))))
96 (define-markup-command (box layout props arg) (markup?)
97 "Draw a box round @var{arg}. Looks at @code{thickness},
98 @code{box-padding} and @code{font-size} properties to determine line
99 thickness and padding around the markup."
101 (let* ((th (chain-assoc-get 'thickness props 0.1))
102 (size (chain-assoc-get 'font-size props 0))
103 (pad (* (magstep size)
104 (chain-assoc-get 'box-padding props 0.2)))
105 (m (interpret-markup layout props arg)))
106 (box-stencil m th pad)))
108 (define-markup-command (filled-box layout props xext yext blot)
109 (number-pair? number-pair? number?)
110 "Draw a box with rounded corners of dimensions @var{xext} and
111 @var{yext}. For example,
113 \\filled-box #'(-.3 . 1.8) #'(-.3 . 1.8) #0
115 create a box extending horizontally from -0.3 to 1.8 and
116 vertically from -0.3 up to 1.8, with corners formed from a
117 circle of diameter 0 (ie sharp corners)."
121 (define-markup-command (rotate layout props ang arg) (number? markup?)
122 "Rotate object with @var{ang} degrees around its center."
123 (let* ((stil (interpret-markup layout props arg)))
124 (ly:stencil-rotate stil ang 0 0)))
127 (define-markup-command (whiteout layout props arg) (markup?)
128 "Provide a white underground for @var{arg}"
129 (let* ((stil (interpret-markup layout props
130 (make-with-color-markup black arg)))
132 (interpret-markup layout props
133 (make-with-color-markup
135 (make-filled-box-markup
136 (ly:stencil-extent stil X)
137 (ly:stencil-extent stil Y)
140 (ly:stencil-add white stil)))
142 (define-markup-command (pad-markup layout props padding arg) (number? markup?)
143 "Add space around a markup object."
146 ((stil (interpret-markup layout props arg))
147 (xext (ly:stencil-extent stil X))
148 (yext (ly:stencil-extent stil Y)))
151 (ly:stencil-expr stil)
152 (interval-widen xext padding)
153 (interval-widen yext padding))))
155 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
157 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
159 ;;FIXME: is this working?
160 (define-markup-command (strut layout props) ()
161 "Create a box of the same height as the space in the current font."
162 (let ((m (ly:text-interface::interpret-markup layout props " ")))
163 (ly:make-stencil (ly:stencil-expr m)
165 (ly:stencil-extent m X)
169 ;; todo: fix negative space
170 (define-markup-command (hspace layout props amount) (number?)
171 "This produces a invisible object taking horizontal space.
173 \\markup @{ A \\hspace #2.0 B @}
175 will put extra space between A and B, on top of the space that is
176 normally inserted before elements on a line.
179 (ly:make-stencil "" (cons 0 amount) '(-1 . 1))
180 (ly:make-stencil "" (cons amount amount) '(-1 . 1))))
183 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
184 ;; importing graphics.
185 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
187 (define-markup-command (stencil layout props stil) (ly:stencil?)
192 (make-regexp "%%BoundingBox:[ \t]+([0-9-]+)[ \t]+([0-9-]+)[ \t]+([0-9-]+)[ \t]+([0-9-]+)"))
194 (define (get-postscript-bbox string)
195 "Extract the bbox from STRING, or return #f if not present."
197 ((match (regexp-exec bbox-regexp string)))
201 (string->number (match:substring match x)))
206 (define-markup-command (epsfile layout props axis size file-name) (number? number? string?)
207 "Inline an EPS image. The image is scaled along @var{axis} to
210 (if (ly:get-option 'safe)
211 (interpret-markup layout props "not allowed in safe")
212 (eps-file->stencil axis size file-name)
215 (define-markup-command (postscript layout props str) (string?)
216 "This inserts @var{str} directly into the output as a PostScript
217 command string. Due to technicalities of the output backends,
218 different scales should be used for the @TeX{} and PostScript backend,
219 selected with @code{-f}.
222 For the TeX backend, the following string prints a rotated text
227 0 0 moveto /ecrm10 findfont
228 1.75 scalefont setfont 90 rotate (hello) show
232 The magical constant 1.75 scales from LilyPond units (staff spaces) to
235 For the postscript backend, use the following
238 gsave /ecrm10 findfont
239 10.0 output-scale div
240 scalefont setfont 90 rotate (hello) show grestore
245 (list 'embedded-ps str)
249 (define-markup-command (score layout props score) (ly:score?)
250 "Inline an image of music."
251 (let* ((output (ly:score-embedded-format score layout)))
253 (if (ly:music-output? output)
254 (paper-system-stencil
255 (vector-ref (ly:paper-score-paper-systems output) 0))
257 (ly:warning (_"no systems found in \\score markup, does it have a \\layout block?"))
260 (define-markup-command (null layout props) ()
261 "An empty markup with extents of a single point"
265 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
267 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
269 (define-markup-command (simple layout props str) (string?)
270 "A simple text string; @code{\\markup @{ foo @}} is equivalent with
271 @code{\\markup @{ \\simple #\"foo\" @}}."
272 (interpret-markup layout props str))
275 ;; TODO: use font recoding.
277 ;; (map make-word-markup (string-tokenize str)))))
279 (define-public empty-markup
280 (make-simple-markup ""))
282 ;; helper for justifying lines.
283 (define (get-fill-space word-count line-width text-widths)
284 "Calculate the necessary paddings between each two adjacent texts.
285 The lengths of all texts are stored in @var{text-widths}.
286 The normal formula for the padding between texts a and b is:
287 padding = line-width/(word-count - 1) - (length(a) + length(b))/2
288 The first and last padding have to be calculated specially using the
289 whole length of the first or last text.
290 Return a list of paddings.
293 ((null? text-widths) '())
295 ;; special case first padding
296 ((= (length text-widths) word-count)
298 (- (- (/ line-width (1- word-count)) (car text-widths))
299 (/ (car (cdr text-widths)) 2))
300 (get-fill-space word-count line-width (cdr text-widths))))
301 ;; special case last padding
302 ((= (length text-widths) 2)
303 (list (- (/ line-width (1- word-count))
304 (+ (/ (car text-widths) 2) (car (cdr text-widths)))) 0))
307 (- (/ line-width (1- word-count))
308 (/ (+ (car text-widths) (car (cdr text-widths))) 2))
309 (get-fill-space word-count line-width (cdr text-widths))))))
311 (define-markup-command (fill-line layout props markups)
313 "Put @var{markups} in a horizontal line of width @var{line-width}.
314 The markups are spaced/flushed to fill the entire line.
315 If there are no arguments, return an empty stencil."
317 (let* ((orig-stencils
318 (map (lambda (x) (interpret-markup layout props x))
322 (if (ly:stencil-empty? stc)
324 stc)) orig-stencils))
327 (if (ly:stencil-empty? stc)
329 (interval-length (ly:stencil-extent stc X))))
331 (text-width (apply + text-widths))
332 (text-dir (chain-assoc-get 'text-direction props RIGHT))
333 (word-count (length stencils))
334 (word-space (chain-assoc-get 'word-space props))
335 (line-width (chain-assoc-get 'line-width props))
340 (/ (- line-width text-width) 2)
341 (/ (- line-width text-width) 2)))
344 (- line-width text-width)))
346 (get-fill-space word-count line-width text-widths))))
354 (line-stencils (if (= word-count 1)
361 (if (= text-dir LEFT)
362 (set! line-stencils (reverse line-stencils)))
364 (if (null? (remove ly:stencil-empty? orig-stencils))
366 (stack-stencils-padding-list X
367 RIGHT fill-space-normal line-stencils))))
369 (define-markup-command (line layout props args) (markup-list?)
370 "Put @var{args} in a horizontal line. The property @code{word-space}
371 determines the space between each markup in @var{args}."
373 ((stencils (map (lambda (m) (interpret-markup layout props m)) args))
374 (space (chain-assoc-get 'word-space props))
375 (text-dir (chain-assoc-get 'text-direction props RIGHT))
378 (if (= text-dir LEFT)
379 (set! stencils (reverse stencils)))
384 (remove ly:stencil-empty? stencils))))
387 (define (wordwrap-stencils stencils
388 justify base-space line-width text-dir)
390 "Perform simple wordwrap, return stencil of each line."
392 (define space (if justify
394 ;; justify only stretches lines.
398 (define (take-list width space stencils
399 accumulator accumulated-width)
400 "Return (head-list . tail) pair, with head-list fitting into width"
402 (cons accumulator stencils)
404 ((first (car stencils))
405 (first-wid (cdr (ly:stencil-extent (car stencils) X)))
406 (newwid (+ space first-wid accumulated-width))
410 (or (null? accumulator)
413 (take-list width space
415 (cons first accumulator)
417 (cons accumulator stencils))
425 ((line-break (take-list line-width space todo
427 (line-stencils (car line-break))
428 (space-left (- line-width (apply + (map (lambda (x) (cdr (ly:stencil-extent x X)))
431 (line-word-space (cond
432 ((not justify) space)
434 ;; don't stretch last line of paragraph.
435 ;; hmmm . bug - will overstretch the last line in some case.
436 ((null? (cdr line-break))
438 ((null? line-stencils) 0.0)
439 ((null? (cdr line-stencils)) 0.0)
440 (else (/ space-left (1- (length line-stencils))))))
442 (line (stack-stencil-line
444 (if (= text-dir RIGHT)
445 (reverse line-stencils)
448 (if (pair? (cdr line-break))
449 (loop (cons line lines)
453 (if (= text-dir LEFT)
455 (ly:stencil-translate-axis line
456 (- line-width (interval-end (ly:stencil-extent line X)))
458 (reverse (cons line lines))
465 (define (wordwrap-markups layout props args justify)
467 ((baseline-skip (chain-assoc-get 'baseline-skip props))
468 (line-width (chain-assoc-get 'line-width props))
469 (word-space (chain-assoc-get 'word-space props))
470 (text-dir (chain-assoc-get 'text-direction props RIGHT))
471 (lines (wordwrap-stencils
472 (remove ly:stencil-empty?
473 (map (lambda (m) (interpret-markup layout props m)) args))
474 justify word-space line-width
478 (stack-lines DOWN 0.0 baseline-skip lines)))
480 (define-markup-command (justify layout props args) (markup-list?)
481 "Like wordwrap, but with lines stretched to justify the margins.
482 Use @code{\\override #'(line-width . X)} to set line-width, where X
483 is the number of staff spaces."
485 (wordwrap-markups layout props args #t))
487 (define-markup-command (wordwrap layout props args) (markup-list?)
488 "Simple wordwrap. Use @code{\\override #'(line-width . X)} to set
489 line-width, where X is the number of staff spaces."
491 (wordwrap-markups layout props args #f))
493 (define (wordwrap-string layout props justify arg)
495 ((baseline-skip (chain-assoc-get 'baseline-skip props))
496 (line-width (chain-assoc-get 'line-width props))
497 (word-space (chain-assoc-get 'word-space props))
499 (para-strings (regexp-split
500 (string-regexp-substitute "\r" "\n"
501 (string-regexp-substitute "\r\n" "\n" arg))
502 "\n[ \t\n]*\n[ \t\n]*"))
504 (text-dir (chain-assoc-get 'text-direction props RIGHT))
505 (list-para-words (map (lambda (str)
506 (regexp-split str "[ \t\n]+"))
508 (para-lines (map (lambda (words)
512 ly:stencil-empty? (map
514 (interpret-markup layout props x))
516 (lines (wordwrap-stencils stencils
525 (stack-lines DOWN 0.0 baseline-skip (apply append para-lines))))
528 (define-markup-command (wordwrap-string layout props arg) (string?)
529 "Wordwrap a string. Paragraphs may be separated with double newlines"
530 (wordwrap-string layout props #f arg))
532 (define-markup-command (justify-string layout props arg) (string?)
533 "Justify a string. Paragraphs may be separated with double newlines"
534 (wordwrap-string layout props #t arg))
537 (define-markup-command (wordwrap-field layout props symbol) (symbol?)
538 (let* ((m (chain-assoc-get symbol props)))
540 (interpret-markup layout props
541 (list wordwrap-string-markup m))
542 (ly:make-stencil '() '(1 . -1) '(1 . -1)))))
544 (define-markup-command (justify-field layout props symbol) (symbol?)
545 - (let* ((m (chain-assoc-get symbol props)))
547 (interpret-markup layout props
548 (list justify-string-markup m))
549 (ly:make-stencil '() '(1 . -1) '(1 . -1)))))
553 (define-markup-command (combine layout props m1 m2) (markup? markup?)
554 "Print two markups on top of each other."
555 (let* ((s1 (interpret-markup layout props m1))
556 (s2 (interpret-markup layout props m2)))
557 (ly:stencil-add s1 s2)))
560 ;; TODO: should extract baseline-skip from each argument somehow..
562 (define-markup-command (column layout props args) (markup-list?)
563 "Stack the markups in @var{args} vertically. The property
564 @code{baseline-skip} determines the space between each markup in @var{args}."
567 ((arg-stencils (map (lambda (m) (interpret-markup layout props m)) args))
568 (skip (chain-assoc-get 'baseline-skip props)))
573 (remove ly:stencil-empty? arg-stencils))))
576 (define-markup-command (dir-column layout props args) (markup-list?)
577 "Make a column of args, going up or down, depending on the setting
578 of the @code{#'direction} layout property."
579 (let* ((dir (chain-assoc-get 'direction props)))
581 (if (number? dir) dir -1)
583 (chain-assoc-get 'baseline-skip props)
584 (map (lambda (x) (interpret-markup layout props x)) args))))
586 (define-markup-command (center-align layout props args) (markup-list?)
587 "Put @code{args} in a centered column. "
588 (let* ((mols (map (lambda (x) (interpret-markup layout props x)) args))
589 (cmols (map (lambda (x) (ly:stencil-aligned-to x X CENTER)) mols)))
591 (stack-lines -1 0.0 (chain-assoc-get 'baseline-skip props) cmols)))
593 (define-markup-command (vcenter layout props arg) (markup?)
594 "Align @code{arg} to its Y center. "
595 (let* ((mol (interpret-markup layout props arg)))
596 (ly:stencil-aligned-to mol Y CENTER)))
598 (define-markup-command (hcenter layout props arg) (markup?)
599 "Align @code{arg} to its X center. "
600 (let* ((mol (interpret-markup layout props arg)))
601 (ly:stencil-aligned-to mol X CENTER)))
603 (define-markup-command (right-align layout props arg) (markup?)
604 "Align @var{arg} on its right edge. "
605 (let* ((m (interpret-markup layout props arg)))
606 (ly:stencil-aligned-to m X RIGHT)))
608 (define-markup-command (left-align layout props arg) (markup?)
609 "Align @var{arg} on its left edge. "
610 (let* ((m (interpret-markup layout props arg)))
611 (ly:stencil-aligned-to m X LEFT)))
613 (define-markup-command (general-align layout props axis dir arg) (integer? number? markup?)
614 "Align @var{arg} in @var{axis} direction to the @var{dir} side."
615 (let* ((m (interpret-markup layout props arg)))
616 (ly:stencil-aligned-to m axis dir)))
618 (define-markup-command (halign layout props dir arg) (number? markup?)
619 "Set horizontal alignment. If @var{dir} is @code{-1}, then it is
620 left-aligned, while @code{+1} is right. Values in between interpolate
621 alignment accordingly."
622 (let* ((m (interpret-markup layout props arg)))
623 (ly:stencil-aligned-to m X dir)))
627 (define-markup-command (with-dimensions layout props x y arg) (number-pair? number-pair? markup?)
628 "Set the dimensions of @var{arg} to @var{x} and @var{y}."
630 (let* ((m (interpret-markup layout props arg)))
631 (ly:make-stencil (ly:stencil-expr m) x y)))
634 (define-markup-command (pad-around layout props amount arg) (number? markup?)
636 "Add padding @var{amount} all around @var{arg}. "
639 ((m (interpret-markup layout props arg))
640 (x (ly:stencil-extent m X))
641 (y (ly:stencil-extent m Y)))
644 (ly:make-stencil (ly:stencil-expr m)
645 (interval-widen x amount)
646 (interval-widen y amount))
650 (define-markup-command (pad-x layout props amount arg) (number? markup?)
652 "Add padding @var{amount} around @var{arg} in the X-direction. "
654 ((m (interpret-markup layout props arg))
655 (x (ly:stencil-extent m X))
656 (y (ly:stencil-extent m Y)))
659 (ly:make-stencil (ly:stencil-expr m)
660 (interval-widen x amount)
665 (define-markup-command (put-adjacent layout props arg1 axis dir arg2) (markup? integer? ly:dir? markup?)
667 "Put @var{arg2} next to @var{arg1}, without moving @var{arg1}. "
669 (let* ((m1 (interpret-markup layout props arg1))
670 (m2 (interpret-markup layout props arg2)))
672 (ly:stencil-combine-at-edge m1 axis dir m2 0.0 0.0)
675 (define-markup-command (transparent layout props arg) (markup?)
676 "Make the argument transparent"
678 ((m (interpret-markup layout props arg))
679 (x (ly:stencil-extent m X))
680 (y (ly:stencil-extent m Y)))
688 (define-markup-command (pad-to-box layout props x-ext y-ext arg)
689 (number-pair? number-pair? markup?)
690 "Make @var{arg} take at least @var{x-ext}, @var{y-ext} space"
693 ((m (interpret-markup layout props arg))
694 (x (ly:stencil-extent m X))
695 (y (ly:stencil-extent m Y)))
697 (ly:make-stencil (ly:stencil-expr m)
698 (interval-union x-ext x)
699 (interval-union y-ext y))))
702 (define-markup-command (hcenter-in layout props length arg)
704 "Center @var{arg} horizontally within a box of extending
705 @var{length}/2 to the left and right."
707 (interpret-markup layout props
708 (make-pad-to-box-markup
709 (cons (/ length -2) (/ length 2))
711 (make-hcenter-markup arg))))
714 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
716 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
718 (define-markup-command (fromproperty layout props symbol) (symbol?)
719 "Read the @var{symbol} from property settings, and produce a stencil
720 from the markup contained within. If @var{symbol} is not defined, it
721 returns an empty markup"
722 (let* ((m (chain-assoc-get symbol props)))
724 (interpret-markup layout props m)
725 (ly:make-stencil '() '(1 . -1) '(1 . -1)))))
728 (define-markup-command (on-the-fly layout props procedure arg) (symbol? markup?)
729 "Apply the @var{procedure} markup command to
730 @var{arg}. @var{procedure} should take a single argument."
731 (let* ((anonymous-with-signature (lambda (layout props arg) (procedure layout props arg))))
732 (set-object-property! anonymous-with-signature
735 (interpret-markup layout props (list anonymous-with-signature arg))))
739 (define-markup-command (override layout props new-prop arg) (pair? markup?)
740 "Add the first argument in to the property list. Properties may be
741 any sort of property supported by @internalsref{font-interface} and
742 @internalsref{text-interface}, for example
745 \\override #'(font-family . married) \"bla\"
749 (interpret-markup layout (cons (list new-prop) props) arg))
751 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
753 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
755 (define-markup-command (verbatim-file layout props name) (string?)
756 "Read the contents of a file, and include verbatimly"
760 (if (ly:get-option 'safe)
761 "verbatim-file disabled in safe mode"
763 ((str (ly:gulp-file name))
764 (lines (string-split str #\nl)))
766 (make-typewriter-markup
767 (make-column-markup lines)))
770 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
772 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
775 (define-markup-command (bigger layout props arg) (markup?)
776 "Increase the font size relative to current setting"
777 (interpret-markup layout props
778 `(,fontsize-markup 1 ,arg)))
780 (define-markup-command (smaller layout props arg) (markup?)
781 "Decrease the font size relative to current setting"
782 (interpret-markup layout props
783 `(,fontsize-markup -1 ,arg)))
785 (define-markup-command larger (markup?) bigger-markup)
787 (define-markup-command (finger layout props arg) (markup?)
788 "Set the argument as small numbers."
789 (interpret-markup layout
790 (cons '((font-size . -5) (font-encoding . fetaNumber)) props)
794 (define-markup-command (fontsize layout props increment arg) (number? markup?)
795 "Add @var{increment} to the font-size. Adjust baseline skip accordingly."
797 (let* ((fs (chain-assoc-get 'font-size props 0))
798 (bs (chain-assoc-get 'baseline-skip props 2))
800 (cons 'baseline-skip (* bs (magstep increment)))
801 (cons 'font-size (+ fs increment )))))
803 (interpret-markup layout (cons entries props) arg)))
807 ;; FIXME -> should convert to font-size.
808 (define-markup-command (magnify layout props sz arg) (number? markup?)
809 "Set the font magnification for the its argument. In the following
810 example, the middle A will be 10% larger:
812 A \\magnify #1.1 @{ A @} A
815 Note: magnification only works if a font-name is explicitly selected.
816 Use @code{\\fontsize} otherwise."
819 (prepend-alist-chain 'font-magnification sz props)
822 (define-markup-command (bold layout props arg) (markup?)
823 "Switch to bold font-series"
824 (interpret-markup layout (prepend-alist-chain 'font-series 'bold props) arg))
826 (define-markup-command (sans layout props arg) (markup?)
827 "Switch to the sans serif family"
828 (interpret-markup layout (prepend-alist-chain 'font-family 'sans props) arg))
830 (define-markup-command (number layout props arg) (markup?)
831 "Set font family to @code{number}, which yields the font used for
832 time signatures and fingerings. This font only contains numbers and
833 some punctuation. It doesn't have any letters. "
834 (interpret-markup layout (prepend-alist-chain 'font-encoding 'fetaNumber props) arg))
836 (define-markup-command (roman layout props arg) (markup?)
837 "Set font family to @code{roman}."
838 (interpret-markup layout (prepend-alist-chain 'font-family 'roman props) arg))
840 (define-markup-command (huge layout props arg) (markup?)
841 "Set font size to +2."
842 (interpret-markup layout (prepend-alist-chain 'font-size 2 props) arg))
844 (define-markup-command (large layout props arg) (markup?)
845 "Set font size to +1."
846 (interpret-markup layout (prepend-alist-chain 'font-size 1 props) arg))
848 (define-markup-command (normalsize layout props arg) (markup?)
849 "Set font size to default."
850 (interpret-markup layout (prepend-alist-chain 'font-size 0 props) arg))
852 (define-markup-command (small layout props arg) (markup?)
853 "Set font size to -1."
854 (interpret-markup layout (prepend-alist-chain 'font-size -1 props) arg))
856 (define-markup-command (tiny layout props arg) (markup?)
857 "Set font size to -2."
858 (interpret-markup layout (prepend-alist-chain 'font-size -2 props) arg))
860 (define-markup-command (teeny layout props arg) (markup?)
861 "Set font size to -3."
862 (interpret-markup layout (prepend-alist-chain 'font-size -3 props) arg))
864 (define-markup-command (caps layout props arg) (markup?)
865 "Set @code{font-shape} to @code{caps}."
866 (interpret-markup layout (prepend-alist-chain 'font-shape 'caps props) arg))
869 (define-markup-command (smallCaps layout props text) (markup?)
870 "Turn @code{text}, which should be a string, to small caps.
872 \\markup \\smallCaps \"Text between double quotes\"
875 (define (make-small-caps-markup chars)
878 ((char-whitespace? (car chars))
879 (markup #:fontsize -2 #:simple (string-upcase (list->string (cdr chars)))))
882 #:fontsize -2 #:simple (string-upcase (list->string chars))))))
883 (define (make-not-small-caps-markup chars)
886 ((char-whitespace? (car chars))
887 (markup #:simple (list->string (cdr chars))))
890 #:simple (list->string chars)))))
891 (define (small-caps-aux done-markups current-chars rest-chars small? after-space?)
892 (cond ((null? rest-chars)
893 ;; the end of the string: build the markup
894 (make-line-markup (reverse! (cons ((if small?
895 make-small-caps-markup
896 make-not-small-caps-markup)
897 (reverse! current-chars))
899 ((char-whitespace? (car rest-chars))
901 (small-caps-aux done-markups current-chars (cdr rest-chars) small? #t))
902 ((or (and small? (char-lower-case? (car rest-chars)))
903 (and (not small?) (not (char-lower-case? (car rest-chars)))))
905 ;; add the char to the current char list
906 (small-caps-aux done-markups
907 (cons (car rest-chars)
909 (cons #\space current-chars)
916 ;; make a markup with current chars, and start a new list with new char
917 (small-caps-aux (cons ((if small?
918 make-small-caps-markup
919 make-not-small-caps-markup)
920 (reverse! current-chars))
923 (list (car rest-chars) #\space)
924 (list (car rest-chars)))
928 (interpret-markup layout props (small-caps-aux (list)
930 (cons #\space (string->list text))
934 (define-markup-command (dynamic layout props arg) (markup?)
935 "Use the dynamic font. This font only contains @b{s}, @b{f}, @b{m},
936 @b{z}, @b{p}, and @b{r}. When producing phrases, like ``pi@`{u} @b{f}'', the
937 normal words (like ``pi@`{u}'') should be done in a different font. The
938 recommend font for this is bold and italic"
940 layout (prepend-alist-chain 'font-encoding 'fetaDynamic props) arg))
942 (define-markup-command (text layout props arg) (markup?)
943 "Use a text font instead of music symbol or music alphabet font."
946 (interpret-markup layout (prepend-alist-chain 'font-encoding 'latin1 props)
950 (define-markup-command (italic layout props arg) (markup?)
951 "Use italic @code{font-shape} for @var{arg}. "
952 (interpret-markup layout (prepend-alist-chain 'font-shape 'italic props) arg))
954 (define-markup-command (typewriter layout props arg) (markup?)
955 "Use @code{font-family} typewriter for @var{arg}."
957 layout (prepend-alist-chain 'font-family 'typewriter props) arg))
959 (define-markup-command (upright layout props arg) (markup?)
960 "Set font shape to @code{upright}. This is the opposite of @code{italic}."
962 layout (prepend-alist-chain 'font-shape 'upright props) arg))
964 (define-markup-command (medium layout props arg) (markup?)
965 "Switch to medium font-series (in contrast to bold)."
966 (interpret-markup layout (prepend-alist-chain 'font-series 'medium props)
969 (define-markup-command (normal-text layout props arg) (markup?)
970 "Set all font related properties (except the size) to get the default normal text font, no matter what font was used earlier."
972 (interpret-markup layout
973 (cons '((font-family . roman) (font-shape . upright)
974 (font-series . medium) (font-encoding . latin1))
978 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
980 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
982 (define-markup-command (doublesharp layout props) ()
983 "Draw a double sharp symbol."
985 (interpret-markup layout props (markup #:musicglyph "accidentals.4")))
987 (define-markup-command (sesquisharp layout props) ()
988 "Draw a 3/2 sharp symbol."
989 (interpret-markup layout props (markup #:musicglyph "accidentals.3")))
991 (define-markup-command (sharp layout props) ()
992 "Draw a sharp symbol."
993 (interpret-markup layout props (markup #:musicglyph "accidentals.2")))
995 (define-markup-command (semisharp layout props) ()
996 "Draw a semi sharp symbol."
997 (interpret-markup layout props (markup #:musicglyph "accidentals.1")))
999 (define-markup-command (natural layout props) ()
1000 "Draw a natural symbol."
1001 (interpret-markup layout props (markup #:musicglyph "accidentals.0")))
1003 (define-markup-command (semiflat layout props) ()
1005 (interpret-markup layout props (markup #:musicglyph "accidentals.M1")))
1007 (define-markup-command (flat layout props) ()
1008 "Draw a flat symbol."
1009 (interpret-markup layout props (markup #:musicglyph "accidentals.M2")))
1011 (define-markup-command (sesquiflat layout props) ()
1012 "Draw a 3/2 flat symbol."
1013 (interpret-markup layout props (markup #:musicglyph "accidentals.M3")))
1015 (define-markup-command (doubleflat layout props) ()
1016 "Draw a double flat symbol."
1017 (interpret-markup layout props (markup #:musicglyph "accidentals.M4")))
1019 (define-markup-command (with-color layout props color arg) (color? markup?)
1020 "Draw @var{arg} in color specified by @var{color}"
1022 (let* ((stil (interpret-markup layout props arg)))
1024 (ly:make-stencil (list 'color color (ly:stencil-expr stil))
1025 (ly:stencil-extent stil X)
1026 (ly:stencil-extent stil Y))))
1029 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1031 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1034 (define-markup-command (arrow-head layout props axis direction filled)
1035 (integer? ly:dir? boolean?)
1036 "produce an arrow head in specified direction and axis. Use the filled head if @var{filled} is specified."
1038 ((name (format "arrowheads.~a.~a~a"
1045 (ly:paper-get-font layout (cons '((font-encoding . fetaMusic))
1049 (define-markup-command (musicglyph layout props glyph-name) (string?)
1050 "This is converted to a musical symbol, e.g. @code{\\musicglyph
1051 #\"accidentals.0\"} will select the natural sign from the music font.
1052 See @usermanref{The Feta font} for a complete listing of the possible glyphs."
1054 (ly:paper-get-font layout (cons '((font-encoding . fetaMusic))
1058 (define-markup-command (lookup layout props glyph-name) (string?)
1059 "Lookup a glyph by name."
1060 (ly:font-get-glyph (ly:paper-get-font layout props)
1063 (define-markup-command (char layout props num) (integer?)
1064 "Produce a single character, e.g. @code{\\char #65} produces the
1066 (ly:get-glyph (ly:paper-get-font layout props) num))
1069 (define number->mark-letter-vector (make-vector 25 #\A))
1074 (if (= i (- (char->integer #\I) (char->integer #\A)))
1076 (vector-set! number->mark-letter-vector j
1077 (integer->char (+ i (char->integer #\A)))))
1079 (define number->mark-alphabet-vector (list->vector
1080 (map (lambda (i) (integer->char (+ i (char->integer #\A)))) (iota 26))))
1082 (define (number->markletter-string vec n)
1083 "Double letters for big marks."
1084 (let* ((lst (vector-length vec)))
1087 (string-append (number->markletter-string vec (1- (quotient n lst)))
1088 (number->markletter-string vec (remainder n lst)))
1089 (make-string 1 (vector-ref vec n)))))
1091 (define-markup-command (markletter layout props num) (integer?)
1092 "Make a markup letter for @var{num}. The letters start with A to Z
1093 (skipping I), and continues with double letters."
1094 (ly:text-interface::interpret-markup layout props
1095 (number->markletter-string number->mark-letter-vector num)))
1097 (define-markup-command (markalphabet layout props num) (integer?)
1098 "Make a markup letter for @var{num}. The letters start with A to Z
1099 and continues with double letters."
1100 (ly:text-interface::interpret-markup layout props
1101 (number->markletter-string number->mark-alphabet-vector num)))
1105 (define-markup-command (slashed-digit layout props num) (integer?)
1106 "A feta number, with slash. This is for use in the context of
1107 figured bass notation"
1109 ((mag (magstep (chain-assoc-get 'font-size props 0)))
1112 (chain-assoc-get 'thickness props 0.16)))
1114 (number-stencil (interpret-markup layout
1115 (prepend-alist-chain 'font-encoding 'fetaNumber props)
1116 (number->string num)))
1117 (num-x (interval-widen (ly:stencil-extent number-stencil X)
1119 (num-y (ly:stencil-extent number-stencil Y))
1124 ,(car num-x) ,(- (interval-center num-y) dy)
1125 ,(cdr num-x) ,(+ (interval-center num-y) dy))
1129 (ly:stencil-add number-stencil
1131 ((= num 5) (ly:stencil-translate slash-stencil
1132 ;;(cons (* mag -0.05) (* mag 0.42))
1133 (cons (* mag -0.00) (* mag -0.07))
1136 ((= num 7) (ly:stencil-translate slash-stencil
1137 ;;(cons (* mag -0.05) (* mag 0.42))
1138 (cons (* mag -0.00) (* mag -0.15))
1142 (else slash-stencil)))
1145 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1146 ;; the note command.
1147 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1150 ;; TODO: better syntax.
1152 (define-markup-command (note-by-number layout props log dot-count dir) (number? number? number?)
1153 "Construct a note symbol, with stem. By using fractional values for
1154 @var{dir}, you can obtain longer or shorter stems."
1155 (define (get-glyph-name-candidates dir log style)
1156 (map (lambda (dir-name)
1157 (format "noteheads.~a~a~a" dir-name (min log 2)
1158 (if (and (symbol? style)
1159 (not (equal? 'default style)))
1160 (symbol->string style)
1162 (list (if (= dir UP) "u" "d")
1165 (define (get-glyph-name font cands)
1168 (if (ly:stencil-empty? (ly:font-get-glyph font (car cands)))
1169 (get-glyph-name font (cdr cands))
1172 (let* ((font (ly:paper-get-font layout (cons '((font-encoding . fetaMusic)) props)))
1173 (size-factor (magstep (chain-assoc-get 'font-size props 0)))
1174 (style (chain-assoc-get 'style props '()))
1175 (stem-length (* size-factor (max 3 (- log 1))))
1176 (head-glyph-name (get-glyph-name font (get-glyph-name-candidates dir log style)))
1177 (head-glyph (ly:font-get-glyph font head-glyph-name))
1178 (attach-indices (ly:note-head::stem-attachment font head-glyph-name))
1179 (stem-thickness (* size-factor 0.13))
1180 (stemy (* dir stem-length))
1181 (attach-off (cons (interval-index
1182 (ly:stencil-extent head-glyph X)
1183 (* dir (car attach-indices)))
1184 (* dir ; fixme, this is inconsistent between X & Y.
1186 (ly:stencil-extent head-glyph Y)
1187 (cdr attach-indices)))))
1188 (stem-glyph (and (> log 0)
1189 (ly:round-filled-box
1190 (ordered-cons (car attach-off)
1191 (+ (car attach-off) (* (- dir) stem-thickness)))
1192 (cons (min stemy (cdr attach-off))
1193 (max stemy (cdr attach-off)))
1194 (/ stem-thickness 3))))
1196 (dot (ly:font-get-glyph font "dots.dot"))
1197 (dotwid (interval-length (ly:stencil-extent dot X)))
1198 (dots (and (> dot-count 0)
1199 (apply ly:stencil-add
1201 (ly:stencil-translate-axis
1202 dot (* (+ 1 (* 2 x)) dotwid) X))
1203 (iota dot-count 1)))))
1204 (flaggl (and (> log 2)
1205 (ly:stencil-translate
1206 (ly:font-get-glyph font
1207 (string-append "flags."
1208 (if (> dir 0) "u" "d")
1209 (number->string log)))
1210 (cons (+ (car attach-off) (/ stem-thickness 2)) stemy)))))
1212 (set! stem-glyph (ly:stencil-add flaggl stem-glyph)))
1213 (if (ly:stencil? stem-glyph)
1214 (set! stem-glyph (ly:stencil-add stem-glyph head-glyph))
1215 (set! stem-glyph head-glyph))
1216 (if (ly:stencil? dots)
1219 (ly:stencil-translate-axis
1221 (+ (if (and (> dir 0) (> log 2))
1224 ;; huh ? why not necessary?
1225 ;;(cdr (ly:stencil-extent head-glyph X))
1232 (let ((divisor (log 2)))
1233 (lambda (z) (inexact->exact (/ (log z) divisor)))))
1235 (define (parse-simple-duration duration-string)
1236 "Parse the `duration-string', e.g. ''4..'' or ''breve.'', and return a (log dots) list."
1237 (let ((match (regexp-exec (make-regexp "(breve|longa|maxima|[0-9]+)(\\.*)") duration-string)))
1238 (if (and match (string=? duration-string (match:substring match 0)))
1239 (let ((len (match:substring match 1))
1240 (dots (match:substring match 2)))
1241 (list (cond ((string=? len "breve") -1)
1242 ((string=? len "longa") -2)
1243 ((string=? len "maxima") -3)
1244 (else (log2 (string->number len))))
1245 (if dots (string-length dots) 0)))
1246 (ly:error (_ "not a valid duration string: ~a") duration-string))))
1248 (define-markup-command (note layout props duration dir) (string? number?)
1249 "This produces a note with a stem pointing in @var{dir} direction, with
1250 the @var{duration} for the note head type and augmentation dots. For
1251 example, @code{\\note #\"4.\" #-0.75} creates a dotted quarter note, with
1252 a shortened down stem."
1253 (let ((parsed (parse-simple-duration duration)))
1254 (note-by-number-markup layout props (car parsed) (cadr parsed) dir)))
1257 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1259 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1261 (define-markup-command (lower layout props amount arg) (number? markup?)
1263 Lower @var{arg}, by the distance @var{amount}.
1264 A negative @var{amount} indicates raising, see also @code{\\raise}.
1266 (ly:stencil-translate-axis (interpret-markup layout props arg)
1270 (define-markup-command (translate-scaled layout props offset arg) (number-pair? markup?)
1271 "Translate @var{arg} by @var{offset}, scaling the offset by the @code{font-size}."
1274 ((factor (magstep (chain-assoc-get 'font-size props 0)))
1275 (scaled (cons (* factor (car offset))
1276 (* factor (cdr offset)))))
1278 (ly:stencil-translate (interpret-markup layout props arg)
1281 (define-markup-command (raise layout props amount arg) (number? markup?)
1283 Raise @var{arg}, by the distance @var{amount}.
1284 A negative @var{amount} indicates lowering, see also @code{\\lower}.
1286 @lilypond[verbatim,fragment,relative=1]
1287 c1^\\markup { C \\small \\raise #1.0 \\bold { \"9/7+\" }}
1289 The argument to @code{\\raise} is the vertical displacement amount,
1290 measured in (global) staff spaces. @code{\\raise} and @code{\\super}
1291 raise objects in relation to their surrounding markups.
1293 If the text object itself is positioned above or below the staff, then
1294 @code{\\raise} cannot be used to move it, since the mechanism that
1295 positions it next to the staff cancels any shift made with
1296 @code{\\raise}. For vertical positioning, use the @code{padding}
1297 and/or @code{extra-offset} properties. "
1298 (ly:stencil-translate-axis (interpret-markup layout props arg) amount Y))
1300 (define-markup-command (fraction layout props arg1 arg2) (markup? markup?)
1301 "Make a fraction of two markups."
1302 (let* ((m1 (interpret-markup layout props arg1))
1303 (m2 (interpret-markup layout props arg2)))
1304 (set! m1 (ly:stencil-aligned-to m1 X CENTER))
1305 (set! m2 (ly:stencil-aligned-to m2 X CENTER))
1306 (let* ((x1 (ly:stencil-extent m1 X))
1307 (x2 (ly:stencil-extent m2 X))
1308 (line (ly:round-filled-box (interval-union x1 x2) '(-0.05 . 0.05) 0.0))
1309 ;; should stack mols separately, to maintain LINE on baseline
1310 (stack (stack-lines -1 0.2 0.6 (list m1 line m2))))
1312 (ly:stencil-aligned-to stack Y CENTER))
1314 (ly:stencil-aligned-to stack X LEFT))
1315 ;; should have EX dimension
1317 (ly:stencil-translate-axis stack 0.75 Y))))
1323 (define-markup-command (normal-size-super layout props arg) (markup?)
1324 "Set @var{arg} in superscript with a normal font size."
1325 (ly:stencil-translate-axis
1326 (interpret-markup layout props arg)
1327 (* 0.5 (chain-assoc-get 'baseline-skip props)) Y))
1329 (define-markup-command (super layout props arg) (markup?)
1331 @cindex raising text
1332 @cindex lowering text
1334 @cindex translating text
1336 @cindex @code{\\super}
1339 Raising and lowering texts can be done with @code{\\super} and
1342 @lilypond[verbatim,fragment,relative=1]
1343 c1^\\markup { E \"=\" mc \\super \"2\" }
1347 (ly:stencil-translate-axis
1350 (cons `((font-size . ,(- (chain-assoc-get 'font-size props 0) 3))) props)
1352 (* 0.5 (chain-assoc-get 'baseline-skip props))
1355 (define-markup-command (translate layout props offset arg) (number-pair? markup?)
1356 "This translates an object. Its first argument is a cons of numbers
1358 A \\translate #(cons 2 -3) @{ B C @} D
1360 This moves `B C' 2 spaces to the right, and 3 down, relative to its
1361 surroundings. This command cannot be used to move isolated scripts
1362 vertically, for the same reason that @code{\\raise} cannot be used for
1366 (ly:stencil-translate (interpret-markup layout props arg)
1369 (define-markup-command (sub layout props arg) (markup?)
1370 "Set @var{arg} in subscript."
1371 (ly:stencil-translate-axis
1374 (cons `((font-size . ,(- (chain-assoc-get 'font-size props 0) 3))) props)
1376 (* -0.5 (chain-assoc-get 'baseline-skip props))
1379 (define-markup-command (normal-size-sub layout props arg) (markup?)
1380 "Set @var{arg} in subscript, in a normal font size."
1381 (ly:stencil-translate-axis
1382 (interpret-markup layout props arg)
1383 (* -0.5 (chain-assoc-get 'baseline-skip props))
1386 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1388 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1390 (define-markup-command (hbracket layout props arg) (markup?)
1391 "Draw horizontal brackets around @var{arg}."
1392 (let ((th 0.1) ;; todo: take from GROB.
1393 (m (interpret-markup layout props arg)))
1394 (bracketify-stencil m X th (* 2.5 th) th)))
1396 (define-markup-command (bracket layout props arg) (markup?)
1397 "Draw vertical brackets around @var{arg}."
1398 (let ((th 0.1) ;; todo: take from GROB.
1399 (m (interpret-markup layout props arg)))
1400 (bracketify-stencil m Y th (* 2.5 th) th)))
1402 (define-markup-command (bracketed-y-column layout props indices args)
1403 (list? markup-list?)
1404 "Make a column of the markups in @var{args}, putting brackets around
1405 the elements marked in @var{indices}, which is a list of numbers.
1409 ;; DROPME? This command is a relic from the old figured bass implementation.
1412 (define (sublist lst start stop)
1413 (take (drop lst start) (- (1+ stop) start)))
1415 (define (stencil-list-extent ss axis)
1417 (apply min (map (lambda (x) (car (ly:stencil-extent x axis))) ss))
1418 (apply max (map (lambda (x) (cdr (ly:stencil-extent x axis))) ss))))
1421 (define (stack-stencils-vertically stencils bskip last-stencil)
1423 ((null? stencils) '())
1424 ((not (ly:stencil? last-stencil))
1425 (cons (car stencils)
1426 (stack-stencils-vertically (cdr stencils) bskip (car stencils))))
1428 (let* ((orig (car stencils))
1429 (dir (chain-assoc-get 'direction props DOWN))
1430 (new (ly:stencil-moved-to-edge last-stencil Y dir
1434 (cons new (stack-stencils-vertically (cdr stencils) bskip new))))))
1436 (define (make-brackets stencils indices acc)
1439 (pair? (cdr indices)))
1440 (let* ((encl (sublist stencils (car indices) (cadr indices)))
1441 (x-ext (stencil-list-extent encl X))
1442 (y-ext (stencil-list-extent encl Y))
1445 (protusion (* 2.5 thick))
1447 (ly:stencil-translate-axis
1448 (ly:bracket Y y-ext thick protusion)
1449 (- (car x-ext) pad) X))
1450 (rb (ly:stencil-translate-axis
1451 (ly:bracket Y y-ext thick (- protusion))
1452 (+ (cdr x-ext) pad) X)))
1455 stencils (cddr indices)
1468 (chain-assoc-get 'baseline-skip props))
1469 (stacked (stack-stencils-vertically
1470 (remove ly:stencil-empty? stencils) 1.25 #f))
1471 (brackets (make-brackets stacked indices '())))
1473 (apply ly:stencil-add
1474 (append stacked brackets))))
1477 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1478 ;; size indications arrow
1479 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;