]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/output-def.hh
cb4400d8ce874c4579f18e598d94227288c15879
[lilypond.git] / lily / include / output-def.hh
1 /*
2   music-output-def.hh -- declare Output_def
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef MUSIC_OUTPUT_DEF_HH
10 #define MUSIC_OUTPUT_DEF_HH
11
12 #include "lily-proto.hh"
13 #include "virtual-methods.hh"
14 #include "smobs.hh"
15 #include "input.hh"
16
17 /*
18   Output settings for a block of music.
19
20   This devolved into a rather empty class. The distinction between
21   various instances is made in the parser, which creates
22   midi/layout/paper blocks depending on the keyword read.
23
24   The data structure is set up as recursive: the definitions not
25   supplied in layout are looked up in paper. This is done through
26   the parent_ field of Output_def. However, such nesting is limited to
27   two levels,
28
29   * first because the parser hard-codes the different types
30   of output block.
31
32   * Second, because the prime benefit of multiple levels
33   (eg. paper containing layout for a score, containing layout of a
34   \score embedded in \markup) requires scaling the Stencils (eg. the
35   one coming from score at markup level)
36   
37  */
38 class Output_def   
39 {
40
41 public:
42   VIRTUAL_COPY_CONSTRUCTOR (Output_def, Output_def);
43   DECLARE_SMOBS (Output_def);
44
45 public:
46   SCM scope_;
47   Output_def *parent_;
48   
49   Input input_origin_;
50   string user_key_;
51
52   Output_def (Output_def const&);
53   Output_def ();
54
55   /*
56     variables.
57    */
58   SCM c_variable (string id) const;
59   SCM lookup_variable (SCM sym) const;
60   void set_variable (SCM sym, SCM val);
61   Real get_dimension (SCM symbol) const;
62 };
63 SCM get_font_table (Output_def *def);
64 void assign_context_def (Output_def *m, SCM transdef);
65 SCM find_context_def (Output_def const *m, SCM name);
66
67 Interval line_dimensions_int (Output_def*def, int);
68  
69
70 Font_metric *select_encoded_font (Output_def *layout, SCM chain);
71 Font_metric *select_font (Output_def *layout, SCM chain);
72
73 DECLARE_UNSMOB (Output_def, output_def);
74
75
76 Font_metric* find_pango_font (Output_def *layout,  SCM descr, Real factor);
77 Font_metric *find_scaled_font (Output_def *od, Font_metric *f, Real magnification);
78 Output_def *scale_output_def (Output_def *def, Real scale);
79
80 Real output_scale (Output_def*);
81
82 #endif /* MUSIC_OUTPUT_DEF_HH */