From: Reinhold Kainhofer Date: Sat, 23 Aug 2008 18:37:59 +0000 (+0200) Subject: Add tweaking the ellipse around harp pedals X-Git-Tag: release/2.11.57-1~20^2~3 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2c960b34456dd700a1120acbe2fdbcfd2828118a;p=lilypond.git Add tweaking the ellipse around harp pedals --- diff --git a/input/regression/harp-pedals-tweaking.ly b/input/regression/harp-pedals-tweaking.ly index ed081b3aa5..9c06e104a4 100644 --- a/input/regression/harp-pedals-tweaking.ly +++ b/input/regression/harp-pedals-tweaking.ly @@ -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^" } diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 49916fa24e..cd122c5dba 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -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 diff --git a/scm/harp-pedals.scm b/scm/harp-pedals.scm index 9fd4c84c9a..fef1760db5 100644 --- a/scm/harp-pedals.scm +++ b/scm/harp-pedals.scm @@ -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 diff --git a/scm/stencil.scm b/scm/stencil.scm index 8ae5ffab06..e698fa8896 100644 --- a/scm/stencil.scm +++ b/scm/stencil.scm @@ -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) )