Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / lily / font-size-engraver.cc
blobb9dfb058ef1d8e18138313b643b5b70a3f243623
1 /*
2 font-size-engraver.cc -- implement Font_size_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2001--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "grob.hh"
10 #include "engraver.hh"
12 class Font_size_engraver : public Engraver
15 TRANSLATOR_DECLARATIONS (Font_size_engraver);
16 protected:
17 DECLARE_ACKNOWLEDGER (font);
18 void process_music ();
19 Real size;
20 private:
23 Font_size_engraver::Font_size_engraver ()
25 size = 0.0;
28 void
29 Font_size_engraver::process_music ()
31 size = robust_scm2double (get_property ("fontSize"), 0.0);
34 void
35 Font_size_engraver::acknowledge_font (Grob_info gi)
38 We only want to process a grob once.
40 if (!size)
41 return;
43 if (gi.context () != context ())
44 return;
46 Real font_size = size
47 + robust_scm2double (gi.grob ()->get_property ("font-size"), 0);
48 gi.grob ()->set_property ("font-size", scm_from_double (font_size));
51 #include "translator.icc"
53 ADD_ACKNOWLEDGER (Font_size_engraver, font);
54 ADD_TRANSLATOR (Font_size_engraver,
55 /* doc */
56 "Put @code{fontSize} into @code{font-size} grob property.",
58 /* create */
59 "",
61 /* read */
62 "fontSize ",
64 /* write */