From 290f70d1ea9287d14504304886735737091ccab2 Mon Sep 17 00:00:00 2001 From: Erlend Aasland Date: Fri, 11 Jan 2008 18:08:45 +0100 Subject: [PATCH] Implement underline markup command, and add a regression test for it. --- input/regression/markup-commands.ly | 2 +- scm/define-markup-commands.scm | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/input/regression/markup-commands.ly b/input/regression/markup-commands.ly index 1005cd1fa9..01df789911 100644 --- a/input/regression/markup-commands.ly +++ b/input/regression/markup-commands.ly @@ -31,7 +31,7 @@ blah.") } draw-line: \draw-line #'(5 . 3) - + \underline "underlined" } } } diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 210ada37cf..e04b79963c 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -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 -- 2.39.5