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
>From 0e6853a2378f345d14d1b9f417d9b560f271a8f7 Mon Sep 17 00:00:00 2001
From: Malte Meyn <m...@maltemeyn.de>
Date: Sun, 16 Aug 2015 19:24:23 +0200
Subject: [PATCH] define variants of format-mark-alphabet & friends
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
after Z they continue with Aa Bb Cc instead of AA AB AC
TODO: Iâve no idea why vector-map doesnât work
---
scm/define-markup-commands.scm | 48 ++++++++++++++++++++++++++++++++++++++++++
scm/translation-functions.scm | 17 +++++++++++++++
2 files changed, 65 insertions(+)
diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm
index d7c0f22..752ab86 100644
--- a/scm/define-markup-commands.scm
+++ b/scm/define-markup-commands.scm
@@ -3172,9 +3172,15 @@ format require the prefix @code{#x}.
(vector-set! number->mark-letter-vector j
(integer->char (+ i (char->integer #\A)))))
+; TODO: use vector-map instead of list->vector (map (vector->list ?
+(define number->mark-letter-lowercase-vector (list->vector (map char-downcase (vector->list number->mark-letter-vector))))
+
(define number->mark-alphabet-vector (list->vector
(map (lambda (i) (integer->char (+ i (char->integer #\A)))) (iota 26))))
+; TODO: use vector-map instead of list->vector (map (vector->list ?
+(define number->mark-alphabet-lowercase-vector (list->vector (map char-downcase (vector->list number->mark-alphabet-vector))))
+
(define (number->markletter-string vec n)
"Double letters for big marks."
(let* ((lst (vector-length vec)))
@@ -3184,6 +3190,14 @@ format require the prefix @code{#x}.
(number->markletter-string vec (remainder n lst)))
(make-string 1 (vector-ref vec n)))))
+(define (number->markletter-var-string vecu vecl n)
+ "Double letters for big marks, variant."
+ (let* ((lst (vector-length vecu))
+ (q (quotient n lst))
+ (r (remainder n lst)))
+ (string-append (make-string 1 (vector-ref vecu r))
+ (make-string q (vector-ref vecl r)))))
+
(define-markup-command (markletter layout props num)
(integer?)
#:category other
@@ -3216,6 +3230,40 @@ and continue with double letters.
(ly:text-interface::interpret-markup layout props
(number->markletter-string number->mark-alphabet-vector num)))
+(define-markup-command (markletter-var layout props num)
+ (integer?)
+ #:category other
+ "Make a markup letter for @var{num}. The letters start with A
+to@tie{}Z (skipping letter@tie{}I), and continue with double letters.
+This is a variant: it doesnât continue with AA AB AC but Aa Bb Cc.
+
+@lilypond[verbatim,quote]
+\\markup {
+ \\markletter #8
+ \\hspace #2
+ \\markletter #26
+}
+@end lilypond"
+ (ly:text-interface::interpret-markup layout props
+ (number->markletter-var-string number->mark-letter-vector number->mark-letter-lowercase-vector num)))
+
+(define-markup-command (markalphabet-var layout props num)
+ (integer?)
+ #:category other
+ "Make a markup letter for @var{num}. The letters start with A to@tie{}Z
+and continue with double letters.
+This is a variant: it doesnât continue with AA AB AC but Aa Bb Cc.
+
+@lilypond[verbatim,quote]
+\\markup {
+ \\markalphabet #8
+ \\hspace #2
+ \\markalphabet #26
+}
+@end lilypond"
+ (ly:text-interface::interpret-markup layout props
+ (number->markletter-var-string number->mark-alphabet-vector number->mark-alphabet-lowercase-vector num)))
+
(define-public (horizontal-slash-interval num forward number-interval mag)
(if forward
(cond ;; ((= num 6) (interval-widen number-interval (* mag 0.5)))
diff --git a/scm/translation-functions.scm b/scm/translation-functions.scm
index 219275f..d466f5e 100644
--- a/scm/translation-functions.scm
+++ b/scm/translation-functions.scm
@@ -152,6 +152,23 @@ way the transposition number is displayed."
(number->string (ly:context-property context
'currentBarNumber)))))
+(define-public (format-mark-alphabet-var mark context)
+ (make-bold-markup (make-markalphabet-var-markup (1- mark))))
+
+(define-public (format-mark-box-alphabet-var mark context)
+ (make-bold-markup (make-box-markup (make-markalphabet-var-markup (1- mark)))))
+
+(define-public (format-mark-circle-alphabet-var mark context)
+ (make-bold-markup (make-circle-markup (make-markalphabet-var-markup (1- mark)))))
+
+(define-public (format-mark-letters-var mark context)
+ (make-bold-markup (make-markletter-var-markup (1- mark))))
+
+(define-public (format-mark-box-letters-var mark context)
+ (make-bold-markup (make-box-markup (make-markletter-var-markup (1- mark)))))
+
+(define-public (format-mark-circle-letters-var mark context)
+ (make-bold-markup (make-circle-markup (make-markletter-var-markup (1- mark)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Bass figures.
--
1.9.1
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user