lilypond-user
[Top][All Lists]
Advanced

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

Re: Rehearsal Marks


From: Thomas Morley
Subject: Re: Rehearsal Marks
Date: Thu, 11 Oct 2012 02:39:42 +0200

2012/10/10 Federico Bruni <address@hidden>:
> Il 10/10/2012 22:55, Nels ha scritto:
>
>> Is there a way to make the default rehearsal mark a
>> filled in box with white lettering/number inside?
>>
>>
>
> Do you mean something like this:
>
> \version "2.16.0"
> {
>   \set Score.markFormatter = #format-mark-box-numbers
>   c1 \mark \default
>   c1 \mark \default
>   c1 \mark \default
> }
>
> where the reharsal marks are black on white?
>
> --
> Federico
>
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user


Or did you mean (png attached):

\version "2.16.0"

#(define (rounded-filled-box-stencil stencil thickness padding blot)
   "Add a rounded filled box to @var{stencil}, producing a new stencil."
  (let* ((xext (interval-widen (ly:stencil-extent stencil 0) padding))
         (yext (interval-widen (ly:stencil-extent stencil 1) padding))
         (min-ext (min (-(cdr xext) (car xext)) (-(cdr yext) (car yext))))
         (ideal-blot (min blot (/ min-ext 2)))
         (ideal-thickness (min thickness (/ min-ext 2)))
         (outer (ly:round-filled-box
            (interval-widen xext ideal-thickness)
            (interval-widen yext ideal-thickness)
               ideal-blot)))
    (set! stencil outer)
    stencil))

#(define-markup-command (rounded-filled-box layout props arg)
  (markup?)
  #:properties ((thickness 1)
        (corner-radius 0.4)
        (font-size 0)
        (box-padding 0.3))
  "Draw a rounded filled box with white @var{arg} in it"
  (let ((th (* (ly:output-def-lookup layout 'line-thickness)
               thickness))
        (pad (* (magstep font-size) box-padding))
        (m (interpret-markup layout props (markup #:with-color white arg))))
    (ly:stencil-add (rounded-filled-box-stencil m th pad corner-radius)
                    m)))

#(define (format-mark-filled-box-letters mark context)
  (make-bold-markup
        (make-rounded-filled-box-markup
           (make-markletter-markup (1- mark)))))

% test ------------

\relative c'' {
  \set Score.markFormatter = #format-mark-filled-box-letters
  c1 \mark \default
  c1 \mark \default
  c1 \mark \default
}


Cheers,
  Harm

Attachment: filled-box-marks.png
Description: PNG image


reply via email to

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