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 (whiteout layout props arg) (markup?)
122 "Provide a white underground for @var{arg}"
123 (let* ((stil (interpret-markup layout props
124 (make-with-color-markup black arg)))
126 (interpret-markup layout props
127 (make-with-color-markup
129 (make-filled-box-markup
130 (ly:stencil-extent stil X)
131 (ly:stencil-extent stil Y)
134 (ly:stencil-add white stil)))
136 (define-markup-command (pad-markup layout props padding arg) (number? markup?)
137 "Add space around a markup object."
140 ((stil (interpret-markup layout props arg))
141 (xext (ly:stencil-extent stil X))
142 (yext (ly:stencil-extent stil Y)))
145 (ly:stencil-expr stil)
146 (interval-widen xext padding)
147 (interval-widen yext padding))))
149 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
151 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
153 ;;FIXME: is this working?
154 (define-markup-command (strut layout props) ()
155 "Create a box of the same height as the space in the current font."
156 (let ((m (ly:text-interface::interpret-markup layout props " ")))
157 (ly:make-stencil (ly:stencil-expr m)
159 (ly:stencil-extent m X)
163 ;; todo: fix negative space
164 (define-markup-command (hspace layout props amount) (number?)
165 "This produces a invisible object taking horizontal space.
167 \\markup @{ A \\hspace #2.0 B @}
169 will put extra space between A and B, on top of the space that is
170 normally inserted before elements on a line.
173 (ly:make-stencil "" (cons 0 amount) '(-1 . 1))
174 (ly:make-stencil "" (cons amount amount) '(-1 . 1))))
177 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
178 ;; importing graphics.
179 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
181 (define-markup-command (stencil layout props stil) (ly:stencil?)
186 (make-regexp "%%BoundingBox:[ \t]+([0-9-]+)[ \t]+([0-9-]+)[ \t]+([0-9-]+)[ \t]+([0-9-]+)"))
188 (define (get-postscript-bbox string)
189 "Extract the bbox from STRING, or return #f if not present."
191 ((match (regexp-exec bbox-regexp string)))
195 (string->number (match:substring match x)))
200 (define-markup-command (epsfile layout props axis size file-name) (number? number? string?)
201 "Inline an EPS image. The image is scaled along @var{axis} to
204 (if (ly:get-option 'safe)
205 (interpret-markup layout props "not allowed in safe")
206 (eps-file->stencil axis size file-name)
209 (define-markup-command (postscript layout props str) (string?)
210 "This inserts @var{str} directly into the output as a PostScript
211 command string. Due to technicalities of the output backends,
212 different scales should be used for the @TeX{} and PostScript backend,
213 selected with @code{-f}.
216 For the TeX backend, the following string prints a rotated text
221 0 0 moveto /ecrm10 findfont
222 1.75 scalefont setfont 90 rotate (hello) show
226 The magical constant 1.75 scales from LilyPond units (staff spaces) to
229 For the postscript backend, use the following
232 gsave /ecrm10 findfont
233 10.0 output-scale div
234 scalefont setfont 90 rotate (hello) show grestore
239 (list 'embedded-ps str)
243 (define-markup-command (score layout props score) (ly:score?)
244 "Inline an image of music."
245 (let* ((output (ly:score-embedded-format score layout)))
247 (if (ly:music-output? output)
248 (paper-system-stencil
249 (vector-ref (ly:paper-score-paper-systems output) 0))
251 (ly:warning (_"no systems found in \\score markup, does it have a \\layout block?"))
254 (define-markup-command (null layout props) ()
255 "An empty markup with extents of a single point"
259 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
261 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
263 (define-markup-command (simple layout props str) (string?)
264 "A simple text string; @code{\\markup @{ foo @}} is equivalent with
265 @code{\\markup @{ \\simple #\"foo\" @}}."
266 (interpret-markup layout props str))
269 ;; TODO: use font recoding.
271 ;; (map make-word-markup (string-tokenize str)))))
273 (define-public empty-markup
274 (make-simple-markup ""))
276 ;; helper for justifying lines.
277 (define (get-fill-space word-count line-width text-widths)
278 "Calculate the necessary paddings between each two adjacent texts.
279 The lengths of all texts are stored in @var{text-widths}.
280 The normal formula for the padding between texts a and b is:
281 padding = line-width/(word-count - 1) - (length(a) + length(b))/2
282 The first and last padding have to be calculated specially using the
283 whole length of the first or last text.
284 Return a list of paddings.
287 ((null? text-widths) '())
289 ;; special case first padding
290 ((= (length text-widths) word-count)
292 (- (- (/ line-width (1- word-count)) (car text-widths))
293 (/ (car (cdr text-widths)) 2))
294 (get-fill-space word-count line-width (cdr text-widths))))
295 ;; special case last padding
296 ((= (length text-widths) 2)
297 (list (- (/ line-width (1- word-count))
298 (+ (/ (car text-widths) 2) (car (cdr text-widths)))) 0))
301 (- (/ line-width (1- word-count))
302 (/ (+ (car text-widths) (car (cdr text-widths))) 2))
303 (get-fill-space word-count line-width (cdr text-widths))))))
305 (define-markup-command (fill-line layout props markups)
307 "Put @var{markups} in a horizontal line of width @var{line-width}.
308 The markups are spaced/flushed to fill the entire line.
309 If there are no arguments, return an empty stencil."
311 (let* ((orig-stencils
312 (map (lambda (x) (interpret-markup layout props x))
316 (if (ly:stencil-empty? stc)
318 stc)) orig-stencils))
321 (if (ly:stencil-empty? stc)
323 (interval-length (ly:stencil-extent stc X))))
325 (text-width (apply + text-widths))
326 (text-dir (chain-assoc-get 'text-direction props RIGHT))
327 (word-count (length stencils))
328 (word-space (chain-assoc-get 'word-space props))
329 (line-width (chain-assoc-get 'line-width props))
334 (/ (- line-width text-width) 2)
335 (/ (- line-width text-width) 2)))
338 (- line-width text-width)))
340 (get-fill-space word-count line-width text-widths))))
348 (line-stencils (if (= word-count 1)
355 (if (= text-dir LEFT)
356 (set! line-stencils (reverse line-stencils)))
358 (if (null? (remove ly:stencil-empty? orig-stencils))
360 (stack-stencils-padding-list X
361 RIGHT fill-space-normal line-stencils))))
363 (define-markup-command (line layout props args) (markup-list?)
364 "Put @var{args} in a horizontal line. The property @code{word-space}
365 determines the space between each markup in @var{args}."
367 ((stencils (map (lambda (m) (interpret-markup layout props m)) args))
368 (space (chain-assoc-get 'word-space props))
369 (text-dir (chain-assoc-get 'text-direction props RIGHT))
372 (if (= text-dir LEFT)
373 (set! stencils (reverse stencils)))
378 (remove ly:stencil-empty? stencils))))
381 (define (wordwrap-stencils stencils
382 justify base-space line-width text-dir)
384 "Perform simple wordwrap, return stencil of each line."
386 (define space (if justify
388 ;; justify only stretches lines.
392 (define (take-list width space stencils
393 accumulator accumulated-width)
394 "Return (head-list . tail) pair, with head-list fitting into width"
396 (cons accumulator stencils)
398 ((first (car stencils))
399 (first-wid (cdr (ly:stencil-extent (car stencils) X)))
400 (newwid (+ space first-wid accumulated-width))
404 (or (null? accumulator)
407 (take-list width space
409 (cons first accumulator)
411 (cons accumulator stencils))
419 ((line-break (take-list line-width space todo
421 (line-stencils (car line-break))
422 (space-left (- line-width (apply + (map (lambda (x) (cdr (ly:stencil-extent x X)))
425 (line-word-space (cond
426 ((not justify) space)
428 ;; don't stretch last line of paragraph.
429 ;; hmmm . bug - will overstretch the last line in some case.
430 ((null? (cdr line-break))
432 ((null? line-stencils) 0.0)
433 ((null? (cdr line-stencils)) 0.0)
434 (else (/ space-left (1- (length line-stencils))))))
436 (line (stack-stencil-line
438 (if (= text-dir RIGHT)
439 (reverse line-stencils)
442 (if (pair? (cdr line-break))
443 (loop (cons line lines)
447 (if (= text-dir LEFT)
449 (ly:stencil-translate-axis line
450 (- line-width (interval-end (ly:stencil-extent line X)))
452 (reverse (cons line lines))
459 (define (wordwrap-markups layout props args justify)
461 ((baseline-skip (chain-assoc-get 'baseline-skip props))
462 (line-width (chain-assoc-get 'line-width props))
463 (word-space (chain-assoc-get 'word-space props))
464 (text-dir (chain-assoc-get 'text-direction props RIGHT))
465 (lines (wordwrap-stencils
466 (remove ly:stencil-empty?
467 (map (lambda (m) (interpret-markup layout props m)) args))
468 justify word-space line-width
472 (stack-lines DOWN 0.0 baseline-skip lines)))
474 (define-markup-command (justify layout props args) (markup-list?)
475 "Like wordwrap, but with lines stretched to justify the margins.
476 Use @code{\\override #'(line-width . X)} to set line-width, where X
477 is the number of staff spaces."
479 (wordwrap-markups layout props args #t))
481 (define-markup-command (wordwrap layout props args) (markup-list?)
482 "Simple wordwrap. Use @code{\\override #'(line-width . X)} to set
483 line-width, where X is the number of staff spaces."
485 (wordwrap-markups layout props args #f))
487 (define (wordwrap-string layout props justify arg)
489 ((baseline-skip (chain-assoc-get 'baseline-skip props))
490 (line-width (chain-assoc-get 'line-width props))
491 (word-space (chain-assoc-get 'word-space props))
493 (para-strings (regexp-split
494 (string-regexp-substitute "\r" "\n"
495 (string-regexp-substitute "\r\n" "\n" arg))
496 "\n[ \t\n]*\n[ \t\n]*"))
498 (text-dir (chain-assoc-get 'text-direction props RIGHT))
499 (list-para-words (map (lambda (str)
500 (regexp-split str "[ \t\n]+"))
502 (para-lines (map (lambda (words)
506 ly:stencil-empty? (map
508 (interpret-markup layout props x))
510 (lines (wordwrap-stencils stencils
519 (stack-lines DOWN 0.0 baseline-skip (apply append para-lines))))
522 (define-markup-command (wordwrap-string layout props arg) (string?)
523 "Wordwrap a string. Paragraphs may be separated with double newlines"
524 (wordwrap-string layout props #f arg))
526 (define-markup-command (justify-string layout props arg) (string?)
527 "Justify a string. Paragraphs may be separated with double newlines"
528 (wordwrap-string layout props #t arg))
531 (define-markup-command (wordwrap-field layout props symbol) (symbol?)
532 (let* ((m (chain-assoc-get symbol props)))
534 (interpret-markup layout props
535 (list wordwrap-string-markup m))
536 (ly:make-stencil '() '(1 . -1) '(1 . -1)))))
538 (define-markup-command (justify-field layout props symbol) (symbol?)
539 - (let* ((m (chain-assoc-get symbol props)))
541 (interpret-markup layout props
542 (list justify-string-markup m))
543 (ly:make-stencil '() '(1 . -1) '(1 . -1)))))
547 (define-markup-command (combine layout props m1 m2) (markup? markup?)
548 "Print two markups on top of each other."
549 (let* ((s1 (interpret-markup layout props m1))
550 (s2 (interpret-markup layout props m2)))
551 (ly:stencil-add s1 s2)))
554 ;; TODO: should extract baseline-skip from each argument somehow..
556 (define-markup-command (column layout props args) (markup-list?)
557 "Stack the markups in @var{args} vertically. The property
558 @code{baseline-skip} determines the space between each markup in @var{args}."
561 ((arg-stencils (map (lambda (m) (interpret-markup layout props m)) args))
562 (skip (chain-assoc-get 'baseline-skip props)))
567 (remove ly:stencil-empty? arg-stencils))))
570 (define-markup-command (dir-column layout props args) (markup-list?)
571 "Make a column of args, going up or down, depending on the setting
572 of the @code{#'direction} layout property."
573 (let* ((dir (chain-assoc-get 'direction props)))
575 (if (number? dir) dir -1)
577 (chain-assoc-get 'baseline-skip props)
578 (map (lambda (x) (interpret-markup layout props x)) args))))
580 (define-markup-command (center-align layout props args) (markup-list?)
581 "Put @code{args} in a centered column. "
582 (let* ((mols (map (lambda (x) (interpret-markup layout props x)) args))
583 (cmols (map (lambda (x) (ly:stencil-aligned-to x X CENTER)) mols)))
585 (stack-lines -1 0.0 (chain-assoc-get 'baseline-skip props) cmols)))
587 (define-markup-command (vcenter layout props arg) (markup?)
588 "Align @code{arg} to its Y center. "
589 (let* ((mol (interpret-markup layout props arg)))
590 (ly:stencil-aligned-to mol Y CENTER)))
592 (define-markup-command (hcenter layout props arg) (markup?)
593 "Align @code{arg} to its X center. "
594 (let* ((mol (interpret-markup layout props arg)))
595 (ly:stencil-aligned-to mol X CENTER)))
597 (define-markup-command (right-align layout props arg) (markup?)
598 "Align @var{arg} on its right edge. "
599 (let* ((m (interpret-markup layout props arg)))
600 (ly:stencil-aligned-to m X RIGHT)))
602 (define-markup-command (left-align layout props arg) (markup?)
603 "Align @var{arg} on its left edge. "
604 (let* ((m (interpret-markup layout props arg)))
605 (ly:stencil-aligned-to m X LEFT)))
607 (define-markup-command (general-align layout props axis dir arg) (integer? number? markup?)
608 "Align @var{arg} in @var{axis} direction to the @var{dir} side."
609 (let* ((m (interpret-markup layout props arg)))
610 (ly:stencil-aligned-to m axis dir)))
612 (define-markup-command (halign layout props dir arg) (number? markup?)
613 "Set horizontal alignment. If @var{dir} is @code{-1}, then it is
614 left-aligned, while @code{+1} is right. Values in between interpolate
615 alignment accordingly."
616 (let* ((m (interpret-markup layout props arg)))
617 (ly:stencil-aligned-to m X dir)))
621 (define-markup-command (with-dimensions layout props x y arg) (number-pair? number-pair? markup?)
622 "Set the dimensions of @var{arg} to @var{x} and @var{y}."
624 (let* ((m (interpret-markup layout props arg)))
625 (ly:make-stencil (ly:stencil-expr m) x y)))
628 (define-markup-command (pad-around layout props amount arg) (number? markup?)
630 "Add padding @var{amount} all around @var{arg}. "
633 ((m (interpret-markup layout props arg))
634 (x (ly:stencil-extent m X))
635 (y (ly:stencil-extent m Y)))
638 (ly:make-stencil (ly:stencil-expr m)
639 (interval-widen x amount)
640 (interval-widen y amount))
644 (define-markup-command (pad-x layout props amount arg) (number? markup?)
646 "Add padding @var{amount} around @var{arg} in the X-direction. "
648 ((m (interpret-markup layout props arg))
649 (x (ly:stencil-extent m X))
650 (y (ly:stencil-extent m Y)))
653 (ly:make-stencil (ly:stencil-expr m)
654 (interval-widen x amount)
659 (define-markup-command (put-adjacent layout props arg1 axis dir arg2) (markup? integer? ly:dir? markup?)
661 "Put @var{arg2} next to @var{arg1}, without moving @var{arg1}. "
663 (let* ((m1 (interpret-markup layout props arg1))
664 (m2 (interpret-markup layout props arg2)))
666 (ly:stencil-combine-at-edge m1 axis dir m2 0.0 0.0)
669 (define-markup-command (transparent layout props arg) (markup?)
670 "Make the argument transparent"
672 ((m (interpret-markup layout props arg))
673 (x (ly:stencil-extent m X))
674 (y (ly:stencil-extent m Y)))
682 (define-markup-command (pad-to-box layout props x-ext y-ext arg)
683 (number-pair? number-pair? markup?)
684 "Make @var{arg} take at least @var{x-ext}, @var{y-ext} space"
687 ((m (interpret-markup layout props arg))
688 (x (ly:stencil-extent m X))
689 (y (ly:stencil-extent m Y)))
691 (ly:make-stencil (ly:stencil-expr m)
692 (interval-union x-ext x)
693 (interval-union y-ext y))))
696 (define-markup-command (hcenter-in layout props length arg)
698 "Center @var{arg} horizontally within a box of extending
699 @var{length}/2 to the left and right."
701 (interpret-markup layout props
702 (make-pad-to-box-markup
703 (cons (/ length -2) (/ length 2))
705 (make-hcenter-markup arg))))
708 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
710 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
712 (define-markup-command (fromproperty layout props symbol) (symbol?)
713 "Read the @var{symbol} from property settings, and produce a stencil
714 from the markup contained within. If @var{symbol} is not defined, it
715 returns an empty markup"
716 (let* ((m (chain-assoc-get symbol props)))
718 (interpret-markup layout props m)
719 (ly:make-stencil '() '(1 . -1) '(1 . -1)))))
722 (define-markup-command (on-the-fly layout props procedure arg) (symbol? markup?)
723 "Apply the @var{procedure} markup command to
724 @var{arg}. @var{procedure} should take a single argument."
725 (let* ((anonymous-with-signature (lambda (layout props arg) (procedure layout props arg))))
726 (set-object-property! anonymous-with-signature
729 (interpret-markup layout props (list anonymous-with-signature arg))))
733 (define-markup-command (override layout props new-prop arg) (pair? markup?)
734 "Add the first argument in to the property list. Properties may be
735 any sort of property supported by @internalsref{font-interface} and
736 @internalsref{text-interface}, for example
739 \\override #'(font-family . married) \"bla\"
743 (interpret-markup layout (cons (list new-prop) props) arg))
745 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
747 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
749 (define-markup-command (verbatim-file layout props name) (string?)
750 "Read the contents of a file, and include verbatimly"
754 (if (ly:get-option 'safe)
755 "verbatim-file disabled in safe mode"
757 ((str (ly:gulp-file name))
758 (lines (string-split str #\nl)))
760 (make-typewriter-markup
761 (make-column-markup lines)))
764 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
766 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
769 (define-markup-command (bigger layout props arg) (markup?)
770 "Increase the font size relative to current setting"
771 (interpret-markup layout props
772 `(,fontsize-markup 1 ,arg)))
774 (define-markup-command (smaller layout props arg) (markup?)
775 "Decrease the font size relative to current setting"
776 (interpret-markup layout props
777 `(,fontsize-markup -1 ,arg)))
779 (define-markup-command larger (markup?) bigger-markup)
781 (define-markup-command (finger layout props arg) (markup?)
782 "Set the argument as small numbers."
783 (interpret-markup layout
784 (cons '((font-size . -5) (font-encoding . fetaNumber)) props)
788 (define-markup-command (fontsize layout props increment arg) (number? markup?)
789 "Add @var{increment} to the font-size. Adjust baseline skip accordingly."
791 (let* ((fs (chain-assoc-get 'font-size props 0))
792 (bs (chain-assoc-get 'baseline-skip props 2))
794 (cons 'baseline-skip (* bs (magstep increment)))
795 (cons 'font-size (+ fs increment )))))
797 (interpret-markup layout (cons entries props) arg)))
801 ;; FIXME -> should convert to font-size.
802 (define-markup-command (magnify layout props sz arg) (number? markup?)
803 "Set the font magnification for the its argument. In the following
804 example, the middle A will be 10% larger:
806 A \\magnify #1.1 @{ A @} A
809 Note: magnification only works if a font-name is explicitly selected.
810 Use @code{\\fontsize} otherwise."
813 (prepend-alist-chain 'font-magnification sz props)
816 (define-markup-command (bold layout props arg) (markup?)
817 "Switch to bold font-series"
818 (interpret-markup layout (prepend-alist-chain 'font-series 'bold props) arg))
820 (define-markup-command (sans layout props arg) (markup?)
821 "Switch to the sans serif family"
822 (interpret-markup layout (prepend-alist-chain 'font-family 'sans props) arg))
824 (define-markup-command (number layout props arg) (markup?)
825 "Set font family to @code{number}, which yields the font used for
826 time signatures and fingerings. This font only contains numbers and
827 some punctuation. It doesn't have any letters. "
828 (interpret-markup layout (prepend-alist-chain 'font-encoding 'fetaNumber props) arg))
830 (define-markup-command (roman layout props arg) (markup?)
831 "Set font family to @code{roman}."
832 (interpret-markup layout (prepend-alist-chain 'font-family 'roman props) arg))
834 (define-markup-command (huge layout props arg) (markup?)
835 "Set font size to +2."
836 (interpret-markup layout (prepend-alist-chain 'font-size 2 props) arg))
838 (define-markup-command (large layout props arg) (markup?)
839 "Set font size to +1."
840 (interpret-markup layout (prepend-alist-chain 'font-size 1 props) arg))
842 (define-markup-command (normalsize layout props arg) (markup?)
843 "Set font size to default."
844 (interpret-markup layout (prepend-alist-chain 'font-size 0 props) arg))
846 (define-markup-command (small layout props arg) (markup?)
847 "Set font size to -1."
848 (interpret-markup layout (prepend-alist-chain 'font-size -1 props) arg))
850 (define-markup-command (tiny layout props arg) (markup?)
851 "Set font size to -2."
852 (interpret-markup layout (prepend-alist-chain 'font-size -2 props) arg))
854 (define-markup-command (teeny layout props arg) (markup?)
855 "Set font size to -3."
856 (interpret-markup layout (prepend-alist-chain 'font-size -3 props) arg))
858 (define-markup-command (caps layout props arg) (markup?)
859 "Set @code{font-shape} to @code{caps}."
860 (interpret-markup layout (prepend-alist-chain 'font-shape 'caps props) arg))
863 (define-markup-command (smallCaps layout props text) (markup?)
864 "Turn @code{text}, which should be a string, to small caps.
866 \\markup \\smallCaps \"Text between double quotes\"
869 (define (make-small-caps-markup chars)
872 ((char-whitespace? (car chars))
873 (markup #:fontsize -2 #:simple (string-upcase (list->string (cdr chars)))))
876 #:fontsize -2 #:simple (string-upcase (list->string chars))))))
877 (define (make-not-small-caps-markup chars)
880 ((char-whitespace? (car chars))
881 (markup #:simple (list->string (cdr chars))))
884 #:simple (list->string chars)))))
885 (define (small-caps-aux done-markups current-chars rest-chars small? after-space?)
886 (cond ((null? rest-chars)
887 ;; the end of the string: build the markup
888 (make-line-markup (reverse! (cons ((if small?
889 make-small-caps-markup
890 make-not-small-caps-markup)
891 (reverse! current-chars))
893 ((char-whitespace? (car rest-chars))
895 (small-caps-aux done-markups current-chars (cdr rest-chars) small? #t))
896 ((or (and small? (char-lower-case? (car rest-chars)))
897 (and (not small?) (not (char-lower-case? (car rest-chars)))))
899 ;; add the char to the current char list
900 (small-caps-aux done-markups
901 (cons (car rest-chars)
903 (cons #\space current-chars)
910 ;; make a markup with current chars, and start a new list with new char
911 (small-caps-aux (cons ((if small?
912 make-small-caps-markup
913 make-not-small-caps-markup)
914 (reverse! current-chars))
917 (list (car rest-chars) #\space)
918 (list (car rest-chars)))
922 (interpret-markup layout props (small-caps-aux (list)
924 (cons #\space (string->list text))
928 (define-markup-command (dynamic layout props arg) (markup?)
929 "Use the dynamic font. This font only contains @b{s}, @b{f}, @b{m},
930 @b{z}, @b{p}, and @b{r}. When producing phrases, like ``pi@`{u} @b{f}'', the
931 normal words (like ``pi@`{u}'') should be done in a different font. The
932 recommend font for this is bold and italic"
934 layout (prepend-alist-chain 'font-encoding 'fetaDynamic props) arg))
936 (define-markup-command (text layout props arg) (markup?)
937 "Use a text font instead of music symbol or music alphabet font."
940 (interpret-markup layout (prepend-alist-chain 'font-encoding 'latin1 props)
944 (define-markup-command (italic layout props arg) (markup?)
945 "Use italic @code{font-shape} for @var{arg}. "
946 (interpret-markup layout (prepend-alist-chain 'font-shape 'italic props) arg))
948 (define-markup-command (typewriter layout props arg) (markup?)
949 "Use @code{font-family} typewriter for @var{arg}."
951 layout (prepend-alist-chain 'font-family 'typewriter props) arg))
953 (define-markup-command (upright layout props arg) (markup?)
954 "Set font shape to @code{upright}. This is the opposite of @code{italic}."
956 layout (prepend-alist-chain 'font-shape 'upright props) arg))
958 (define-markup-command (medium layout props arg) (markup?)
959 "Switch to medium font-series (in contrast to bold)."
960 (interpret-markup layout (prepend-alist-chain 'font-series 'medium props)
963 (define-markup-command (normal-text layout props arg) (markup?)
964 "Set all font related properties (except the size) to get the default normal text font, no matter what font was used earlier."
966 (interpret-markup layout
967 (cons '((font-family . roman) (font-shape . upright)
968 (font-series . medium) (font-encoding . latin1))
972 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
974 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
976 (define-markup-command (doublesharp layout props) ()
977 "Draw a double sharp symbol."
979 (interpret-markup layout props (markup #:musicglyph "accidentals.4")))
981 (define-markup-command (sesquisharp layout props) ()
982 "Draw a 3/2 sharp symbol."
983 (interpret-markup layout props (markup #:musicglyph "accidentals.3")))
985 (define-markup-command (sharp layout props) ()
986 "Draw a sharp symbol."
987 (interpret-markup layout props (markup #:musicglyph "accidentals.2")))
989 (define-markup-command (semisharp layout props) ()
990 "Draw a semi sharp symbol."
991 (interpret-markup layout props (markup #:musicglyph "accidentals.1")))
993 (define-markup-command (natural layout props) ()
994 "Draw a natural symbol."
995 (interpret-markup layout props (markup #:musicglyph "accidentals.0")))
997 (define-markup-command (semiflat layout props) ()
999 (interpret-markup layout props (markup #:musicglyph "accidentals.M1")))
1001 (define-markup-command (flat layout props) ()
1002 "Draw a flat symbol."
1003 (interpret-markup layout props (markup #:musicglyph "accidentals.M2")))
1005 (define-markup-command (sesquiflat layout props) ()
1006 "Draw a 3/2 flat symbol."
1007 (interpret-markup layout props (markup #:musicglyph "accidentals.M3")))
1009 (define-markup-command (doubleflat layout props) ()
1010 "Draw a double flat symbol."
1011 (interpret-markup layout props (markup #:musicglyph "accidentals.M4")))
1013 (define-markup-command (with-color layout props color arg) (color? markup?)
1014 "Draw @var{arg} in color specified by @var{color}"
1016 (let* ((stil (interpret-markup layout props arg)))
1018 (ly:make-stencil (list 'color color (ly:stencil-expr stil))
1019 (ly:stencil-extent stil X)
1020 (ly:stencil-extent stil Y))))
1023 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1025 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1028 (define-markup-command (arrow-head layout props axis direction filled)
1029 (integer? ly:dir? boolean?)
1030 "produce an arrow head in specified direction and axis. Use the filled head if @var{filled} is specified."
1032 ((name (format "arrowheads.~a.~a~a"
1039 (ly:paper-get-font layout (cons '((font-encoding . fetaMusic))
1043 (define-markup-command (musicglyph layout props glyph-name) (string?)
1044 "This is converted to a musical symbol, e.g. @code{\\musicglyph
1045 #\"accidentals.0\"} will select the natural sign from the music font.
1046 See @usermanref{The Feta font} for a complete listing of the possible glyphs."
1048 (ly:paper-get-font layout (cons '((font-encoding . fetaMusic))
1052 (define-markup-command (lookup layout props glyph-name) (string?)
1053 "Lookup a glyph by name."
1054 (ly:font-get-glyph (ly:paper-get-font layout props)
1057 (define-markup-command (char layout props num) (integer?)
1058 "Produce a single character, e.g. @code{\\char #65} produces the
1060 (ly:get-glyph (ly:paper-get-font layout props) num))
1063 (define number->mark-letter-vector (make-vector 25 #\A))
1068 (if (= i (- (char->integer #\I) (char->integer #\A)))
1070 (vector-set! number->mark-letter-vector j
1071 (integer->char (+ i (char->integer #\A)))))
1073 (define number->mark-alphabet-vector (list->vector
1074 (map (lambda (i) (integer->char (+ i (char->integer #\A)))) (iota 26))))
1076 (define (number->markletter-string vec n)
1077 "Double letters for big marks."
1078 (let* ((lst (vector-length vec)))
1081 (string-append (number->markletter-string vec (1- (quotient n lst)))
1082 (number->markletter-string vec (remainder n lst)))
1083 (make-string 1 (vector-ref vec n)))))
1085 (define-markup-command (markletter layout props num) (integer?)
1086 "Make a markup letter for @var{num}. The letters start with A to Z
1087 (skipping I), and continues with double letters."
1088 (ly:text-interface::interpret-markup layout props
1089 (number->markletter-string number->mark-letter-vector num)))
1091 (define-markup-command (markalphabet layout props num) (integer?)
1092 "Make a markup letter for @var{num}. The letters start with A to Z
1093 and continues with double letters."
1094 (ly:text-interface::interpret-markup layout props
1095 (number->markletter-string number->mark-alphabet-vector num)))
1099 (define-markup-command (slashed-digit layout props num) (integer?)
1100 "A feta number, with slash. This is for use in the context of
1101 figured bass notation"
1103 ((mag (magstep (chain-assoc-get 'font-size props 0)))
1106 (chain-assoc-get 'thickness props 0.16)))
1108 (number-stencil (interpret-markup layout
1109 (prepend-alist-chain 'font-encoding 'fetaNumber props)
1110 (number->string num)))
1111 (num-x (interval-widen (ly:stencil-extent number-stencil X)
1113 (num-y (ly:stencil-extent number-stencil Y))
1118 ,(car num-x) ,(- (interval-center num-y) dy)
1119 ,(cdr num-x) ,(+ (interval-center num-y) dy))
1123 (ly:stencil-add number-stencil
1125 ((= num 5) (ly:stencil-translate slash-stencil
1126 ;;(cons (* mag -0.05) (* mag 0.42))
1127 (cons (* mag -0.00) (* mag -0.07))
1130 ((= num 7) (ly:stencil-translate slash-stencil
1131 ;;(cons (* mag -0.05) (* mag 0.42))
1132 (cons (* mag -0.00) (* mag -0.15))
1136 (else slash-stencil)))
1139 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1140 ;; the note command.
1141 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1144 ;; TODO: better syntax.
1146 (define-markup-command (note-by-number layout props log dot-count dir) (number? number? number?)
1147 "Construct a note symbol, with stem. By using fractional values for
1148 @var{dir}, you can obtain longer or shorter stems."
1149 (define (get-glyph-name-candidates dir log style)
1150 (map (lambda (dir-name)
1151 (format "noteheads.~a~a~a" dir-name (min log 2)
1152 (if (and (symbol? style)
1153 (not (equal? 'default style)))
1154 (symbol->string style)
1156 (list (if (= dir UP) "u" "d")
1159 (define (get-glyph-name font cands)
1162 (if (ly:stencil-empty? (ly:font-get-glyph font (car cands)))
1163 (get-glyph-name font (cdr cands))
1166 (let* ((font (ly:paper-get-font layout (cons '((font-encoding . fetaMusic)) props)))
1167 (size-factor (magstep (chain-assoc-get 'font-size props 0)))
1168 (style (chain-assoc-get 'style props '()))
1169 (stem-length (* size-factor (max 3 (- log 1))))
1170 (head-glyph-name (get-glyph-name font (get-glyph-name-candidates dir log style)))
1171 (head-glyph (ly:font-get-glyph font head-glyph-name))
1172 (attach-indices (offset-scale
1173 (ly:note-head::stem-attachment font head-glyph-name) dir))
1175 (stem-thickness (* size-factor 0.13))
1176 (stemy (* dir stem-length))
1177 (attach-off (cons (interval-index
1178 (ly:stencil-extent head-glyph X)
1179 (car attach-indices))
1181 (ly:stencil-extent head-glyph Y)
1182 (cdr attach-indices))))
1184 (stem-glyph (and (> log 0)
1185 (ly:round-filled-box
1186 (ordered-cons (car attach-off) (+ (car attach-off) (* (- dir) stem-thickness)))
1187 (cons (min stemy (cdr attach-off))
1188 (max stemy (cdr attach-off)))
1189 (/ stem-thickness 3))))
1191 (dot (ly:font-get-glyph font "dots.dot"))
1192 (dotwid (interval-length (ly:stencil-extent dot X)))
1193 (dots (and (> dot-count 0)
1194 (apply ly:stencil-add
1196 (ly:stencil-translate-axis
1197 dot (* (+ 1 (* 2 x)) dotwid) X))
1198 (iota dot-count 1)))))
1199 (flaggl (and (> log 2)
1200 (ly:stencil-translate
1201 (ly:font-get-glyph font
1202 (string-append "flags."
1203 (if (> dir 0) "u" "d")
1204 (number->string log)))
1205 (cons (+ attachx (/ stem-thickness 2)) stemy)))))
1207 (set! stem-glyph (ly:stencil-add flaggl stem-glyph)))
1208 (if (ly:stencil? stem-glyph)
1209 (set! stem-glyph (ly:stencil-add stem-glyph head-glyph))
1210 (set! stem-glyph head-glyph))
1211 (if (ly:stencil? dots)
1214 (ly:stencil-translate-axis
1216 (+ (if (and (> dir 0) (> log 2))
1219 ;; huh ? why not necessary?
1220 ;;(cdr (ly:stencil-extent head-glyph X))
1227 (let ((divisor (log 2)))
1228 (lambda (z) (inexact->exact (/ (log z) divisor)))))
1230 (define (parse-simple-duration duration-string)
1231 "Parse the `duration-string', e.g. ''4..'' or ''breve.'', and return a (log dots) list."
1232 (let ((match (regexp-exec (make-regexp "(breve|longa|maxima|[0-9]+)(\\.*)") duration-string)))
1233 (if (and match (string=? duration-string (match:substring match 0)))
1234 (let ((len (match:substring match 1))
1235 (dots (match:substring match 2)))
1236 (list (cond ((string=? len "breve") -1)
1237 ((string=? len "longa") -2)
1238 ((string=? len "maxima") -3)
1239 (else (log2 (string->number len))))
1240 (if dots (string-length dots) 0)))
1241 (ly:error (_ "not a valid duration string: ~a") duration-string))))
1243 (define-markup-command (note layout props duration dir) (string? number?)
1244 "This produces a note with a stem pointing in @var{dir} direction, with
1245 the @var{duration} for the note head type and augmentation dots. For
1246 example, @code{\\note #\"4.\" #-0.75} creates a dotted quarter note, with
1247 a shortened down stem."
1248 (let ((parsed (parse-simple-duration duration)))
1249 (note-by-number-markup layout props (car parsed) (cadr parsed) dir)))
1252 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1254 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1256 (define-markup-command (lower layout props amount arg) (number? markup?)
1258 Lower @var{arg}, by the distance @var{amount}.
1259 A negative @var{amount} indicates raising, see also @code{\\raise}.
1261 (ly:stencil-translate-axis (interpret-markup layout props arg)
1265 (define-markup-command (raise layout props amount arg) (number? markup?)
1267 Raise @var{arg}, by the distance @var{amount}.
1268 A negative @var{amount} indicates lowering, see also @code{\\lower}.
1270 @lilypond[verbatim,fragment,relative=1]
1271 c1^\\markup { C \\small \\raise #1.0 \\bold { \"9/7+\" }}
1273 The argument to @code{\\raise} is the vertical displacement amount,
1274 measured in (global) staff spaces. @code{\\raise} and @code{\\super}
1275 raise objects in relation to their surrounding markups.
1277 If the text object itself is positioned above or below the staff, then
1278 @code{\\raise} cannot be used to move it, since the mechanism that
1279 positions it next to the staff cancels any shift made with
1280 @code{\\raise}. For vertical positioning, use the @code{padding}
1281 and/or @code{extra-offset} properties. "
1282 (ly:stencil-translate-axis (interpret-markup layout props arg) amount Y))
1284 (define-markup-command (fraction layout props arg1 arg2) (markup? markup?)
1285 "Make a fraction of two markups."
1286 (let* ((m1 (interpret-markup layout props arg1))
1287 (m2 (interpret-markup layout props arg2)))
1288 (set! m1 (ly:stencil-aligned-to m1 X CENTER))
1289 (set! m2 (ly:stencil-aligned-to m2 X CENTER))
1290 (let* ((x1 (ly:stencil-extent m1 X))
1291 (x2 (ly:stencil-extent m2 X))
1292 (line (ly:round-filled-box (interval-union x1 x2) '(-0.05 . 0.05) 0.0))
1293 ;; should stack mols separately, to maintain LINE on baseline
1294 (stack (stack-lines -1 0.2 0.6 (list m1 line m2))))
1296 (ly:stencil-aligned-to stack Y CENTER))
1298 (ly:stencil-aligned-to stack X LEFT))
1299 ;; should have EX dimension
1301 (ly:stencil-translate-axis stack 0.75 Y))))
1307 (define-markup-command (normal-size-super layout props arg) (markup?)
1308 "Set @var{arg} in superscript with a normal font size."
1309 (ly:stencil-translate-axis
1310 (interpret-markup layout props arg)
1311 (* 0.5 (chain-assoc-get 'baseline-skip props)) Y))
1313 (define-markup-command (super layout props arg) (markup?)
1315 @cindex raising text
1316 @cindex lowering text
1318 @cindex translating text
1320 @cindex @code{\\super}
1323 Raising and lowering texts can be done with @code{\\super} and
1326 @lilypond[verbatim,fragment,relative=1]
1327 c1^\\markup { E \"=\" mc \\super \"2\" }
1331 (ly:stencil-translate-axis
1334 (cons `((font-size . ,(- (chain-assoc-get 'font-size props 0) 3))) props)
1336 (* 0.5 (chain-assoc-get 'baseline-skip props))
1339 (define-markup-command (translate layout props offset arg) (number-pair? markup?)
1340 "This translates an object. Its first argument is a cons of numbers
1342 A \\translate #(cons 2 -3) @{ B C @} D
1344 This moves `B C' 2 spaces to the right, and 3 down, relative to its
1345 surroundings. This command cannot be used to move isolated scripts
1346 vertically, for the same reason that @code{\\raise} cannot be used for
1350 (ly:stencil-translate (interpret-markup layout props arg)
1353 (define-markup-command (sub layout props arg) (markup?)
1354 "Set @var{arg} in subscript."
1355 (ly:stencil-translate-axis
1358 (cons `((font-size . ,(- (chain-assoc-get 'font-size props 0) 3))) props)
1360 (* -0.5 (chain-assoc-get 'baseline-skip props))
1363 (define-markup-command (normal-size-sub layout props arg) (markup?)
1364 "Set @var{arg} in subscript, in a normal font size."
1365 (ly:stencil-translate-axis
1366 (interpret-markup layout props arg)
1367 (* -0.5 (chain-assoc-get 'baseline-skip props))
1370 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1372 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1374 (define-markup-command (hbracket layout props arg) (markup?)
1375 "Draw horizontal brackets around @var{arg}."
1376 (let ((th 0.1) ;; todo: take from GROB.
1377 (m (interpret-markup layout props arg)))
1378 (bracketify-stencil m X th (* 2.5 th) th)))
1380 (define-markup-command (bracket layout props arg) (markup?)
1381 "Draw vertical brackets around @var{arg}."
1382 (let ((th 0.1) ;; todo: take from GROB.
1383 (m (interpret-markup layout props arg)))
1384 (bracketify-stencil m Y th (* 2.5 th) th)))
1386 (define-markup-command (bracketed-y-column layout props indices args)
1387 (list? markup-list?)
1388 "Make a column of the markups in @var{args}, putting brackets around
1389 the elements marked in @var{indices}, which is a list of numbers.
1393 ;; DROPME? This command is a relic from the old figured bass implementation.
1396 (define (sublist lst start stop)
1397 (take (drop lst start) (- (1+ stop) start)))
1399 (define (stencil-list-extent ss axis)
1401 (apply min (map (lambda (x) (car (ly:stencil-extent x axis))) ss))
1402 (apply max (map (lambda (x) (cdr (ly:stencil-extent x axis))) ss))))
1405 (define (stack-stencils-vertically stencils bskip last-stencil)
1407 ((null? stencils) '())
1408 ((not (ly:stencil? last-stencil))
1409 (cons (car stencils)
1410 (stack-stencils-vertically (cdr stencils) bskip (car stencils))))
1412 (let* ((orig (car stencils))
1413 (dir (chain-assoc-get 'direction props DOWN))
1414 (new (ly:stencil-moved-to-edge last-stencil Y dir
1418 (cons new (stack-stencils-vertically (cdr stencils) bskip new))))))
1420 (define (make-brackets stencils indices acc)
1423 (pair? (cdr indices)))
1424 (let* ((encl (sublist stencils (car indices) (cadr indices)))
1425 (x-ext (stencil-list-extent encl X))
1426 (y-ext (stencil-list-extent encl Y))
1429 (protusion (* 2.5 thick))
1431 (ly:stencil-translate-axis
1432 (ly:bracket Y y-ext thick protusion)
1433 (- (car x-ext) pad) X))
1434 (rb (ly:stencil-translate-axis
1435 (ly:bracket Y y-ext thick (- protusion))
1436 (+ (cdr x-ext) pad) X)))
1439 stencils (cddr indices)
1452 (chain-assoc-get 'baseline-skip props))
1453 (stacked (stack-stencils-vertically
1454 (remove ly:stencil-empty? stencils) 1.25 #f))
1455 (brackets (make-brackets stacked indices '())))
1457 (apply ly:stencil-add
1458 (append stacked brackets))))
1461 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1462 ;; size indications arrow
1463 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;