]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/output-def.hh
Run grand-replace (issue 3765)
[lilypond.git] / lily / include / output-def.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1997--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef OUTPUT_DEF_HH
21 #define OUTPUT_DEF_HH
22
23 #include "lily-proto.hh"
24 #include "virtual-methods.hh"
25 #include "smobs.hh"
26 #include "input.hh"
27
28 /*
29   Output settings for a block of music.
30
31   This devolved into a rather empty class. The distinction between
32   various instances is made in the parser, which creates
33   midi/layout/paper blocks depending on the keyword read.
34
35   The data structure is set up as recursive: the definitions not
36   supplied in layout are looked up in paper. This is done through
37   the parent_ field of Output_def. However, such nesting is limited to
38   two levels,
39
40   * first because the parser hard-codes the different types
41   of output block.
42
43   * Second, because the prime benefit of multiple levels
44   (eg. paper containing layout for a score, containing layout of a
45   \score embedded in \markup) requires scaling the Stencils (eg. the
46   one coming from score at markup level)
47   
48  */
49 class Output_def   
50 {
51
52 public:
53   VIRTUAL_COPY_CONSTRUCTOR (Output_def, Output_def);
54   DECLARE_SMOBS (Output_def);
55
56 public:
57   SCM scope_;
58   Output_def *parent_;
59   
60   Input input_origin_;
61
62   Output_def (Output_def const&);
63   Output_def ();
64
65   /*
66     variables.
67    */
68   SCM c_variable (const string &id) const;
69   SCM lookup_variable (SCM sym) const;
70   void set_variable (SCM sym, SCM val);
71   void normalize ();
72   Real get_dimension (SCM symbol) const;
73 };
74 SCM get_font_table (Output_def *def);
75 void assign_context_def (Output_def *m, SCM transdef);
76 SCM find_context_def (Output_def const *m, SCM name);
77
78 Interval line_dimensions_int (Output_def *def, int);
79  
80
81 Font_metric *select_encoded_font (Output_def *layout, SCM chain);
82 Font_metric *select_font (Output_def *layout, SCM chain);
83
84 DECLARE_UNSMOB (Output_def, output_def);
85
86
87 Font_metric* find_pango_font (Output_def *layout,  SCM descr, Real factor);
88 Font_metric *find_scaled_font (Output_def *od, Font_metric *f,
89                                Real magnification);
90 Output_def *scale_output_def (Output_def *def, Real scale);
91
92 Real output_scale (Output_def*);
93
94 #endif /* OUTPUT_DEF_HH */