]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix 732: center-column ignored left half of stencil extent -> collision with previous...
authorReinhold Kainhofer <reinhold@kainhofer.com>
Fri, 22 Jul 2011 17:13:21 +0000 (19:13 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Thu, 28 Jul 2011 12:39:08 +0000 (14:39 +0200)
input/regression/markup-center-align-nocollision.ly [new file with mode: 0644]
scm/define-markup-commands.scm
scm/markup.scm

diff --git a/input/regression/markup-center-align-nocollision.ly b/input/regression/markup-center-align-nocollision.ly
new file mode 100644 (file)
index 0000000..ac3d245
--- /dev/null
@@ -0,0 +1,17 @@
+\version "2.15.7"
+
+\header {
+  texidoc = "Text markup using @code{center-align} or @code{center-column} shall
+still reserve space for its whole width and not overwrite the previous stencil."
+}
+
+\markup{\left-align { AAA BB }}
+\markup{\center-align { AAA BB }}
+\markup{\right-align { AAA BB }}
+
+% Here the two center-columns should not collide with the +
+\markup \line {
+  \center-column { \line {XXX} \line {Y} }
+  "+"
+  \center-column { \line {XXX} \line {Y}}
+}
index 914ee2585d9e4e8b22a324164e1419c0ea3bf4e7..cf3417d3b58e29c31398f23a8dfef9b1519c3d79 100644 (file)
@@ -1485,8 +1485,10 @@ setting of the @code{direction} layout property.
 (define (general-column align-dir baseline mols)
   "Stack @var{mols} vertically, aligned to  @var{align-dir} horizontally."
 
-  (let* ((aligned-mols (map (lambda (x) (ly:stencil-aligned-to x X align-dir)) mols)))
-    (stack-lines -1 0.0 baseline aligned-mols)))
+  (let* ((aligned-mols (map (lambda (x) (ly:stencil-aligned-to x X align-dir)) mols))
+         (stacked-stencil (stack-lines -1 0.0 baseline aligned-mols))
+         (stacked-extent (ly:stencil-extent stacked-stencil X)))
+    (ly:stencil-translate-axis stacked-stencil (- (car stacked-extent)) X )))
 
 (define-markup-command (center-column layout props args)
   (markup-list?)
index 6bd9fd6236c687950ff450b09ee2184badda92e8..3cf774d4a880bfd66f8e9cc8bd152411143aafa8 100644 (file)
@@ -538,7 +538,7 @@ Uncovered - cheap-markup? is used."
               (ly:stencil? (cadr stencils)))
           (let* ((tail (stack-stencil-line space (cdr stencils)))
                  (head (car stencils))
-                 (xoff (+ space (cdr (ly:stencil-extent head X)))))
+                 (xoff (+ space (interval-length (ly:stencil-extent head X)))))
             (ly:stencil-add head
                              (ly:stencil-translate-axis tail xoff X)))
           (car stencils))