]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3187: Ugly alignment of text and score within a markup
authorDavid Kastrup <dak@gnu.org>
Sun, 3 Mar 2013 00:04:31 +0000 (01:04 +0100)
committerDavid Kastrup <dak@gnu.org>
Fri, 8 Mar 2013 17:28:37 +0000 (18:28 +0100)
For \score within \markup, the reference point (usually the middle
staff line) of the lowest staff in the top system is placed on the
baseline.

This is an incompatible change, but the previous behavior (placing the
_highest_ y coordinate of the score on the baseline, disregarding the
staves) was not useful.

scm/define-markup-commands.scm

index 92b4b704eb08d1778ba2b5794016799408d5a3da..d3ad150ff64a1e645bf20c52abd376f04bb3976a 100755 (executable)
@@ -968,7 +968,9 @@ samplePath =
   "
 @cindex inserting music into text
 
-Inline an image of music.
+Inline an image of music.  The reference point (usually the middle
+staff line) of the lowest staff in the top system is placed on the
+baseline.
 
 @lilypond[verbatim,quote]
 \\markup {
@@ -1014,10 +1016,18 @@ Inline an image of music.
   (let ((output (ly:score-embedded-format score layout)))
 
     (if (ly:music-output? output)
-       (stack-stencils Y DOWN baseline-skip
-                       (map paper-system-stencil
-                            (vector->list
-                             (ly:paper-score-paper-systems output))))
+        (let ((paper-systems
+               (vector->list
+                (ly:paper-score-paper-systems output))))
+          (if (pair? paper-systems)
+              ;; shift such that the refpoint of the bottom staff of
+              ;; the first system is the baseline of the score
+              (ly:stencil-translate-axis
+               (stack-stencils Y DOWN baseline-skip
+                               (map paper-system-stencil paper-systems))
+               (- (car (paper-system-staff-extents (car paper-systems))))
+               Y)
+              empty-stencil))
        (begin
          (ly:warning (_"no systems found in \\score markup, does it have a \\layout block?"))
          empty-stencil))))