From 25fe86c1db4017a46c3169912ceae8a6663b057e Mon Sep 17 00:00:00 2001 From: Simon Albrecht Date: Tue, 16 Feb 2016 19:47:21 +0000 Subject: [PATCH] Add \with-dimensions-from markup command Issue 4766 This command acts as a front-end to \with-dimensions, taking the new dimensions from a markup object instead of having them explicitly given. Also provides a Changes.tely entry. --- Documentation/changes.tely | 18 ++++++++++++++++++ scm/define-markup-commands.scm | 10 ++++++++++ 2 files changed, 28 insertions(+) diff --git a/Documentation/changes.tely b/Documentation/changes.tely index 93e1976ef9..d66218fd37 100644 --- a/Documentation/changes.tely +++ b/Documentation/changes.tely @@ -101,6 +101,24 @@ Each column may be aligned differently. } @end lilypond +@item +A new markup-command, @code{\with-dimensions-from}, makes +@code{\with-dimensions} easier to use by taking the new +dimensions from a markup object, given as first argument. +@lilypond[quote,verbatim] +\markup { + \pattern #5 #Y #0 "x" + \pattern #5 #Y #0 \with-dimensions-from "x" "f" + \pattern #5 #Y #0 \with-dimensions-from "x" "g" + \override #'(baseline-skip . 2) + \column { + \pattern #5 #X #0 "n" + \pattern #5 #X #0 \with-dimensions-from "n" "m" + \pattern #5 #X #0 \with-dimensions-from "n" "!" + } +} +@end lilypond + @item A new page breaking function @code{ly:one-line-auto-height-breaking} places a whole score on a single line and changes the page width diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index d35689d7fe..a6c84b8f6e 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -2251,6 +2251,16 @@ Set the dimensions of @var{arg} to @var{x} and@tie{}@var{y}." `(delay-stencil-evaluation ,(delay expr)) x y)))) +(define-markup-command (with-dimensions-from layout props arg1 arg2) + (markup? markup?) + #:category other + " +Print @var{arg2} with the dimensions of @var{arg1}." + (let* ((stil1 (interpret-markup layout props arg1)) + (x (ly:stencil-extent stil1 0)) + (y (ly:stencil-extent stil1 1))) + (interpret-markup layout props (markup #:with-dimensions x y arg2)))) + (define-markup-command (pad-around layout props amount arg) (number? markup?) #:category align -- 2.39.2