From: Han-Wen Nienhuys Date: Tue, 11 Sep 2007 22:10:29 +0000 (+0200) Subject: Support for padding-pairs in KeySignature. X-Git-Tag: release/2.11.33-1~4^2~12^2~18 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1925ac1b4c79c3f1eb97c633f9a259648802220e;p=lilypond.git Support for padding-pairs in KeySignature. This allows for more fine grained spacing in microtonal key signatures. These typically combine different glyphs, with unusual spacing requirements. --- diff --git a/input/regression/key-signature-padding.ly b/input/regression/key-signature-padding.ly new file mode 100644 index 0000000000..e3726f32eb --- /dev/null +++ b/input/regression/key-signature-padding.ly @@ -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 +} diff --git a/lily/key-signature-interface.cc b/lily/key-signature-interface.cc index 1e67331961..ddf2fbbb64 100644 --- a/lily/key-signature-interface.cc +++ b/lily/key-signature-interface.cc @@ -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 " ); diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 754ebcb00e..4dff3a47a5 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -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