(let*
((th (chain-assoc-get 'thickness props 0.1))
(x (car dest))
- (y (cdr dest)))
+ (y (cdr dest))
+ (s (ly:make-stencil
+ `(draw-line
+ ,th
+ 0 0
+ ,x ,y)
- (ly:make-stencil
- `(draw-line
- ,th
- 0 0
- ,x ,y)
+ (cons (min x 0) (max x 0))
+ (cons (min y 0) (max y 0)))))
- (cons (min x 0) (min y 0))
- (cons (max x 0) (max y 0)))))
+ s))
(define-builtin-markup-command (draw-circle layout props radius thickness fill)
(number? number? boolean?)
(define-builtin-markup-command (wordwrap-field layout props symbol) (symbol?)
- "Wordwrap the data which has been assigned to @var{symbol}.
+ "Wordwrap the data which has been assigned to @var{symbol}."
(let* ((m (chain-assoc-get symbol props)))
(if (string? m)
(interpret-markup layout props
(ly:make-stencil '() '(1 . -1) '(1 . -1)))))
(define-builtin-markup-command (justify-field layout props symbol) (symbol?)
- "Justify the data which has been assigned to @var{symbol}.
+ "Justify the data which has been assigned to @var{symbol}."
(let* ((m (chain-assoc-get symbol props)))
(if (string? m)
(interpret-markup layout props
Raising and lowering texts can be done with @code{\\super} and
@code{\\sub}:
-
+@c
@lilypond[verbatim,fragment,relative=1]
-c1^\\markup { E \"=\" \\concat { "mc" \\super \"2\" } }
+c1^\\markup { E \"=\" \\concat { \"mc\" \\super \"2\" } }
@end lilypond"
(ly:stencil-translate-axis
(interpret-markup
(m (interpret-markup layout props arg)))
(bracketify-stencil m Y th (* 2.5 th) th)))
\f
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; size indications arrow
+;; Delayed markup evaluation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(define-builtin-markup-command (page-ref layout props label gauge default)
+ (symbol? markup? markup?)
+ "Reference to a page number. @var{label} is the label set on the referenced
+page (using the @code{\\label} command), @var{gauge} a markup used to estimate
+the maximum width of the page number, and @var{default} the value to display
+when @var{label} is not found."
+ (let* ((gauge-stencil (interpret-markup layout props gauge))
+ (x-ext (ly:stencil-extent gauge-stencil X))
+ (y-ext (ly:stencil-extent gauge-stencil Y)))
+ (ly:make-stencil
+ `(delay-stencil-evaluation
+ ,(delay (ly:stencil-expr
+ (let* ((table (ly:output-def-lookup layout 'label-page-table))
+ (label-page (and (list? table) (assoc label table)))
+ (page-number (and label-page (cdr label-page)))
+ (page-markup (if page-number (format "~a" page-number) default))
+ (page-stencil (interpret-markup layout props page-markup))
+ (gap (- (interval-length x-ext)
+ (interval-length (ly:stencil-extent page-stencil X)))))
+ (interpret-markup layout props
+ (markup #:concat (#:hspace gap page-markup)))))))
+ x-ext
+ y-ext)))