[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"patch" for underline function

From: Kieren MacMillan
Subject: "patch" for underline function
Date: Tue, 25 May 2010 08:33:40 -0400

Hi all,

I want to have independent control of the thickness and offset of the underline 
markup function -- unfortunately, they are currently linked (i.e., the offset 
is a multiple of the thickness).
I have taken what I found in define-markup-commands.scm and modified it as 


#(define-markup-command (underline layout props arg)
  #:category font
  #:properties ((thickness 1) (offset 0.5))
@cindex underlining text

Underline @var{arg}.  Looks at @code{thickness} to determine line
thickness, and @code{offset} to determine line y-offset.

\\markup \\fill-line {
  \\underline "underlined"
  \\override #'(offset . 5) \\override #'(thickness . 1) \\underline 
  \\override #'(offset . 1) \\override #'(thickness . 5) \\underline 
@end lilypond"
  (let* ((thick (* (ly:output-def-lookup layout 'line-thickness)
         (markup (interpret-markup layout props arg))
         (x1 (car (ly:stencil-extent markup X)))
         (x2 (cdr (ly:stencil-extent markup X)))
         (y (* -1 offset))
         (line (make-line-stencil thick x1 y x2 y)))
    (ly:stencil-add markup line)))


This appears to do exactly what I want. Unfortunately, I don't have a 
development setup -- y'all probably remember how MAO-ing irritating it was to 
try to help me, to no MAO-ing avail -- so I'm simply forwarding this "patch" 
for improving [if necessary] and proper submission by anyone who has the 

Hopefully the coding, commenting, etc., are at least close to par... maybe a 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]