[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New markup command `parenthesize'
From: |
Thomas Morgan |
Subject: |
Re: New markup command `parenthesize' |
Date: |
Mon, 10 Aug 2009 22:50:44 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
Neil Puttock <address@hidden> writes:
> Very shapely parentheses. :)
Thank you, and thanks for the comments! Here are two addenda
to the original patch that make the improvements you suggested:
commit 79259e82dea04bec0090152268ac8ec3ad12ff1f
Author: Thomas Morgan <address@hidden>
Date: Mon Jul 27 20:22:03 2009 -0400
Make `parenthesize-stencil' a public procedure.
In same procedure, use constant `RIGHT' instead of 1.
diff --git a/scm/stencil.scm b/scm/stencil.scm
index 5b83631..c35d45e 100644
--- a/scm/stencil.scm
+++ b/scm/stencil.scm
@@ -136,16 +136,16 @@ the more angular the shape of the parenthesis."
x-extent
y-extent)))
-(define (parenthesize-stencil
- stencil half-thickness width angularity padding)
+(define-public (parenthesize-stencil
+ stencil half-thickness width angularity padding)
"Add parentheses around @var{stencil}, returning a new stencil."
(let* ((y-extent (ly:stencil-extent stencil Y))
(lp (make-parenthesis-stencil
y-extent half-thickness (- width) angularity))
(rp (make-parenthesis-stencil
y-extent half-thickness width angularity)))
- (set! stencil (ly:stencil-combine-at-edge lp X 1 stencil padding))
- (set! stencil (ly:stencil-combine-at-edge stencil X 1 rp padding))
+ (set! stencil (ly:stencil-combine-at-edge lp X RIGHT stencil padding))
+ (set! stencil (ly:stencil-combine-at-edge stencil X RIGHT rp padding))
stencil))
(define-public (make-line-stencil width startx starty endx endy)
commit a4b20dfb40475332e7d9fdcdf347c1d559412102
Author: Thomas Morgan <address@hidden>
Date: Mon Jul 27 20:48:02 2009 -0400
Define property defaults in markup command `parenthesize'.
Do not make `angularity' a grob property: remove it from
`lily/script-interface.cc', `scm/define-grob-properties.scm',
and `scm/define-grobs.scm'.
diff --git a/lily/script-interface.cc b/lily/script-interface.cc
index 6bdd069..59737b5 100644
--- a/lily/script-interface.cc
+++ b/lily/script-interface.cc
@@ -112,7 +112,6 @@ ADD_INTERFACE (Text_script,
/* properties */
"add-stem-support "
- "angularity "
"avoid-slur "
"script-priority "
"slur "
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index 0c13f82..ee75ee7 100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -38,8 +38,6 @@ be created below this bar line.")
(alteration ,number? "Alteration numbers for accidental.")
(alteration-alist ,list? "List of @code{(@var{pitch}
. @var{accidental})} pairs for key signature.")
- (angularity ,number? "Angularity of grob shape.
-Typical values range from 0 (not angular) to 1 (angular).")
(annotation ,string? "Annotate a grob for debug purposes.")
(arpeggio-direction ,ly:dir? "If set, put an arrow on the
arpeggio squiggly line.")
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index f829a33..e511f24 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -1889,7 +1889,6 @@
(slur-padding . 0.5)
(script-priority . 200)
(cross-staff . ,ly:script-interface::calc-cross-staff)
- (angularity . 0)
;; todo: add X self alignment?
(meta . ((class . Item)
(interfaces . (text-script-interface
diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm
index bbc2aec..10cc7fe 100644
--- a/scm/define-markup-commands.scm
+++ b/scm/define-markup-commands.scm
@@ -3025,7 +3025,11 @@ Draw vertical brackets around @var{arg}.
(define-builtin-markup-command (parenthesize layout props arg)
(markup?)
graphic
- ()
+ ((angularity 0)
+ (padding)
+ (size 1)
+ (thickness 1)
+ (width 0.25))
"
@cindex placing parentheses around text
@@ -3043,16 +3047,17 @@ a column containing several lines of text.
}
@end lilypond"
(let* ((markup (interpret-markup layout props arg))
- (size (chain-assoc-get 'size props 1))
- (width (* size (chain-assoc-get 'width props 0.25)))
- (thickness (* (chain-assoc-get 'line-thickness props 0.1)
- (chain-assoc-get 'thickness props 1)))
- (half-thickness (min (* size 0.5 thickness)
- (* (/ 4 3.0) width)))
- (angularity (chain-assoc-get 'angularity props 0))
+ (scaled-width (* size width))
+ (scaled-thickness
+ (* (chain-assoc-get 'line-thickness props 0.1)
+ thickness))
+ (half-thickness
+ (min (* size 0.5 scaled-thickness)
+ (* (/ 4 3.0) scaled-width)))
(padding (chain-assoc-get 'padding props half-thickness)))
(parenthesize-stencil
- markup half-thickness width angularity padding)))
+ markup half-thickness scaled-width angularity padding)))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Delayed markup evaluation
- Re: New markup command `parenthesize',
Thomas Morgan <=