lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

First stab at getting bar extents right. (issue 5186049)


From: mtsolo
Subject: First stab at getting bar extents right. (issue 5186049)
Date: Wed, 05 Oct 2011 16:16:33 +0000

Reviewers: ,

Message:
Hey all,

I'm trying to use my new pure-from-neighbor functions to get bar extents
right.  Currently, barlines are able to block ledger lines from trailing
over because of extra height added to the horizontal skylines in
NonMusicalPaperColumn.  However, they do not block accidentals hanging
over, and furthermore, this extra height blocks some lyrics but not
others.

The pure height of barlines should correspond to the height of
neighboring grobs in the VerticalAlignment, allowing for lyrics to pass
under the barlines and for accidentals to always be to the right of a
bar.

However, this patch fails on two important counts:

1) It allows lyrics to recede all the way back to the StaffStartBar (see
span-bar-allow-span-bar.ly).
2) It doesn't play nicely with loose columns for some reason (see
spacing-folded-clef-3.ly ... not nice).

So, I'm a bit stuck and could use some help.  Any pointers would be much
obliged!

Cheers,
MS

Description:
First stab at getting bar extents right.

Please review this at http://codereview.appspot.com/5186049/

Affected files:
  A input/regression/lyrics-pass-under-bar.ly
  M ly/engraver-init.ly
  M scm/define-grobs.scm
  M scm/output-lib.scm


Index: input/regression/lyrics-pass-under-bar.ly
diff --git a/input/regression/lyrics-pass-under-bar.ly b/input/regression/lyrics-pass-under-bar.ly
new file mode 100644
index 0000000000000000000000000000000000000000..81e1d7d44f608b4f99099901475b5ab94bda7196
--- /dev/null
+++ b/input/regression/lyrics-pass-under-bar.ly
@@ -0,0 +1,10 @@
+\version "2.15.14"
+
+\header {
+  texidoc = "Long lyrics should be allowed to pass under
+the bar line.
+"
+}
+
+\relative c''' { c2 c c c }
+\addlyrics { foo bar foooooooo bar }
Index: ly/engraver-init.ly
diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly
index 41569cd4aed702c7837e76e341b03768a8afaffb..41ece8f9d663fab53e5156d8b549776220b14df4 100644
--- a/ly/engraver-init.ly
+++ b/ly/engraver-init.ly
@@ -82,6 +82,7 @@
   \consists "Figured_bass_position_engraver"
   \consists "Script_row_engraver"
   \consists "Cue_clef_engraver"
+  \consists "Pure_from_neighbor_engraver"

   localKeySignature = #'()
   createSpacing = ##t
@@ -488,6 +489,8 @@ printing of a single line of lyrics."
   \name ChordNames
   \description "Typesets chord names."

+  \consists "Bar_engraver"
+  \consists "Pure_from_neighbor_engraver"
   \consists "Output_property_engraver"
   \consists "Separating_line_group_engraver"
   \consists "Chord_name_engraver"
@@ -498,6 +501,8 @@ printing of a single line of lyrics."
   \override VerticalAxisGroup #'staff-affinity = #DOWN
\override VerticalAxisGroup #'nonstaff-relatedstaff-spacing #'padding = #0.5
   \override VerticalAxisGroup #'nonstaff-nonstaff-spacing #'padding = #0.5
+  \override BarLine #'transparent = ##t
+  \override BarLine #'bar-extent = #ly:axis-group-interface::height
 }

 \context {
Index: scm/define-grobs.scm
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index 05ba013e27579353fb6b53b737ab272cd27b5d48..be9fa39d810acfb28894a4c92d29dd46366825cb 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -223,8 +223,12 @@
                        (next-note . (semi-fixed-space . 0.9))
                        (right-edge . (extra-space . 0.0))))
        (stencil . ,ly:bar-line::print)
+ (Y-extent . ,(ly:make-unpure-pure-container ly:grob::stencil-height bar-line::pure-height))
        (meta . ((class . Item)
+ (object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common)
+                                     (pure-relevant-grobs . 
,bar-line::calc-pure-relevant-grobs)))
                 (interfaces . (bar-line-interface
+                                pure-from-neighbor-interface
                                break-aligned-interface
                                font-interface))))))

@@ -1392,8 +1396,6 @@
        (before-line-breaking . ,ly:paper-column::before-line-breaking)
        (full-measure-extra-space . 1.0)
        (horizontal-skylines . ,ly:separation-item::calc-skylines)
-       ;; sufficient padding to prevent ledger lines from moving over/under
-       (skyline-vertical-padding . 0.6)
        ;;                    (stencil . ,ly:paper-column::print)

        (keep-inside-line . #t)
@@ -2596,7 +2598,6 @@
    print-circled-text-callback
    laissez-vibrer::print
    lyric-text::print
-   ly:bar-line::print
    ly:mensural-ligature::brew-ligature-primitive
    ly:note-head::print
    ly:dots::print
Index: scm/output-lib.scm
diff --git a/scm/output-lib.scm b/scm/output-lib.scm
index 5a15551b340998e43b5df97164680359a5044edd..152a3e4e0807a08f61845af2cf651a4a23e951fe 100644
--- a/scm/output-lib.scm
+++ b/scm/output-lib.scm
@@ -88,7 +88,7 @@

 (define-public (stem::pure-length grob beg end)
   (let* ((ss (ly:staff-symbol-staff-space grob))
-         (beg (ly:grob-pure-property grob 'stem-begin-position 0 1000)))
+ (beg (ly:grob-pure-property grob 'stem-begin-position 0 2147483646))) (abs (- (ly:stem::pure-calc-stem-end-position grob 0 2147483646) beg))))

 (define-public (note-head::calc-duration-log grob)
@@ -342,6 +342,25 @@ and duration-log @var{log}."
        (vector (string? (car result)) #t (string? (cdr result)))
        all-invisible)))

+(define-public (bar-line::pure-height grob start end)
+  (interval-union (ly:axis-group-interface::pure-height grob 0 2147483646)
+                  (ly:grob::stencil-height grob)))
+
+(define-public (bar-line::calc-pure-relevant-grobs grob)
+  (if (pair? (ly:grob-object grob 'elements))
+    (let* ((to-nix '(piano-pedal-script-interface))
+           (new-ga (filter
+                     (lambda (g)
+                       (pair? (lset-intersection
+                                to-nix
+                                (assoc-get 'interfaces
+                                           (ly:grob-property g 'meta)
+                                           '()))))
+                           (ly:grob-array->list
+                             (ly:grob-object grob 'elements)))))
+      (ly:grob-set-object! grob 'elements new-ga)))
+  (ly:axis-group-interface::calc-pure-relevant-grobs grob))
+
 (define-public (shift-right-at-line-begin g)
   "Shift an item to the right, but only at the start of the line."
   (if (and (ly:item? g)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]