* lily/include/lily-guile.hh: many new ly_ functions. Thanks to
[lilypond.git] / lily / font-size-engraver.cc
blobf26b17ce4249b178331fa94853de7827a3bc0b27
1 /*
2 font-size-engraver.cc -- implement Font_size_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2001--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include "grob.hh"
11 #include "engraver.hh"
13 class Font_size_engraver : public Engraver
16 TRANSLATOR_DECLARATIONS (Font_size_engraver);
17 protected:
18 virtual void acknowledge_grob (Grob_info gi);
19 private:
23 Font_size_engraver::Font_size_engraver ()
28 void
29 Font_size_engraver::acknowledge_grob (Grob_info gi)
31 SCM sz = get_property ("fontSize");
34 We only want to process a grob once.
36 if (gi.origin_trans_->daddy_context_ != daddy_context_)
37 return ;
39 if (ly_number_p (sz) && ly_scm2double (sz))
41 Real font_size = ly_scm2double (sz);
43 font_size += robust_scm2double (gi.grob_->get_property ("font-size"), 0);
44 gi.grob_->set_property ("font-size", scm_make_real (font_size));
49 ENTER_DESCRIPTION (Font_size_engraver,
50 /* descr */ "Puts fontSize into font-relative-size grob property.",
51 /* creats*/ "",
52 /* accepts */ "",
53 /* acks */ "font-interface",
54 /* reads */ "fontSize",
55 /* write */ "");