Fixes Issue 1504, allowing feather beam line breaking.
[lilypond/patrick.git] / lily / font-size-engraver.cc
blobc95e104c87dc7d95208f6fe0be0a354877c645c0
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2001--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "grob.hh"
21 #include "engraver.hh"
23 class Font_size_engraver : public Engraver
26 TRANSLATOR_DECLARATIONS (Font_size_engraver);
27 protected:
28 DECLARE_ACKNOWLEDGER (font);
29 void process_music ();
30 Real size;
31 private:
34 Font_size_engraver::Font_size_engraver ()
36 size = 0.0;
39 void
40 Font_size_engraver::process_music ()
42 size = robust_scm2double (get_property ("fontSize"), 0.0);
45 void
46 Font_size_engraver::acknowledge_font (Grob_info gi)
49 We only want to process a grob once.
51 if (!size)
52 return;
54 if (gi.context () != context ())
55 return;
57 Real font_size = size
58 + robust_scm2double (gi.grob ()->get_property ("font-size"), 0);
59 gi.grob ()->set_property ("font-size", scm_from_double (font_size));
62 #include "translator.icc"
64 ADD_ACKNOWLEDGER (Font_size_engraver, font);
65 ADD_TRANSLATOR (Font_size_engraver,
66 /* doc */
67 "Put @code{fontSize} into @code{font-size} grob property.",
69 /* create */
70 "",
72 /* read */
73 "fontSize ",
75 /* write */