From: Han-Wen Nienhuys Date: Wed, 31 Jan 2007 16:37:53 +0000 (+0100) Subject: Add draw-line command. X-Git-Tag: release/2.11.15-1~12 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=99090207257309e033d2a7db19d7899049d8656e;p=lilypond.git Add draw-line command. --- diff --git a/input/regression/markup-commands.ly b/input/regression/markup-commands.ly index dc01e9e40b..1005cd1fa9 100644 --- a/input/regression/markup-commands.ly +++ b/input/regression/markup-commands.ly @@ -29,6 +29,8 @@ blah.") wordwrap: \wordwrap-field #'bla } + + draw-line: \draw-line #'(5 . 3) } } diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 45833f08e0..a2e128d5f0 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -24,6 +24,23 @@ ;; geometric shapes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(define-builtin-markup-command (draw-line layout props dest) + (number-pair?) + "A simple line. Uses the @code{thickness} property. " + (let* + ((th (chain-assoc-get 'thickness props 0.1)) + (x (car dest)) + (y (cdr dest))) + + (ly:make-stencil + `(draw-line + ,th + 0 0 + ,x ,y) + + (cons (min x 0) (min y 0)) + (cons (max x 0) (max y 0))))) + (define-builtin-markup-command (draw-circle layout props radius thickness fill) (number? number? boolean?) "A circle of radius @var{radius}, thickness @var{thickness} and @@ -292,11 +309,6 @@ grestore ;(map (lambda (s) (interpret-markup layout props s)) parts)) (interpret-markup layout props str))) - -;; TODO: use font recoding. -;; (make-line-markup -;; (map make-word-markup (string-tokenize str))))) - (define-public empty-markup (make-simple-markup ""))