]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add \with-dimensions-from markup command
authorSimon Albrecht <simon.albrecht@mail.de>
Tue, 16 Feb 2016 19:47:21 +0000 (19:47 +0000)
committerJames Lowe <pkx166h@gmail.com>
Tue, 16 Feb 2016 19:48:28 +0000 (19:48 +0000)
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
scm/define-markup-commands.scm

index 93e1976ef956e1f61c9fe88753b21ac16df33c41..d66218fd37bd5f7e1946067dd02a3b8712c5b36d 100644 (file)
@@ -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
index d35689d7fe6f55a6cf788edd8d7592a9abcec559..a6c84b8f6ee3b96c0c1398781ff0e5ecd2aedb5f 100644 (file)
@@ -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