bug-lilypond
[Top][All Lists]
Advanced

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

Issue 1104 in lilypond: Enhancement: "underline" markup function needed


From: lilypond
Subject: Issue 1104 in lilypond: Enhancement: "underline" markup function needed (and proposed)
Date: Thu, 27 May 2010 14:47:03 +0000

Status: Accepted
Owner: ----
Labels: Type-Enhancement Priority-Low

New issue 1104 by brownian.box: Enhancement: "underline" markup function needed (and proposed)
http://code.google.com/p/lilypond/issues/detail?id=1104

http://lists.gnu.org/archive/html/lilypond-devel/2010-05/msg00491.html :

% --------------------------------------
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
follows:

%%%%%%%%%%%%%%%%%%%

#(define-markup-command (underline layout props arg)
  (markup?)
  #: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.

@lilypond[verbatim,quote]
\\markup \\fill-line {
  \\underline "underlined"
  \\override #'(offset . 5)
    \\override #'(thickness . 1) \\underline "underlined"
  \\override #'(offset . 1)
    \\override #'(thickness . 5) \\underline "underlined"
}
}
@end lilypond"
  (let* ((thick (* (ly:output-def-lookup layout 'line-thickness)
                   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 time/interest.

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

Cheers,
Kieren.

% --------------------------------------

Sorry for the noise .)





reply via email to

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