\once\override HorizontalBracketText.text = "a'"
e''\startGroup d''\stopGroup
c''
- -\tweak text \markup \bold \huge "b" \startGroup
- -\tweak text "a" \startGroup
+ -\tweak HorizontalBracketText.text \markup \bold \huge "b" \startGroup
+ -\tweak HorizontalBracketText.text "a" \startGroup
d''\stopGroup
- e''-\tweak text "a'" \startGroup
+ e''-\tweak HorizontalBracketText.text "a'" \startGroup
d''\stopGroup\stopGroup
- c''-\tweak text foo \startGroup d'' e'' f''
+ c''-\tweak HorizontalBracketText.text foo \startGroup d'' e'' f''
\break
g'' a'' b'' c'''\stopGroup
}
--- /dev/null
+\version "2.18.0"
+
+\header {
+ lsrtags = "rhythms, scheme-language, text"
+
+ texidoc = "
+This example shows how to add a markup command to get a three sided box
+around some text (or other markup).
+
+"
+ doctitle = "Three-sided box"
+}
+% New command to add a three sided box, with sides north, west and south
+% Based on the box-stencil command defined in scm/stencil.scm
+% Note that ";;" is used to comment a line in Scheme
+#(define-public (NWS-box-stencil stencil thickness padding)
+ "Add a box around STENCIL, producing a new stencil."
+ (let* ((x-ext (interval-widen (ly:stencil-extent stencil X) padding))
+ (y-ext (interval-widen (ly:stencil-extent stencil Y) padding))
+ (y-rule (make-filled-box-stencil (cons 0 thickness) y-ext))
+ (x-rule (make-filled-box-stencil
+ (interval-widen x-ext thickness) (cons 0 thickness))))
+ ;; (set! stencil (ly:stencil-combine-at-edge stencil X 1 y-rule padding))
+ (set! stencil (ly:stencil-combine-at-edge stencil X LEFT y-rule padding))
+ (set! stencil (ly:stencil-combine-at-edge stencil Y UP x-rule 0.0))
+ (set! stencil (ly:stencil-combine-at-edge stencil Y DOWN x-rule 0.0))
+ stencil))
+
+% The corresponding markup command, based on the \box command defined
+% in scm/define-markup-commands.scm
+#(define-markup-command (NWS-box layout props arg) (markup?)
+ #:properties ((thickness 0.1) (font-size 0) (box-padding 0.2))
+ "Draw a box round @var{arg}. Looks at @code{thickness},
+@code{box-padding} and @code{font-size} properties to determine line
+thickness and padding around the markup."
+ (let ((pad (* (magstep font-size) box-padding))
+ (m (interpret-markup layout props arg)))
+ (NWS-box-stencil m thickness pad)))
+
+% Test it:
+
+\relative c' {
+ c1^\markup { \NWS-box ABCD }
+ c1^\markup { \NWS-box \note #"4" #1.0 }
+}
-%% DO NOT EDIT this file manually; it is automatically
-%% generated from LSR http://lsr.di.unimi.it
-%% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
-%% and then run scripts/auxiliar/makelsr.py
-%%
-%% This file is in the public domain.
+% DO NOT EDIT this file manually; it is automatically
+% generated from Documentation/snippets/new
+% Make any changes in Documentation/snippets/new/
+% and then run scripts/auxiliar/makelsr.py
+%
+% This file is in the public domain.
+%% Note: this file works from version 2.18.0
\version "2.18.0"
\header {
% The corresponding markup command, based on the \box command defined
% in scm/define-markup-commands.scm
#(define-markup-command (NWS-box layout props arg) (markup?)
+ #:properties ((thickness 0.1) (font-size 0) (box-padding 0.2))
"Draw a box round @var{arg}. Looks at @code{thickness},
@code{box-padding} and @code{font-size} properties to determine line
thickness and padding around the markup."
- (let* ((th (chain-assoc-get 'thickness props 0.1))
- (size (chain-assoc-get 'font-size props 0))
- (pad (* (magstep size)
- (chain-assoc-get 'box-padding props 0.2)))
- (m (interpret-markup layout props arg)))
- (NWS-box-stencil m th pad)))
+ (let ((pad (* (magstep font-size) box-padding))
+ (m (interpret-markup layout props arg)))
+ (NWS-box-stencil m thickness pad)))
% Test it:
@divClass{testimonial-item}
@imageFloat{orm-finnendahl,jpg, left}
-@subsubheading @uref{http://icem-www.folkwang-hochschule.de/~finnendahl/, Orm Finnendahl}, professor of Composition, Musikhochschule Freiburg
+@subsubheading @uref{http://icem-www.folkwang-hochschule.de/~finnendahl/, Orm Finnendahl}, professor of Composition, Hochschule für Musik und Darstellende Kunst Frankfurt am Main
@qq{Although I don't know [LilyPond] very well yet, I'm
@strong{*very} impressed. I used the program to input a motet of
\fromproperty #'toc:text \fromproperty #'toc:page
#(define-markup-list-command (table-of-contents layout props) ()
+ #:properties ((baseline-skip))
( _i "Outputs the table of contents, using the paper variable
@code{tocTitleMarkup} for its title, then the list of lines
built using the @code{tocItem} music function
Usage: @code{\\markuplist \\table-of-contents}" )
(cons (interpret-markup layout props
(ly:output-def-lookup layout 'tocTitleMarkup))
- (space-lines (chain-assoc-get 'baseline-skip props)
+ (space-lines baseline-skip
(map (lambda (toc-item)
(let ((label (car toc-item))
(toc-markup (cadr toc-item))
(define-markup-command (abs-fontsize layout props size arg)
(number? markup?)
+ #:properties ((word-space 0.6) (baseline-skip 3))
#:category font
"Use @var{size} as the absolute font size (in points) to display @var{arg}.
Adjusts @code{baseline-skip} and @code{word-space} accordingly.
@end lilypond"
(let* ((ref-size (ly:output-def-lookup layout 'text-font-size 12))
(text-props (list (ly:output-def-lookup layout 'text-font-defaults)))
- (ref-word-space (chain-assoc-get 'word-space text-props 0.6))
- (ref-baseline (chain-assoc-get 'baseline-skip text-props 3))
(magnification (/ size ref-size)))
(interpret-markup
layout
(cons
- `((baseline-skip . ,(* magnification ref-baseline))
- (word-space . ,(* magnification ref-word-space))
+ `((baseline-skip . ,(* magnification baseline-skip))
+ (word-space . ,(* magnification word-space))
(font-size . ,(magnification->font-size magnification)))
props)
arg)))
(padding)
(size 1)
(thickness 1)
+ (line-thickness 0.1)
(width 0.25))
"
@cindex placing parentheses around text
(let* ((m (interpret-markup layout props arg))
(scaled-width (* size width))
(scaled-thickness
- (* (chain-assoc-get 'line-thickness props 0.1)
- thickness))
+ (* line-thickness thickness))
(half-thickness
(min (* size 0.5 scaled-thickness)
(* (/ 4 3.0) scaled-width)))
- (padding (chain-assoc-get 'padding props half-thickness)))
+ (padding (or padding half-thickness)))
(parenthesize-stencil
m half-thickness scaled-width angularity padding)))
(details (begin (harp-pedal-check pedal-list) harp-pedal-details))
(dy (* size (assoc-get 'box-offset details 0.8))) ; offset of the box center from the line
(line-width (* (ly:output-def-lookup layout 'line-thickness)
- (chain-assoc-get 'thickness props 0.5)))
+ thickness))
(box-width (* size (assoc-get 'box-width details 0.4)))
(box-hheight (* size (/ (assoc-get 'box-height details 1.0) 2))) ; half the box-height, saves some divisions by 2
(spacebeforedivider (* size (assoc-get 'space-before-divider details 0.8))) ; full space between boxes before the first divider