Skip to content

Commit b2a77df

Browse files
authored
Merge pull request #157 from openlilylib/acb
pedal decorations now takes account of short segments
2 parents 439be7e + a6b66fb commit b2a77df

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

notation-snippets/pedal-decorations/definitions.ily

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ pedalWithArrowsAndTextCallback =
8080
(#:sans
8181
(#:upright
8282
(#:whiteout (#:box (#:pad-markup 0.3 lhs-text)))))))))
83+
(text-stil-x-extent (ly:stencil-extent text-stil X))
84+
(text-stil-x-length (interval-length text-stil-x-extent))
8385

8486
;; get a list of spanners bounded by PianoPedalBrackets
8587
;; left-bound, which is PaperColumn or NonMusicalPaperColumn
@@ -102,13 +104,17 @@ pedalWithArrowsAndTextCallback =
102104
(bounded-piano-brackets-per-column
103105
(delete-duplicates piano-pedal-brackets))
104106

107+
;; add text
105108
;; only add text-stil, if current Column does not have two
106109
;; PianoPedalBrackets
107-
;; TODO is this condition really sufficient?
110+
;; TODO is this condition re columns really sufficient?
111+
;; also, do not add text-stil if the segment is too short.
108112
(new-stil
109-
(if (= (length bounded-piano-brackets-per-column) 2)
113+
(if (or
114+
(= (length bounded-piano-brackets-per-column) 2)
115+
(< stil-x-length text-stil-x-length))
110116
new-stil
111-
(ly:stencil-stack new-stil X LEFT text-stil -6))))
117+
(ly:stencil-stack new-stil X LEFT text-stil -8))))
112118

113119
(ly:grob-set-property! grobber 'stencil new-stil))))
114120

0 commit comments

Comments
 (0)