]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add tweaking the ellipse around harp pedals
authorReinhold Kainhofer <reinhold@kainhofer.com>
Sat, 23 Aug 2008 18:37:59 +0000 (20:37 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Sat, 23 Aug 2008 19:37:40 +0000 (21:37 +0200)
input/regression/harp-pedals-tweaking.ly
scm/define-grob-properties.scm
scm/harp-pedals.scm
scm/stencil.scm

index ed081b3aa59802c156946f6253fa9b8986ada16a..9c06e104a44932212d95adc3f03dd5a18a55a8d2 100644 (file)
@@ -17,4 +17,9 @@ harp-pedal-details properties of TextScript."
                   (space-before-divider . 0.1)
                   (space-after-divider . 1.2))) {
            \harp-pedal #"o^ovo-|vovo-o^"}
+  \revert Voice.TextScript #'harp-pedal-details #'box-width
+  \override Voice.TextScript #'harp-pedal-details #'circle-thickness = #3
+  \override Voice.TextScript #'harp-pedal-details #'circle-x-padding = #0.6
+  \override Voice.TextScript #'harp-pedal-details #'circle-y-padding = #-0.3
+  c1^\markup \harp-pedal #"o^ovo-|vovo-o^"
 }
index 49916fa24ee62543ad408489d2db41e59cfd67ed..cd122c5dbab2224f5a1411485601eb301387946a 100644 (file)
@@ -327,18 +327,27 @@ The properties which can be included in harp-pedal-details
 include the following:
 @itemize @bullet
 @item
-@code{box-offset} -- Vertical shift of the center of flat / sharp pedal 
+@code{box-offset} -- Vertical shift of the center of flat / sharp pedal
 boxes above / below the horizontal line. Default value 0.8.
 @item
 @code{box-width} -- Width of each pedal box. Default value 0.4.
 @item
 @code{box-height} -- Height of each pedal box. Default value 1.0.
 @item
-@code{space-before-divider} -- Space between boxes before the first divider 
+@code{space-before-divider} -- Space between boxes before the first divider
 (so that the diagram can be made symmetric). Default value 0.8.
 @item
-@code{space-after-divider} -- Space between boxes after the first divider. 
+@code{space-after-divider} -- Space between boxes after the first divider.
 Default value 0.8.
+@item
+@code{circle-thickness} -- Thickness (in unit of the line-thickness) of the
+ellipse around circled pedals. Default value 0.5.
+@item
+@code{circle-x-padding} -- Padding in X direction of the ellipse around
+circled pedals. Default value 0.15.
+@item
+@code{circle-y-padding} -- Padding in Y direction of the ellipse around
+circled pedals. Default value 0.2.
 @end itemize")
 
      (head-direction ,ly:dir? "Are the note heads left or right in a
index 9fd4c84c9af909d4f3a82d0b77939df71932ebc6..fef1760db592d6675cb54ab5eab2274de5c8db81 100644 (file)
@@ -129,12 +129,17 @@ divider) and @code{space-after-divider} (box spacing after the divider).
         (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
         (spaceafterdivider (* size (assoc-get 'space-after-divider details 0.8))) ; full space between boxes
-        ;(spacebeforedivider (/ (+ box-width (* 8 spaceafterdivider)) 8))
+        (circle-thickness (* (ly:output-def-lookup layout 'line-thickness)
+                       (assoc-get 'circle-thickness details 0.5)))
+        (circle-x-padding (* size (assoc-get 'circle-x-padding details 0.15)))
+        (circle-y-padding (* size (assoc-get 'circle-y-padding details 0.2)))
         (box-x-dimensions (lambda (prev-x p space) (cons (+ prev-x space)
                                                    (+ prev-x space box-width))))
         (box-y-dimensions (lambda (prev-x p space) (cons (- (* p dy) box-hheight)
                                                          (+ (* p dy) box-hheight))))
-        (divider-stencil (lambda (xpos) (make-line-stencil line-width xpos (- 0 dy box-hheight) xpos (+ dy box-hheight))))
+        (divider-stencil (lambda (xpos) (make-line-stencil line-width
+                                                     xpos (- 0 dy box-hheight)
+                                                     xpos (+ dy box-hheight))))
         (result (let process-pedal  ((remaining pedal-list)
                                      (prev-x 0)
                                      (stencils '())
@@ -152,7 +157,8 @@ divider) and @code{space-after-divider} (box spacing after the divider).
                                    (box-y-dimensions prev-x p space)))
                         (pedal-stencil 
                           (if circled 
-                              (ellipse-stencil stencil 0.05 0.1 ) 
+                              (ellipse-stencil stencil circle-thickness 
+                                            circle-x-padding circle-y-padding)
                               stencil))
                         (new-prev-x (+ prev-x space box-width)))
                     (process-pedal (cdr remaining) new-prev-x 
index 8ae5ffab066c549774445ff69b1505b9264ce9ae..e698fa8896e50abe74abb2ceb4cf9cdc076c0d28 100644 (file)
@@ -155,12 +155,13 @@ encloses the contents.
                            (interval-center x-ext)
                            (interval-center y-ext))))))
 
-(define-public (ellipse-stencil stencil thickness padding)
-  "Add an ellipse around STENCIL, producing a new stencil."
+(define-public (ellipse-stencil stencil thickness x-padding y-padding)
+  "Add an ellipse around STENCIL, padded by the padding pair, 
+   producing a new stencil."
   (let* ((x-ext (ly:stencil-extent stencil X))
         (y-ext (ly:stencil-extent stencil Y))
-         (x-length (+ (interval-length x-ext) padding thickness))
-         (y-length (+ (interval-length y-ext) padding thickness))
+         (x-length (+ (interval-length x-ext) x-padding thickness))
+         (y-length (+ (interval-length y-ext) y-padding thickness))
          ;(aspect-ratio (/ x-length y-length))
          (x-radius (* 0.707 x-length) )
          (y-radius (* 0.707 y-length) )