]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3469: adding markup-commands \oval and \ellipse
authorThomas Morley <thomasmorley65@googlemail.com>
Wed, 24 Jul 2013 17:14:16 +0000 (19:14 +0200)
committerDavid Kastrup <dak@gnu.org>
Wed, 24 Jul 2013 17:15:43 +0000 (19:15 +0200)
\oval and \ellipse are drawing an oval respectively an ellipse around their
argument.
Also adding a reg-test for markup-commands framing their argument.

Signed-off-by: David Kastrup <dak@gnu.org>
input/regression/markup-frame-text.ly [new file with mode: 0644]
scm/define-markup-commands.scm

diff --git a/input/regression/markup-frame-text.ly b/input/regression/markup-frame-text.ly
new file mode 100644 (file)
index 0000000..b24ab95
--- /dev/null
@@ -0,0 +1,15 @@
+\version "2.17.23"
+
+\header {
+
+  texidoc = "Text is framed properly with @code{\\box},
+@code{\\circle}, @code{\\oval} and @code{\\ellipse}"
+
+}
+
+\markup \column {
+       \line { \box { text in boxes "1" "12" "123" } }
+       \line { \circle { text in circles "1" "12" "123" } }
+       \line { \oval { text in ovals "1" "12" "123" } }
+       \line { \ellipse { text in ellipses "1" "12" "123" } }
+}
index ed1ab40420943d12fa0d4d83ce0e7dbc54d3c43f..2f08783d7e8edb82ee697ee43446e54b90311cdf 100644 (file)
@@ -380,6 +380,62 @@ thickness and padding around the markup.
         (m (interpret-markup layout props arg)))
     (circle-stencil m th pad)))
 
+(define-markup-command (ellipse layout props arg)
+  (markup?)
+  #:category graphic
+  #:properties ((thickness 1)
+                (font-size 0)
+                (x-padding 0.2)
+                (y-padding 0.2))
+  "
+@cindex drawing ellipse around text
+
+Draw an ellipse around @var{arg}.  Use @code{thickness},
+@code{x-padding}, @code{y-padding} and @code{font-size} properties to determine
+line thickness and padding around the markup.
+
+@lilypond[verbatim,quote]
+\\markup {
+  \\ellipse {
+    Hi
+  }
+}
+@end lilypond"
+  (let ((th (* (ly:output-def-lookup layout 'line-thickness)
+               thickness))
+        (pad-x (* (magstep font-size) x-padding))
+        (pad-y (* (magstep font-size) y-padding))
+        (m (interpret-markup layout props arg)))
+    (ellipse-stencil m th pad-x pad-y)))
+
+(define-markup-command (oval layout props arg)
+  (markup?)
+  #:category graphic
+  #:properties ((thickness 1)
+                (font-size 0)
+                (x-padding 0.75)
+                (y-padding 0.75))
+  "
+@cindex drawing oval around text
+
+Draw a oval around @var{arg}.  Use @code{thickness},
+@code{x-padding}, @code{x-padding} and @code{font-size} properties to determine
+line thickness and padding around the markup.
+
+@lilypond[verbatim,quote]
+\\markup {
+  \\oval {
+    Hi
+  }
+}
+@end lilypond"
+  (let ((th (* (ly:output-def-lookup layout 'line-thickness)
+               thickness))
+        (pad-x (* (magstep font-size) x-padding))
+        (pad-y (* (magstep font-size) y-padding))
+        (m (interpret-markup layout props arg)))
+    (oval-stencil m th pad-x pad-y)))
+
 (define-markup-command (with-url layout props url arg)
   (string? markup?)
   #:category graphic