- {
- SCM what = scm_caar (s);
-
- SCM proc = ly_lily_module_constant ("key-signature-interface::alteration-position");
-
- int pos = scm_to_int (scm_call_3 (proc, what, scm_cdar (s), c0s));
- acc.translate_axis (pos * inter, Y_AXIS);
-
- /*
- The natural sign (unlike flat & sharp)
- has vertical edges on both sides. A little padding is
- needed to prevent collisions.
- */
- Real padding = 0.0;
- if (is_cancellation
- && last_pos < pos + 2
- && last_pos > pos - 6)
- padding = 0.3;
-
- mol.add_at_edge (X_AXIS, LEFT, acc, padding);
- last_pos = pos;
- }
+ {
+ SCM what = scm_caar (s);
+
+ SCM proc = ly_lily_module_constant ("key-signature-interface::alteration-position");
+
+ int pos = scm_to_int (scm_call_3 (proc, what, scm_cdar (s), c0s));
+ acc.translate_axis (pos * inter, Y_AXIS);
+
+ /*
+ The natural sign (unlike flat & sharp)
+ has vertical edges on both sides. A little padding is
+ needed to prevent collisions.
+ */
+ Real padding = robust_scm2double (me->get_property ("padding"),
+ 0.0);
+ 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;
+ }