]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add draw-line command.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 31 Jan 2007 16:37:53 +0000 (17:37 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 31 Jan 2007 16:37:53 +0000 (17:37 +0100)
input/regression/markup-commands.ly
scm/define-markup-commands.scm

index dc01e9e40b719eb49e96e5f97bb4d77b5dfcbb7d..1005cd1fa9406726a85e845bb2d9c51e9a122ca7 100644 (file)
@@ -29,6 +29,8 @@ blah.")
        wordwrap:
        \wordwrap-field #'bla
       }
+
+      draw-line: \draw-line #'(5 . 3)
       
     }
   }
index 45833f08e0abf7e41cb01c8a31c3a1edaa704948..a2e128d5f0b0d966ab605dfc922d192ade1e3011 100644 (file)
 ;; 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 ""))