]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/clef.scm
patch::: 1.3.153.uu1
[lilypond.git] / scm / clef.scm
index e3c3215e1f224b8ab83b9a385b949c6907d913f1..1d780f27c677f8773712874df61420033ed1a048 100644 (file)
@@ -1,9 +1,8 @@
 
-
-;;
 ;; (name . (glyph clef-position octavation))
-;; -- the name clefOctavation is misleading the value 7 is 1 octave not 7 Octaves.
 ;;
+;; -- the name clefOctavation is misleading. The value 7 is 1 octave, not 7 Octaves.
+
 (define supported-clefs '(
          ("treble" . ("clefs-G" -2 0))
          ("violin" . ("clefs-G" -2 0))
@@ -20,6 +19,7 @@
          ("F" . ( "clefs-F" 2 0))
          ("subbass" . ("clefs-F" 4 0))
           ("percussion" . ("clefs-percussion" 0 0))
+          ("tab" . ("clefs-tab" 0 0))
 
          ;; should move mensural stuff to separate file? 
          ("vaticana_do1" . ("clefs-vaticana_do" -1 0))
        )
 )
 
+; "an alist mapping GLYPHNAME to the position of the central C for that symbol")
+(define c0-pitch-alist
+  '(("clefs-G" . -4)
+         ("clefs-C" . 0)
+         ("clefs-F" . 4)
+         ("clefs-vaticana_do" . 0)
+         ("clefs-vaticana_fa" . 4)
+         ("clefs-medicaea_do" . 0)
+         ("clefs-medicaea_fa" . 4)
+         ("clefs-hufnagel_do" . 0)
+         ("clefs-hufnagel_fa" . 4)
+         ("clefs-hufnagel_do_fa" . 0)
+         ("clefs-mensural1_c" . 0)
+         ("clefs-mensural2_c" . 0)
+         ("clefs-mensural3_c" . 0)
+         ("clefs-mensural1_f" . 4)
+         ("clefs-mensural2_f" . 4)
+         ("clefs-mensural_g" . -4))
+  )
+
 (define (clef-name-to-properties cl)
   (let ((e '())
+       (c0 0)
        (oct 0)
        (l (string-length cl))
        )
     (if (equal? "8" (substring cl (- l 1) l))
        (begin
        (if (equal? "^" (substring cl (- l 2) (- l 1)))
-           (set! oct 7)
-           (set! oct -7))
+           (set! oct -7)
+           (set! oct 7))
        
        (set! cl (substring cl 0 (- l 2)))))
 
 
     (set! e  (assoc cl supported-clefs))
+
     (if (pair? e)
        `(((symbol . clefGlyph)
           (iterator-ctor . ,Property_iterator::constructor)
           (value . ,(cadr e))
           )
          
-;        ((symbol . forceClef)
-;         (iterator-ctor . ,Property_iterator::constructor)
-;         (value . #t)
-;         )
-
+         ((symbol . centralCPosition)
+          (iterator-ctor . ,Property_iterator::constructor)
+          (value . ,(+ oct (caddr e) (cdr  (assoc  (cadr e) c0-pitch-alist))))
+          )
          ((symbol . clefPosition)
           (iterator-ctor . ,Property_iterator::constructor)
           (value . ,(caddr e))
           )
-         ,(if (not (equal? oct 0))
-              `((symbol . clefOctavation)
+         ((symbol . clefOctavation)
                 (iterator-ctor . ,Property_iterator::constructor)
-                (value . ,oct)
-              ))
+                (value . ,(- oct))
+              )
          )
        (begin
          (ly-warn (string-append "Unknown clef type `" cl "'\nSee scm/lily.scm for supported clefs"))