2 (define-public (stack-molecules axis dir padding mols)
3 "Stack molecules MOLS in direction AXIS,DIR, using PADDING."
7 (ly:molecule-combine-at-edge (car mols) axis dir
8 (stack-molecules axis dir padding (cdr mols))
15 (define-public (stack-lines dir padding baseline mols)
16 "Stack vertically with a baseline-skip."
19 (if (null? (cdr mols))
21 (ly:molecule-combine-at-edge (car mols) Y dir
22 (stack-lines dir padding baseline (cdr mols))
28 (define-public (fontify-text font-metric text)
29 "Set TEXT with font FONT-METRIC, returning a molecule."
30 (let* ((b (ly:text-dimension font-metric text)))
32 (ly:fontify-atom font-metric `(text ,text)) (car b) (cdr b))
35 (define-public (bracketify-molecule mol axis thick protusion padding)
36 "Add brackets around MOL, producing a new molecule."
39 (ext (ly:molecule-get-extent mol axis))
40 (lb (ly:bracket axis ext thick (- protusion)))
41 (rb (ly:bracket axis ext thick protusion))
43 (set! mol (ly:molecule-combine-at-edge mol (other-axis axis) 1 lb padding))
44 (set! mol (ly:molecule-combine-at-edge mol (other-axis axis) -1 rb padding))
48 (define-public (box-molecule xext yext)
52 (list 'filledbox (- (car xext)) (cdr xext)
53 (- (car yext)) (cdr yext))
57 (define-public (box-grob-molecule grob)
58 "Make a box of exactly the extents of the grob. The box precisely
59 encloses the contents.
61 (let* ((xext (ly:get-extent grob grob 0))
62 (yext (ly:get-extent grob grob 1))
63 (mol (ly:make-molecule '() '(10000 . -10000) '(10000 . -10000)))
67 (set! mol (ly:molecule-add mol (box-molecule xext (cons (- (car yext) thick) (car yext) ))))
68 (set! mol (ly:molecule-add mol (box-molecule xext (cons (cdr yext) (+ (cdr yext) thick) ))))
69 (set! mol (ly:molecule-add mol (box-molecule (cons (cdr xext) (+ (cdr xext) thick)) yext)))
70 (set! mol (ly:molecule-add mol (box-molecule (cons (- (car xext) thick) (car xext)) yext)))