]> git.donarmstrong.com Git - lilypond.git/blob - lily/font-size-engraver.cc
* flower
[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--2005  Han-Wen Nienhuys <hanwen@cs.uu.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   virtual void acknowledge_grob (Grob_info gi);
18 private:
19 };
20
21 Font_size_engraver::Font_size_engraver ()
22 {
23
24 }
25
26 void
27 Font_size_engraver::acknowledge_grob (Grob_info gi)
28 {
29   SCM sz = get_property ("fontSize");
30
31   /*
32     We only want to process a grob once.
33   */
34   if (gi.origin_trans_->context () != context ())
35     return;
36
37   if (scm_is_number (sz) && scm_to_double (sz))
38     {
39       Real font_size = scm_to_double (sz);
40
41       font_size += robust_scm2double (gi.grob_->get_property ("font-size"), 0);
42       gi.grob_->set_property ("font-size", scm_make_real (font_size));
43     }
44 }
45
46 ADD_TRANSLATOR (Font_size_engraver,
47                 /* descr */ "Puts fontSize into font-relative-size grob property.",
48                 /* creats*/ "",
49                 /* accepts */ "",
50                 /* acks  */ "font-interface",
51                 /* reads */ "fontSize",
52                 /* write */ "");