]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/define-markup-commands.scm
Merge branch 'master' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / scm / define-markup-commands.scm
index 39e483465e866025bc6b6fe0907ee1d35252929b..0b9e7c954026a84d0b47715460df97e53f2a53f2 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* ((thick (*
+             (ly:output-def-lookup layout 'line-thickness)
+             (chain-assoc-get 'thickness props 1)))
+        (markup (interpret-markup layout props arg))
+        (x1 (car (ly:stencil-extent markup X)))
+        (x2 (cdr (ly:stencil-extent markup X)))
+        (y (* thick -2))
+        (line (ly:make-stencil
+               `(draw-line ,thick ,x1 ,y ,x2 ,y)
+               (cons (min x1 0) (max x2 0))
+               (cons thick thick))))
+        (ly:stencil-add markup line)))
+
 (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
@@ -124,7 +140,7 @@ thickness and padding around the markup."
   
   (let* ((th (*
              (ly:output-def-lookup layout 'line-thickness)
-             (chain-assoc-get 'thickness props  0.1)))
+             (chain-assoc-get 'thickness props 1)))
         (size (chain-assoc-get 'font-size props 0))
         (pad (* (magstep size)
                 (chain-assoc-get 'box-padding props 0.2)))
@@ -1485,14 +1501,14 @@ when @var{label} is not found."
 
 (define-builtin-markup-list-command (justified-lines layout props args) (markup-list?)
   "Like @code{\\justify}, but return a list of lines instead of a single markup.
-Use @code{\\override #'(line-width . @var{X})} to set the line width;
+Use @code{\\override-lines #'(line-width . @var{X})} to set the line width;
 @var{X}@tie{}is the number of staff spaces."
   (space-lines (chain-assoc-get 'baseline-skip props)
               (wordwrap-markups layout props args #t)))
 
 (define-builtin-markup-list-command (wordwrap-lines layout props args) (markup-list?)
   "Like @code{\\wordwrap}, but return a list of lines instead of a single markup.
-Use @code{\\override #'(line-width . @var{X})} to set the line width,
+Use @code{\\override-lines #'(line-width . @var{X})} to set the line width,
 where @var{X} is the number of staff spaces."
   (space-lines (chain-assoc-get 'baseline-skip props)
               (wordwrap-markups layout props args #f)))