]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/flag-styles.scm
Better pure height approximations for stems.
[lilypond.git] / scm / flag-styles.scm
index bce6cab5db494f2811a0782fa3943170874376e6..018ebf50748c76d052aff8ad87e7db91007311ed 100644 (file)
@@ -188,7 +188,14 @@ a flag always touches a staff line."
 
   (let* ((stem-grob (ly:grob-parent grob X))
          (adjust #t)
-         (stem-end (inexact->exact (round (ly:grob-property stem-grob 'stem-end-position))))
+         (d (ly:grob-property stem-grob 'direction))
+         (ss (ly:staff-symbol-staff-space stem-grob))
+         (stem-end (inexact->exact (round (* (index-cell
+                                               (ly:grob-extent stem-grob
+                                                               stem-grob
+                                                               Y)
+                                               d)
+                                             (/ 2 ss)))))
          ; For some reason the stem-end is a real instead of an integer...
          (dir-modifier (if (ly:position-on-line? stem-grob stem-end) "1" "0"))
          (modifier (if adjust dir-modifier "2")))