lilypond-devel
[Top][All Lists]
Advanced

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

Formatting BarNumber


From: Thomas Morley
Subject: Formatting BarNumber
Date: Fri, 19 Jul 2013 23:13:46 +0200

Hi,

recently there was a thread about BarNumbers in ovals on the user-list
http://lilypond.1069038.n5.nabble.com/Henle-piano-template-td148093.html
(The markup-command oval is currently on review.)

Researching more about how BarNumbers are formatted, I found that we
currently have only one defined formatter, afaik:
barNumberFormatter =robust-bar-number-function

Additionally, we show workarounds in /Documentation/snippets
http://lilypond.org/doc/v2.17/Documentation/snippets/rhythms#rhythms-printing-bar-numbers-inside-boxes-or-circles

I thought about

a)
adding something like

#(define*-public ((format-oval-barnumbers-alt
                       #:optional (padx 0.75) (pady 0.75) (thickness 1))
                       barnum measure-pos alt-number context)
"
 Returns the BarNumber with an oval drawn around it.
 For use with @code{barNumberFormatter}
 @var{padx}, @var{pady} and @var{thickness} are optional arguments.

 @samp{barNumberFormatter = #(format-oval-barnumbers-alt)}
 or
 @samp{barNumberFormatter = #(format-oval-barnumbers-alt 1.11 2.22 3.33)}
"
 (make-override-markup `(x-padding . ,padx)
   (make-override-markup `(y-padding . ,pady)
     (make-override-markup `(thickness . ,thickness)
       (make-oval-markup
         (robust-bar-number-function barnum measure-pos alt-number context))))))

or

b)
adding something like

#(define-public (make-stencil-ovaler thickness x-padding y-padding callback)
  "Return function that adds an oval around the grob passed as argument."
  (lambda (grob)
    (oval-stencil (callback grob) thickness x-padding y-padding)))

and expand the snippet with it.

or

c)
showing the most simple method:

\override Score.BarNumber.before-line-breaking =
  #(lambda (grob)
    (let*  ((txt (ly:grob-property grob 'text)))
    (ly:grob-set-property! grob 'text (markup #:oval txt))))


What are the opinions? Is some of it worth to be turned into a patch?


-Harm



reply via email to

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