2013/7/16 Kieren MacMillan <kieren_macmil...@sympatico.ca>: > Hi David, > >> Try starting from > > Thanks — that's very helpful! > > Here's what I have from there: > > \version "2.17" > > #(define-markup-command (ellipse layout props text) (markup?) > #:properties ((thickness 0.2) (x-padding 0.1) (y-padding 0.75)) > (ellipse-stencil (interpret-markup layout props text) > thickness x-padding y-padding)) > > \markup \ellipse "2" > \markup \ellipse "20" > \markup \ellipse "200" > \markup \ellipse "2000" > \markup \ellipse "20000" > > The 200 looks sufficiently like the three-digit bar numbers in my Henle score > that I'm totally satisfied. > The four- and five-digit ones are fine (though the five-digit one is probably > a little "pointy": I don't have any 10000+ bar Henle scores to compare it to). > > However, I'd love to fix the one- and two-digit versions: they're currently > too "vertical" and "circular", respectively. > What's the easy way of saying "center the number in a box at least 'this > big', but use the number's real extent if it's bigger than that"? > > Thanks, > Kieren. > _______________________________________________ > lilypond-user mailing list > lilypond-user@gnu.org > https://lists.gnu.org/mailman/listinfo/lilypond-user
Hi Kieren, below my own approach. I defined two formatters for BarNumber, 1) using my version of \ellipse (though, it's nearly the same as David's). 2) using \oval I'd prefer \oval, because it's better appearence with one- and two-digit numbers. \version "2.17.22" %%%%%% % markup-commands %%%%%% #(define-markup-command (ellipse layout props arg) (markup?) #:properties ((thickness 1) (font-size 0) (ellipse-padding 0.2)) " Draw an ellipse around @var{arg}. Use @code{thickness}, @code{ellipse-padding} and @code{font-size} properties to determine line thickness and padding around the markup. @lilypond[verbatim,quote] \\markup { \\ellipse { Hi } } @end lilypond " (let ((th (* (ly:output-def-lookup layout 'line-thickness) thickness)) (pad (* (magstep font-size) ellipse-padding)) (m (interpret-markup layout props arg))) (ellipse-stencil m th pad pad))) #(define-markup-command (oval layout props arg) (markup?) #:properties ((thickness 1) (font-size 0) (oval-padding 0.65)) " Draw a oval around @var{arg}. Use @code{thickness}, @code{oval-padding} and @code{font-size} properties to determine line thickness and padding around the markup. @lilypond[verbatim,quote] \\markup { \\oval { Hi } } @end lilypond " (let ((th (* (ly:output-def-lookup layout 'line-thickness) thickness)) (pad (* (magstep font-size) oval-padding)) (m (interpret-markup layout props arg))) (oval-stencil m th pad pad))) %%%%%% % barnumbers-formatter %%%%%% #(define (format-oval-barnumbers barnum measure-pos alt-number context) (make-oval-markup (robust-bar-number-function barnum measure-pos alt-number context))) #(define (format-ellipse-barnumbers barnum measure-pos alt-number context) (make-ellipse-markup (robust-bar-number-function barnum measure-pos alt-number context))) %%%%%% % Examples %%%%%% % toplevel-markup \markup \fill-line { \column { \bold "Toplevel-markups" \line { "using \\ellipse: " \ellipse { "1" "11" "111" "1111" "11111" } } \line { "using \\oval: " \oval { "1" "11" "111" "1111" "11111" } } \vspace #2 } } % scores, including tests for 'alternativeNumberingStyle' mus = \relative c'{ \repeat volta 3 { c4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 \break \set Score.alternativeNumberingStyle = #'numbers \repeat volta 3 { c4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 \break \set Score.alternativeNumberingStyle = #'numbers-with-letters \repeat volta 3 { c,4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 } \score { \new Staff \mus \header { piece = \markup \bold \fill-line { \column { "Normal BarNumbers" \vspace #2 } } } } \score { \new Staff \mus \layout { \context { \Score barNumberFormatter = #format-oval-barnumbers } } \header { piece = \markup \bold \fill-line { \column { "Oval BarNumbers" \vspace #2 } } } } \score { \new Staff \mus \layout { \context { \Score barNumberFormatter = #format-ellipse-barnumbers } } \header { piece = \markup \bold \fill-line { \column { "Ellipse BarNumbers" \vspace #2 } } } } HTH, Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user