[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-devel
Subject:    Formatting BarNumber
From:       Thomas Morley <thomasmorley65 () gmail ! com>
Date:       2013-07-19 21:13:46
Message-ID: CABsfGyUfBPjSLP5KzqE0xdwFV8117BnRmAyJmEity9wYGPiv1w () mail ! gmail ! com
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic