]> git.donarmstrong.com Git - lilypond.git/blob - lily/font-size-engraver.cc
Run `make grand-replace'.
[lilypond.git] / lily / font-size-engraver.cc
1 /*
2   font-size-engraver.cc -- implement Font_size_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2001--2008  Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #include "grob.hh"
10 #include "engraver.hh"
11
12 class Font_size_engraver : public Engraver
13 {
14
15   TRANSLATOR_DECLARATIONS (Font_size_engraver);
16 protected:
17   DECLARE_ACKNOWLEDGER (font);
18   void process_music ();
19   Real size;
20 private:
21 };
22
23 Font_size_engraver::Font_size_engraver ()
24 {
25   size = 0.0;
26 }
27
28 void
29 Font_size_engraver::process_music ()
30 {
31   size = robust_scm2double (get_property ("fontSize"), 0.0);
32 }
33
34 void
35 Font_size_engraver::acknowledge_font (Grob_info gi)
36 {
37   /*
38     We only want to process a grob once.
39   */
40   if (!size)
41     return;
42
43   if (gi.context () != context ())
44     return;
45
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));
49 }
50
51 #include "translator.icc"
52
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.",
57
58                 /* create */
59                 "",
60
61                 /* read */
62                 "fontSize ",
63
64                 /* write */
65                 ""
66                 );