1 %% DO NOT EDIT this file manually; it is automatically
2 %% generated from LSR http://lsr.dsi.unimi.it
3 %% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
4 %% and then run scripts/auxiliar/makelsr.py
6 %% This file is in the public domain.
10 lsrtags = "rhythms, text, scheme-language"
12 %% Translation of GIT committish: d5307870fe0ad47904daba73792c7e17b813737f
14 Voici comment construire une commande de @emph{markup} chargée
15 d'agrémenter du texte ou autre annotation, d'une bordure sur trois
19 doctitlefr = "Encadrement sur trois côtés"
22 This example shows how to add a markup command to get a three sided box
23 around some text (or other markup).
26 doctitle = "Three-sided box"
30 % New command to add a three sided box, with sides north, west and south
31 % Based on the box-stencil command defined in scm/stencil.scm
32 % Note that ";;" is used to comment a line in Scheme
33 #(define-public (NWS-box-stencil stencil thickness padding)
34 "Add a box around STENCIL, producing a new stencil."
35 (let* ((x-ext (interval-widen (ly:stencil-extent stencil X) padding))
36 (y-ext (interval-widen (ly:stencil-extent stencil Y) padding))
37 (y-rule (make-filled-box-stencil (cons 0 thickness) y-ext))
38 (x-rule (make-filled-box-stencil
39 (interval-widen x-ext thickness) (cons 0 thickness))))
40 ;; (set! stencil (ly:stencil-combine-at-edge stencil X 1 y-rule padding))
41 (set! stencil (ly:stencil-combine-at-edge stencil X LEFT y-rule padding))
42 (set! stencil (ly:stencil-combine-at-edge stencil Y UP x-rule 0.0))
43 (set! stencil (ly:stencil-combine-at-edge stencil Y DOWN x-rule 0.0))
46 % The corresponding markup command, based on the \box command defined
47 % in scm/define-markup-commands.scm
48 #(define-markup-command (NWS-box layout props arg) (markup?)
49 "Draw a box round @var{arg}. Looks at @code{thickness},
50 @code{box-padding} and @code{font-size} properties to determine line
51 thickness and padding around the markup."
52 (let* ((th (chain-assoc-get 'thickness props 0.1))
53 (size (chain-assoc-get 'font-size props 0))
54 (pad (* (magstep size)
55 (chain-assoc-get 'box-padding props 0.2)))
56 (m (interpret-markup layout props arg)))
57 (NWS-box-stencil m th pad)))
62 c1^\markup { \NWS-box ABCD }
63 c1^\markup { \NWS-box \note #"4" #1.0 }