X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fkey-signature-interface.cc;h=f05dc7dabe9019dc3ef49de900d47420a79410da;hb=e94c4a66c9d565749d8a121fc0267ddeb423ca13;hp=1e673319612bb8fe3a428c5aed7fdf1ca2dbcf17;hpb=bcb3c657a4c434934327edf0fcdbdbaf7d5667dd;p=lilypond.git diff --git a/lily/key-signature-interface.cc b/lily/key-signature-interface.cc index 1e67331961..f05dc7dabe 100644 --- a/lily/key-signature-interface.cc +++ b/lily/key-signature-interface.cc @@ -1,11 +1,22 @@ /* - key-item.cc -- implement Key_signature_interface + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter - - (c) 1996--2007 Han-Wen Nienhuys + Copyright (C) 1996--2011 Han-Wen Nienhuys keyplacement by Mats Bengtsson + + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "accidental-interface.hh" @@ -36,13 +47,6 @@ Key_signature_interface::print (SCM smob) Real inter = Staff_symbol_referencer::staff_space (me) / 2.0; - SCM scm_style = me->get_property ("style"); - string style; - if (scm_is_symbol (scm_style)) - style = ly_symbol2string (scm_style); - else - style = ""; - Stencil mol; SCM c0s = me->get_property ("c0-position"); @@ -56,6 +60,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 +102,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; } } @@ -113,9 +126,10 @@ Key_signature_interface::print (SCM smob) ADD_INTERFACE (Key_signature_interface, "A group of accidentals, to be printed as signature sign.", + /* properties */ "alteration-alist " "c0-position " "glyph-name-alist " "padding " - "style " + "padding-pairs " );