;; syntax, description and example.
-(def-markup-command (word paper props str) (string?)
- "A single word."
- (interpret-markup paper props str))
-
+(def-markup-command (stencil paper props stil) (ly:stencil?)
+ "Stencil as markup"
+ stil)
+
+
+(def-markup-command (score paper props score) (ly:score?)
+ (let*
+ ((systems (ly:score-embedded-format score paper)))
+
+ (if (= 0 (vector-length systems))
+ (begin
+ (ly:warn "No systems found in \\score markup. Did you forget \\paper?")
+ empty-markup)
+ (begin
+ (let*
+ ((stencil (ly:paper-system-stencil (vector-ref systems 0))))
+
+ (ly:stencil-align-to! stencil Y CENTER)
+ stencil)))))
+
(def-markup-command (simple paper props str) (string?)
- "A simple text-string; @code{\\markup @{ foo @}} is equivalent with
+ "A simple text string; @code{\\markup @{ foo @}} is equivalent with
@code{\\markup @{ \\simple #\"foo\" @}}."
- (interpret-markup paper props
- (make-line-markup
- (map make-word-markup (string-tokenize str)))))
+ (interpret-markup paper props str))
+
+(def-markup-command (encoded-simple paper props sym str) (symbol? string?)
+ "A text string, encoded with encoding @var{sym}. "
+ (Text_item::interpret_string paper
+ props sym str))
+
+
+;; TODO: use font recoding.
+;; (make-line-markup
+;; (map make-word-markup (string-tokenize str)))))
(define-public empty-markup
(make-simple-markup ""))
+
+(def-markup-command (postscript paper props str) (string?)
+
+ "This inserts @var{str} directly into the output as a PostScript
+command string. Due to technicalities of the output backends,
+different scales should be used for the @TeX{} and PostScript backend,
+selected with @code{-f}.
+
+
+For the TeX backend, the following string prints a rotated text
+
+@cindex rotated text
+
+@verbatim
+0 0 moveto /ecrm10 findfont
+1.75 scalefont setfont 90 rotate (hello) show
+@end verbatim
+
+@noindent
+The magical constant 1.75 scales from LilyPond units (staff spaces) to
+TeX dimensions.
+
+For the postscript backend, use the following
+
+@verbatim
+gsave /ecrm10 findfont
+ 10.0 output-scale div
+ scalefont setfont 90 rotate (hello) show grestore
+@end verbatim
+"
+ ;; FIXME
+
+ (ly:make-stencil
+ (list 'embedded-ps str)
+ '(0 . 0) '(0 . 0) ))
+
;;(def-markup-command (fill-line paper props line-width markups)
;; (number? markup-list?)
;; no parser tag -- should make number? markuk-list? thingy
(ly:stencil-extent x X))
stencils))))
(word-count (length markups))
- (word-space (cdr (chain-assoc 'word-space props)))
- (line-width (cdr (chain-assoc 'linewidth props)))
+ (word-space (chain-assoc-get 'word-space props))
+ (line-width (chain-assoc-get 'linewidth props))
(fill-space (if (< line-width text-width)
word-space
(/ (- line-width text-width)
(if (= word-count 1) 2 (- word-count 1)))))
(line-stencils (if (= word-count 1)
(map (lambda (x) (interpret-markup paper props x))
- (list (make-word-markup "")
- (car markups)
- (make-word-markup "")))
+ (list (make-simple-markup "")
+ (make-stencil-markup (car stencils))
+ (make-simple-markup "")))
stencils)))
(stack-stencil-line fill-space line-stencils)))
"Put @var{args} in a horizontal line. The property @code{word-space}
determines the space between each markup in @var{args}."
(stack-stencil-line
- (cdr (chain-assoc 'word-space props))
+ (chain-assoc-get 'word-space props)
(map (lambda (m) (interpret-markup paper props m)) args)))
(def-markup-command (combine paper props m1 m2) (markup? markup?)
"Print two markups on top of each other."
- (ly:stencil-add
- (interpret-markup paper props m1)
- (interpret-markup paper props m2)))
+ (let*
+ ((s1 (interpret-markup paper props m1))
+ (s2 (interpret-markup paper props m2)))
+
+ (ly:stencil-add s1 s2)))
(def-markup-command (finger paper props arg) (markup?)
"Set the argument as small numbers."
arg))
(def-markup-command (fontsize paper props mag arg) (number? markup?)
- "This sets the relative font size, eg.
+ "This sets the relative font size, e.g.
@example
A \\fontsize #2 @{ B C @} D
@end example
"Set font family to @code{number}, which yields the font used for
time signatures and fingerings. This font only contains numbers and
some punctuation. It doesn't have any letters. "
- (interpret-markup paper (prepend-alist-chain 'font-family 'number props) arg))
+ (interpret-markup paper (prepend-alist-chain 'font-encoding 'fetaNumber props) arg))
(def-markup-command (roman paper props arg) (markup?)
"Set font family to @code{roman}."
(def-markup-command (dynamic paper props arg) (markup?)
"Use the dynamic font. This font only contains @b{s}, @b{f}, @b{m},
-@b{z}, @b{p}, and @b{r}. When producing phrases, like ``piu @b{f}'', the
-normal words (like ``piu'') should be done in a different font. The
+@b{z}, @b{p}, and @b{r}. When producing phrases, like ``pi@`{u} @b{f}'', the
+normal words (like ``pi@`{u}'') should be done in a different font. The
recommend font for this is bold and italic"
(interpret-markup
- paper (prepend-alist-chain 'font-family 'dynamic props) arg))
+ paper (prepend-alist-chain 'font-encoding 'fetaDynamic props) arg))
(def-markup-command (italic paper props arg) (markup?)
"Use italic @code{font-shape} for @var{arg}. "
(def-markup-command (column paper props args) (markup-list?)
"Stack the markups in @var{args} vertically."
(stack-lines
- -1 0.0 (cdr (chain-assoc 'baseline-skip props))
+ -1 0.0 (chain-assoc-get 'baseline-skip props)
(map (lambda (m) (interpret-markup paper props m)) args)))
(def-markup-command (dir-column paper props args) (markup-list?)
"Make a column of args, going up or down, depending on the setting
of the @code{#'direction} layout property."
- (let* ((dir (cdr (chain-assoc 'direction props))))
+ (let* ((dir (chain-assoc-get 'direction props)))
(stack-lines
(if (number? dir) dir -1)
0.0
- (cdr (chain-assoc 'baseline-skip props))
+ (chain-assoc-get 'baseline-skip props)
(map (lambda (x) (interpret-markup paper props x)) args))))
(def-markup-command (center-align paper props args) (markup-list?)
"Put @code{args} in a centered column. "
(let* ((mols (map (lambda (x) (interpret-markup paper props x)) args))
(cmols (map (lambda (x) (ly:stencil-align-to! x X CENTER)) mols)))
- (stack-lines -1 0.0 (cdr (chain-assoc 'baseline-skip props)) mols)))
+ (stack-lines -1 0.0 (chain-assoc-get 'baseline-skip props) mols)))
+
+(def-markup-command (vcenter paper props arg) (markup?)
+ "Align @code{arg} to its center. "
+ (let* ((mol (interpret-markup paper props arg)))
+ (ly:stencil-align-to! mol Y CENTER)
+ mol))
(def-markup-command (right-align paper props arg) (markup?)
(let* ((m (interpret-markup paper props arg)))
(ly:stencil-align-to! m X LEFT)
m))
+(def-markup-command (general-align paper props axis dir arg) (integer? number? markup?)
+ "Align @var{arg} in @var{axis} direction to the @var{dir} side."
+ (let* ((m (interpret-markup paper props arg)))
+
+ (ly:stencil-align-to! m axis dir)
+ m
+ ))
+
(def-markup-command (halign paper props dir arg) (number? markup?)
"Set horizontal alignment. If @var{dir} is -1, then it is
left-aligned, while+1 is right. Values in between interpolate alignment
See @usermanref{The Feta font} for a complete listing of the possible glyphs.
"
(ly:find-glyph-by-name
- (ly:paper-get-font paper (cons '((font-name . ())
- (font-shape . *)
- (font-series . *)
- (font-family . music))
+ (ly:paper-get-font paper (cons '((font-encoding . fetaMusic))
props))
glyph-name))
"Construct a note symbol, with stem. By using fractional values for
@var{dir}, you can obtain longer or shorter stems."
- (let* ((font (ly:paper-get-font paper (cons '((font-family . music)) props)))
+ (let* ((font (ly:paper-get-font paper (cons '((font-encoding . fetaMusic)) props)))
(stemlen (max 3 (- log 1)))
(headgl (ly:find-glyph-by-name
font
(lambda (z) (inexact->exact (/ (log z) divisor)))))
(define (parse-simple-duration duration-string)
- "Parse the `duration-string', eg ''4..'' or ''breve.'', and return a (log dots) list."
+ "Parse the `duration-string', e.g. ''4..'' or ''breve.'', and return a (log dots) list."
(let ((match (regexp-exec (make-regexp "(breve|longa|maxima|[0-9]+)(\\.*)") duration-string)))
(if (and match (string=? duration-string (match:substring match 0)))
(let ((len (match:substring match 1))
(ly:stencil-translate-axis (interpret-markup
paper
props arg)
- (* 0.5 (cdr (chain-assoc 'baseline-skip props)))
+ (* 0.5 (chain-assoc-get 'baseline-skip props))
Y))
(def-markup-command (super paper props arg) (markup?)
paper
(cons `((font-size . ,(- (chain-assoc-get 'font-size props 0) 3))) props)
arg)
- (* 0.5 (cdr (chain-assoc 'baseline-skip props)))
+ (* 0.5 (chain-assoc-get 'baseline-skip props))
Y))
(def-markup-command (translate paper props offset arg) (number-pair? markup?)
paper
(cons `((font-size . ,(- (chain-assoc-get 'font-size props 0) 3))) props)
arg)
- (* -0.5 (cdr (chain-assoc 'baseline-skip props)))
+ (* -0.5 (chain-assoc-get 'baseline-skip props))
Y))
(def-markup-command (normal-size-sub paper props arg) (markup?)
(ly:stencil-translate-axis
(interpret-markup paper props arg)
- (* -0.5 (cdr (chain-assoc 'baseline-skip props)))
+ (* -0.5 (chain-assoc-get 'baseline-skip props))
Y))
(def-markup-command (hbracket paper props arg) (markup?)
(def-markup-command (smaller paper props arg) (markup?)
"Decrease the font size relative to current setting"
(let* ((fs (chain-assoc-get 'font-size props 0))
- (entry (cons 'font-size (- fs 1))))
+ (entry (cons 'font-size (- fs 1))))
(interpret-markup paper (cons (list entry) props) arg)))
(skipping I), and continues with double letters."
(Text_item::interpret_markup paper props (number->markletter-string num)))
+
+
+
+
+(def-markup-command (bracketed-y-column paper props indices args)
+ (list? markup-list?)
+ "Make a column of the markups in @var{args}, putting brackets around
+the elements marked in @var{indices}, which is a list of numbers."
+
+ (define (sublist l start stop)
+ (take (drop l start) (- (1+ stop) start)) )
+
+ (define (stencil-list-extent ss axis)
+ (cons
+ (apply min (map (lambda (x) (car (ly:stencil-extent x axis))) ss))
+ (apply max (map (lambda (x) (cdr (ly:stencil-extent x axis))) ss))))
+
+ (define (stack-stencils stencils bskip last-stencil)
+ (cond
+ ((null? stencils) '())
+ ((not last-stencil)
+ (cons (car stencils)
+ (stack-stencils (cdr stencils) bskip (car stencils))))
+ (else
+ (let*
+ ((orig (car stencils))
+ (dir (chain-assoc-get 'direction props DOWN))
+ (new (ly:stencil-moved-to-edge last-stencil Y dir
+ orig
+ 0.1 bskip))
+ )
+
+ (cons new (stack-stencils (cdr stencils) bskip new))))
+ ))
+
+ (define (make-brackets stencils indices acc)
+ (if (and stencils
+ (pair? indices)
+ (pair? (cdr indices)))
+ (let*
+ ((encl (sublist stencils (car indices) (cadr indices)))
+ (x-ext (stencil-list-extent encl X))
+ (y-ext (stencil-list-extent encl Y))
+ (thick 0.10)
+ (pad 0.35)
+ (protusion (* 2.5 thick))
+ (lb
+ (ly:stencil-translate-axis
+ (ly:bracket Y y-ext thick protusion)
+ (- (car x-ext) pad) X))
+ (rb (ly:stencil-translate-axis
+ (ly:bracket Y y-ext thick (- protusion))
+ (+ (cdr x-ext) pad) X))
+ )
+
+ (make-brackets
+ stencils (cddr indices)
+ (append
+ (list lb rb)
+ acc)))
+ acc))
+
+ (let*
+ ((stencils
+ (map (lambda (x)
+ (interpret-markup
+ paper
+ props
+ x)) args))
+ (leading
+ (chain-assoc-get 'baseline-skip props))
+ (stacked (stack-stencils stencils 1.25 #f))
+ (brackets (make-brackets stacked indices '()))
+ )
+
+ (apply ly:stencil-add
+ (append stacked brackets)
+ )))
+
+
+
+
+
+
+
+