]> git.donarmstrong.com Git - lilypond.git/commitdiff
Use glyph-name-alist in cancellations, more verbose error message.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 30 Dec 2006 12:43:32 +0000 (13:43 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 30 Dec 2006 12:43:32 +0000 (13:43 +0100)
lily/key-signature-interface.cc
scm/define-grobs.scm
scm/output-lib.scm

index 8351696f30ab0fe4f19709bc19ace50123f8138e..bea2aafbc7f7c20216e513a47d5c5b0426ca94a3 100644 (file)
 #include "lookup.hh"
 #include "output-def.hh"
 #include "staff-symbol-referencer.hh"
+#include "rational.hh"
 
 struct Key_signature_interface
 {
   DECLARE_SCHEME_CALLBACK (print, (SCM));
-
   DECLARE_GROB_INTERFACE();
 };
 
@@ -62,10 +62,17 @@ Key_signature_interface::print (SCM smob)
   for (SCM s = me->get_property ("alteration-alist"); scm_is_pair (s); s = scm_cdr (s))
     {
       SCM alt = is_cancellation
-       ? scm_from_int (0) 
+       ? scm_from_int (0)
        : scm_cdar (s);
 
       SCM glyph_name = ly_assoc_get (alt, alist, SCM_BOOL_F);
+      if (!scm_is_string (glyph_name))
+       {
+         me->warning (_f ("No glyph found for alteration: %s",
+                          ly_scm2rational (alt).to_string ().c_str ()));
+         continue;
+       }
+      
       Stencil acc (fm->find_by_name (ly_scm2string (glyph_name)));
 
       if (acc.is_empty ())
index da5bdcd1003a5591252d80f0875908b1fad4db6d..c4246b6589e5097c0626314e37b5f0338edc63ef 100644 (file)
     (KeyCancellation
      . (
        (stencil . ,ly:key-signature-interface::print)
+       (glyph-name-alist . ,cancellation-glyph-name-alist)
        (space-alist . (
                        (time-signature . (extra-space . 1.25))
                        (staff-bar . (extra-space . 0.6))
index 3360fbb80851a9590c92514c9df00439e0ecb901..42ec6932e750c1be0870da1911a8eea52b6d27d8 100644 (file)
@@ -354,16 +354,24 @@ centered, X==1 is at the right, X == -1 is at the left."
 (define-public (accidental-interface::calc-alteration grob)
   (ly:pitch-alteration  (ly:event-property (event-cause grob) 'pitch)))
 
+
+(define-public cancellation-glyph-name-alist
+  '((0 . "accidentals.natural")))
+
 (define-public standard-alteration-glyph-name-alist
-     '((1 . "accidentals.doublesharp")
-       (3/4 . "accidentals.sharp.slashslash.stemstemstem")
+     '(
+       ;; ordered for optimal performance.
+       (0 . "accidentals.natural")
+       (-1/2 . "accidentals.flat")
        (1/2 . "accidentals.sharp")
+
+       (1 . "accidentals.doublesharp")
+       (-1 . "accidentals.flatflat")
+       
+       (3/4 . "accidentals.sharp.slashslash.stemstemstem")
        (1/4 . "accidentals.sharp.slashslash.stem")
-       (0 . "accidentals.natural")
        (-1/4 . "accidentals.mirroredflat")
-       (-1/2 . "accidentals.flat")
        (-3/4 . "accidentals.mirroredflat.flat")
-       (-1 . "accidentals.flatflat")
        ))
 
 (define-public makam-alteration-glyph-name-alist