]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/define-markup-commands.scm
* scm/define-grobs.scm (all-grob-descriptions): reorganize in
[lilypond.git] / scm / define-markup-commands.scm
index d2b1aaa0b6a982a872b3416e006b05e8a0eeae61..9a61ba87e699b890ffa2ab5c0643aac6c025537c 100644 (file)
@@ -90,7 +90,6 @@ the PDF backend."
      (cons (+ (- half) (car yext))
           (+ half (cdr yext))))))
 
-
 (def-markup-command (box layout props arg) (markup?)
   "Draw a box round @var{arg}.  Looks at @code{thickness},
 @code{box-padding} and @code{font-size} properties to determine line
@@ -102,8 +101,6 @@ thickness and padding around the markup."
         (m (interpret-markup layout props arg)))
     (box-stencil m th pad)))
 
-
-
 (def-markup-command (filled-box layout props xext yext blot)
   (number-pair? number-pair? number?)
   "Draw a box with rounded corners of dimensions @var{xext} and @var{yext}."
@@ -125,6 +122,19 @@ thickness and padding around the markup."
 
     (ly:stencil-add white stil)))
 
+(def-markup-command (pad-markup layout props padding arg) (number? markup?)
+  "Add space around a markup object."
+
+  (let*
+      ((stil (interpret-markup layout props arg))
+       (xext (ly:stencil-extent stil X))
+       (yext (ly:stencil-extent stil Y)))
+
+    (ly:make-stencil
+     (ly:stencil-expr stil)
+     (interval-widen xext padding)
+     (interval-widen yext padding))))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; space
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -160,7 +170,6 @@ normally inserted before elements on a line.
   "Stencil as markup"
   stil)
 
-
 (define bbox-regexp
   (make-regexp "%%BoundingBox: ([0-9-]+) ([0-9-]+) ([0-9-]+) ([0-9-]+)"))