lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Add \with-dimensions-from markup command (issue 281710043 by address@hid


From: simon . albrecht
Subject: Add \with-dimensions-from markup command (issue 281710043 by address@hidden)
Date: Sun, 07 Feb 2016 14:13:40 +0000

Reviewers: ,

Message:
Please review.

Description:
Add \with-dimensions-from markup command

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 entry.
I didn’t think a regtest was necessary, since the functionality
isn’t new.

Please review this at https://codereview.appspot.com/281710043/

Affected files (+28, -0 lines):
  M Documentation/changes.tely
  M scm/define-markup-commands.scm


Index: Documentation/changes.tely
diff --git a/Documentation/changes.tely b/Documentation/changes.tely
index 00e53b5e88ff347ea84ea001846164f9f7feae4a..cdefa6e5fe1bc6316f07f9973afb81a41a766c0c 100644
--- a/Documentation/changes.tely
+++ b/Documentation/changes.tely
@@ -62,6 +62,24 @@ which scares away people.
 @end ignore

 @item
+A new markup-command, @code{\with-dimensions-from}, makes
address@hidden easier to use by taking the new
+dimensions from a markup object, given as first argument.
address@hidden,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" "!"
+  }
+}
address@hidden lilypond
+
address@hidden
 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
 to match, just like @code{ly:one-line-breaking}.  The difference is that
Index: scm/define-markup-commands.scm
diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm
index edd70f216dc8eaf448987f2e9f81836a4b3f7bd3..e2346c9f64431021470893375975d4c1b185bf55 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} address@hidden@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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]