On Sun, Jul 23, 2017 at 12:13:08PM -0700, Paul Scott wrote:
> On Sun, Jul 23, 2017 at 12:22:27PM +0200, Thomas Morley wrote:
> > 2017-07-23 6:49 GMT+02:00 Paul Scott <waterho...@ultrasw.com>:
> > > On Sat, Jul 22, 2017 at 05:25:30PM -0700, madMuze wrote:
> > 
> > Hi Paul,
> > 
> > here my own approach (extending the default 'robust-bar-number-function')
> 
> This looks great!  Do I have a choice to not have the a b sublettering for
> alternatives?

In addition I need to be able to start at a letter of my choice.  A part I am
working on now goes from bar 52 to bar 54H.  (I don't have any problem
with using \set Score.currentBarNumber for part of this solution.)

(I'm not asking for you to write code for me.)  This may be a chance to
get my scheme coding up to speed.

Thank you,

Paul


> 
> Thank you,
> 
> Paul
> 
> 
> > 
> > \version "2.19.64"
> > 
> > #(define* ((my-robust-bar-number-function #:optional (fixed #f))
> >              barnum measure-pos alt-number context)
> >   (define strg " abcdefghijklmnopqrstuvwxyz")
> >   (define (get-number-and-power an pow)
> >     (if (<= an alt-number)
> >         (get-number-and-power (+ an (expt 26 (1+ pow))) (1+ pow))
> >         (cons (+ alt-number (- (expt 26 pow) an)) (1- pow))))
> >   (define (make-letter so-far an pow)
> >     (if (< pow 0)
> >         so-far
> >         (let ((pos (modulo (quotient an (expt 26 pow)) 26)))
> >           (make-letter (string-append so-far
> >                                       (substring (string-drop strg 1)
> >                                                  pos
> >                                                  (1+ pos)))
> >                        an
> >                        (1- pow)))))
> >   (let* ((number-and-power (get-number-and-power 0 0))
> >          (begin-measure (= 0 (ly:moment-main-numerator measure-pos)))
> >          (maybe-open-parenthesis (if begin-measure "" "("))
> >          (maybe-close-parenthesis (if begin-measure "" ")")))
> >     (markup
> >       (string-append
> >         maybe-open-parenthesis
> >         (number->string (if (number? fixed) fixed barnum))
> >         (cond
> >           ((not (number? fixed))
> >             "")
> >           ((and (number? fixed) (< (- barnum fixed) 27))
> >             (string-capitalize (string (string-ref strg (- barnum fixed)))))
> >           (else
> >             (begin
> >               (ly:warning
> >                 "Requested letter-number exceeds the alphabet: ~a, 
> > ignoring."
> >                 (- barnum fixed))
> >               "")))
> >         (make-letter ""
> >                      (car number-and-power)
> >                      (cdr number-and-power))
> >         maybe-close-parenthesis))))
> > 
> > keepBarNumberWithLetters =
> >   \context Score
> >   \applyContext
> >   #(lambda (context)
> >     (let ((static-bar (ly:context-property context 'currentBarNumber)))
> >       (ly:context-set-property! context
> >         'barNumberFormatter (my-robust-bar-number-function static-bar))))
> > 
> > defaultBarNumbers =
> >   \set Score.barNumberFormatter = #robust-bar-number-function
> > 
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > %% EXAMPLE
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > 
> > \layout {
> >   \context {
> >     \Score
> >     %% For testing. Those settings shouldn't have any impact on the
> >     %% barNumberFormatter
> >     \override BarNumber.break-visibility = ##(#f #t #t)
> >     barNumberVisibility = #first-bar-number-invisible-save-broken-bars
> >     alternativeNumberingStyle = #'numbers-with-letters
> >   }
> > }
> > 
> > {
> >   c'1  c'
> >   \keepBarNumberWithLetters
> >   c' c' c'2 \bar "" \break c'2
> >   \repeat volta 2 { c'1 } \alternative { { cis'1 } { ces'1 } }
> >   %% NB
> >   %% Only the letters of the alphabet plus space are available.
> >   %% Exceeding those will be ignored and a warning issued.
> >   %\repeat unfold 25 c'1
> >   \keepBarNumberWithLetters
> >   c'1  c'
> >   \defaultBarNumbers
> >   c' c' c'
> > }
> > 
> > 
> > HTH,
> >   Harm
> > 
> 
> 
> _______________________________________________
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
> 


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to