]> git.donarmstrong.com Git - lilypond.git/commitdiff
Support for padding-pairs in KeySignature.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 11 Sep 2007 22:10:29 +0000 (00:10 +0200)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 11 Sep 2007 22:10:29 +0000 (00:10 +0200)
This allows for more fine grained spacing in microtonal key
signatures. These typically combine different glyphs, with unusual
spacing requirements.

input/regression/key-signature-padding.ly [new file with mode: 0644]
lily/key-signature-interface.cc
scm/define-grob-properties.scm

diff --git a/input/regression/key-signature-padding.ly b/input/regression/key-signature-padding.ly
new file mode 100644 (file)
index 0000000..e3726f3
--- /dev/null
@@ -0,0 +1,15 @@
+\header {
+
+  texidoc = "With the @code{padding-pairs} property, distances
+ between individual key signature items can be adjusted."
+
+}
+
+\version "2.11.32"
+
+{
+  \override Staff.KeySignature #'padding-pairs
+    = #'((("accidentals.flat" . "accidentals.sharp.slashslash.stemstemstem") . 0.5))
+    \set Staff.keySignature = #`((2 . ,SEMI-FLAT)  (6 . ,THREE-Q-SHARP) (4 . ,FLAT))
+  e2
+}
index 1e673319612bb8fe3a428c5aed7fdf1ca2dbcf17..ddf2fbbb640c30bc637cb909b41fc16d6e2d3986 100644 (file)
@@ -56,6 +56,9 @@ Key_signature_interface::print (SCM smob)
   */
 
   int last_pos = -1000;
+  SCM last_glyph_name = SCM_BOOL_F;
+  SCM padding_pairs = me->get_property ("padding-pairs");
+    
   Font_metric *fm = Font_interface::get_default_font (me);
   SCM alist = me->get_property ("glyph-name-alist");
 
@@ -95,13 +98,19 @@ Key_signature_interface::print (SCM smob)
          */
          Real padding = robust_scm2double (me->get_property ("padding"),
                                            0.0);
-         if (glyph_name ==  "accidentals.natural"
+         SCM handle = scm_assoc (scm_cons (glyph_name_scm, last_glyph_name),
+                                 padding_pairs);
+         if (scm_is_pair (handle))
+           padding = robust_scm2double (scm_cdr (handle), 0.0);
+         else if (glyph_name ==  "accidentals.natural"
              && last_pos < pos + 2
              && last_pos > pos - 6)
            padding += 0.3;
 
          mol.add_at_edge (X_AXIS, LEFT, acc, padding);
+         
          last_pos = pos;
+         last_glyph_name = glyph_name_scm;
        }
     }
 
@@ -117,5 +126,6 @@ ADD_INTERFACE (Key_signature_interface,
               "c0-position "
               "glyph-name-alist "
               "padding "
+              "padding-pairs "
               "style "
               );
index 754ebcb00e5682ea7b6824bc86e56b244ef250cd..4dff3a47a59154b3eb1c3949effe8b2fb8819504 100644 (file)
@@ -649,6 +649,7 @@ columns.")
      (note-head ,ly:grob? "A single note head.")
      (note-heads ,ly:grob-array? "A list of note head grobs.")
 
+     (padding-pairs ,list? "An alist mapping (@var{name} . @var{name}) to distances.")
      (pedal-text ,ly:grob? "A pointer to the text of a mixed-style piano
 pedal.")
      (pure-Y-common ,ly:grob? "A cache of the