]> git.donarmstrong.com Git - lilypond.git/commitdiff
Implement underline markup command, and add a regression test for it.
authorErlend Aasland <erlend.aasland@mac.com>
Fri, 11 Jan 2008 17:08:45 +0000 (18:08 +0100)
committerErlend Aasland <erlend.aasland@mac.com>
Fri, 11 Jan 2008 17:08:45 +0000 (18:08 +0100)
input/regression/markup-commands.ly
scm/define-markup-commands.scm

index 1005cd1fa9406726a85e845bb2d9c51e9a122ca7..01df789911fffe5ea2332ebb68c2cda46fd02fa4 100644 (file)
@@ -31,7 +31,7 @@ blah.")
       }
 
       draw-line: \draw-line #'(5 . 3)
-      
+      \underline "underlined"
     }
   }
 }
index 210ada37cf9b32b58ce10e51805cb25e9d27a130..e04b79963cc91a688994b8470fb60c00c1284fc0 100644 (file)
@@ -117,6 +117,22 @@ the PDF backend."
      (cons (+ (- half) (car yext))
           (+ half (cdr yext))))))
 
+(define-builtin-markup-command (underline layout props arg) (markup?)
+  "Underline @var{arg}.  Looks at @code{thickness} to determine line
+thickness and y offset."
+  (let* ((th (*
+             (ly:output-def-lookup layout 'line-thickness)
+             (chain-assoc-get 'thickness props 1)))
+        (m (interpret-markup layout props arg))
+        (x (cdr (ly:stencil-extent m X)))
+        (y (* th -2))
+        (line (ly:make-stencil
+               `(draw-line ,th 0 ,y ,x ,y)
+               (cons (min x 0) (max x 0))
+               (cons th th)))
+        (s (ly:stencil-add m line)))
+    s))
+
 (define-builtin-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