Am 16.08.2015 um 22:00 schrieb Thomas Morley:
2015-08-16 21:21 GMT+02:00 Malte Meyn <[email protected]>:
Hi list,

sometimes there are more than 25 or 26 rehearsal marks in a piece.
LilyPond’s format-mark-(alphabet|letters) function and friends continue
after X, Y, Z with AA, AB, AC, …

I have never seen this in printed scores. Instead all scores I’ve seen
continue with doubled letters (the second lowercase): Aa, Bb, Cc. And once
I’ve even seen … Yy, Zz, Aaa, Bbb, …

I made functions format-mark-(alphabet|letter)-var and boxed and circled
variants which implement this behaviour (see attached patch). So now I would
like to know:

Is there an interest in having this behaviour in LilyPond (maybe as a
variant)? Or have you seen something similar (f. e. everything uppercase)?
If so, how to name these functions? And would I have to post this to bug- or
dev-list? They’re not perfect yet, for example I didn’t know how to use
vector-map ;)

Or is this something for openlilylib instead of original LilyPond?

Malte

Hi Malte,

you could discuss on -devel.

Maybe I'd let the patch discuss after it is part of the usual review process.
I.e. issue created, patch uploaded.

I don’t have the time to discuss this and make a patch but if anyone is interested: Some time ago I implemented a single markFormatter function which can do this and some other things (roman numbers, oval frames, lowercase/mixed case marks).
\version "2.19.40"

#(set-global-staff-size 18)

#(define mark-alphabets
   `((alphabet . ,(list->vector (string->list "ABCDEFGHIJKLMNOPQRSTUVWXYZ")))
     (omit-i . ,(list->vector (string->list "ABCDEFGHJKLMNOPQRSTUVWXYZ")))
     (omit-j . ,(list->vector (string->list "ABCDEFGHIKLMNOPQRSTUVWXYZ")))))

#(define (mark-generic-string number alphabet uppercase? repeat?)
   (let* ((the-alphabet (assq-ref mark-alphabets alphabet))
          (the-alphabet-length (vector-length the-alphabet))
          (the-string
           (if repeat?
               (let ((the-length (1+ (quotient (1- number) the-alphabet-length)))
                     (the-index (remainder (1- number) the-alphabet-length)))
                 (make-string the-length (vector-ref the-alphabet the-index)))
               (let loop ((num (1- number)))
                 (if (< num the-alphabet-length)
                     (string (vector-ref the-alphabet num))
                     (string-append
                      (loop (1- (quotient num the-alphabet-length)))
                      (loop (remainder num the-alphabet-length))))))))
     (if uppercase?
         the-string
         (string-capitalize the-string))))

#(define-markup-command (mark-generic layout props number alphabet uppercase? repeat?)
   (integer? symbol? boolean? boolean?)
   #:category other
   (ly:text-interface::interpret-markup layout props
     (mark-generic-string number alphabet uppercase? repeat?)))

#(define (format-mark-generic alphabet framed bold? uppercase? repeat?)
   (lambda (number context)
     (let* ((the-string
             (case alphabet
               ((barnumbers) (number->string (ly:context-property context 'currentBarNumber)))
               ((arabic) (number->string number))
               ((roman) (if uppercase?
                            (format #f "~@r" number)
                            (string-downcase (format #f "~@r" number))))
               (else (make-mark-generic-markup number alphabet uppercase? repeat?))))
            (the-framed-string
             (case framed
               ((box) (make-box-markup the-string))
               ((circle) (make-circle-markup the-string))
               ((oval) (make-oval-markup the-string))
               ((#f) the-string))))
       (if bold?
           (make-bold-markup the-framed-string)
           the-framed-string))))

\paper {
  indent = 0
  ragged-last = ##f
  ragged-last-bottom = ##f
  score-system-spacing.basic-distance = 5
}

\header {
  title = "format-mark-generic"
  subtitle = "a versatile markFormatter function"
  composer = "Malte Meyn"
}

foo = {
  R1
  \mark 1
  R
  \mark 8
  R
  \mark 9
  R
  \mark 10
  R
  \mark 26
  R
  \mark 27
  R
  \mark 28
  R
  \mark 52
  R
  \mark 53
  R
}

\markup "Use barnumbers, …"
\new Score \with { markFormatter = #(format-mark-generic 'barnumbers #f #t '() '()) } \foo
\markup "… arabic numbers, …"
\new Score \with { markFormatter = #(format-mark-generic 'arabic #f #t '() '()) } \foo
\markup "… roman numbers, …"
\new Score \with { markFormatter = #(format-mark-generic 'roman #f #t #t '()) } \foo
\markup "… or the latin alphabet (optionally omitting either I or J), …"
\new Score \with { markFormatter = #(format-mark-generic 'alphabet #f #t #t #f) } \foo
\new Score \with { markFormatter = #(format-mark-generic 'omit-i #f #t #t #f) } \foo
\new Score \with { markFormatter = #(format-mark-generic 'omit-j #f #t #t #f) } \foo
\markup "… combine letters after Z (as shown above) or use repeated letters, …"
\new Score \with { markFormatter = #(format-mark-generic 'alphabet #f #t #t #t) } \foo
\markup "… use lowercase/mixed case variants, …"
\new Score \with { markFormatter = #(format-mark-generic 'roman #f #t #f '()) } \foo
\new Score \with { markFormatter = #(format-mark-generic 'alphabet #f #t #f #t) } \foo
%\pageBreak
\markup "… put the mark into a box, circle, or oval, …"
\new Score \with { markFormatter = #(format-mark-generic 'alphabet 'box #t #f #t) } \foo
\new Score \with { markFormatter = #(format-mark-generic 'alphabet 'circle #t #f #t) } \foo
\new Score \with { markFormatter = #(format-mark-generic 'alphabet 'oval #t #f #t) } \foo
\markup "… use a medium font, …"
\new Score \with { markFormatter = #(format-mark-generic 'alphabet #f #f #f #t) } \foo
\markup \justify-string #"… and combine any of these options! Any of LilyPond’s original format-mark-??? functions can be imitated and much more is possible through one single function.

Usage: \\set Score.markFormatter = #(format-mark-generic alphabet framed bold? uppercase? repeat?)

• alphabet can be one of 'alphabet 'omit-i 'omit-j 'barnumbers 'arabic 'roman

• framed can be one of 'box 'circle 'oval #f (the latter for no frame)

• bold? is #t for bold and #f for medium font

• uppercase? is #t for uppercase and #f for lowercase (roman numbers) or mixed case (letters)

• repeat? is #t for repeated and #f for combined letters"

Attachment: format-mark-generic.pdf
Description: Adobe PDF document

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to