From: Reinhold Kainhofer Date: Fri, 22 Jul 2011 17:13:21 +0000 (+0200) Subject: Fix 732: center-column ignored left half of stencil extent -> collision with previous... X-Git-Tag: release/2.15.7-1~12 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a43a9465fda1728a64fae3619c3f936589dbbdf0;p=lilypond.git Fix 732: center-column ignored left half of stencil extent -> collision with previous stencil --- diff --git a/input/regression/markup-center-align-nocollision.ly b/input/regression/markup-center-align-nocollision.ly new file mode 100644 index 0000000000..ac3d245ba8 --- /dev/null +++ b/input/regression/markup-center-align-nocollision.ly @@ -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}} +} diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 914ee2585d..cf3417d3b5 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -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?) diff --git a/scm/markup.scm b/scm/markup.scm index 6bd9fd6236..3cf774d4a8 100644 --- a/scm/markup.scm +++ b/scm/markup.scm @@ -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))