Correct left text alignment of DynamicTextSpanner.
[lilypond.git] / lily / include / stencil.hh
blob63318a38b8fd7244381db95e028bf362638c4741
1 /*
2 stencil.hh -- declare Stencil
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8 #ifndef STENCIL_HH
9 #define STENCIL_HH
11 #include <cstdlib> // size_t
12 using namespace std;
14 #include "lily-proto.hh"
15 #include "box.hh"
16 #include "smobs.hh"
18 /** a group of individually translated symbols. You can add stencils
19 to the top, to the right, etc.
21 It is implemented as a "tree" of scheme expressions, as in
23 Expr = combine Expr-list
24 | translate Offset Expr
25 | origin (ORIGIN) Expr
26 | no-origin Expr
27 | (SCHEME)
30 SCHEME is a Scheme expression that --when eval'd-- produces the
31 desired output.
33 Notes:
35 * Because of the way that Stencil is implemented, it is the most
36 efficient to add "fresh" stencils to what you're going to build.
38 * Do not create Stencil objects on the heap. That includes passing
39 around Stencil* which are produced by unsmob_stencil(). Either
40 copy Stencil objects, or use SCM references.
42 * Empty stencils have empty dimensions. If add_at_edge is used to
43 init the stencil, we assume that
45 DIMENSIONS = (Interval (0, 0), Interval (0, 0)
47 class Stencil
49 Box dim_;
50 SCM expr_;
52 DECLARE_SIMPLE_SMOBS (Stencil);
53 public:
54 Stencil (Box, SCM s);
55 Stencil ();
57 SCM expr () const;
59 /**
60 Set dimensions to empty, or to (Interval (0, 0), Interval (0, 0) */
61 void set_empty (bool);
62 void add_at_edge (Axis a, Direction d, const Stencil &m, Real padding);
63 void add_stencil (Stencil const &m);
64 void translate (Offset);
65 Stencil translated (Offset) const;
66 void rotate (Real, Offset);
67 void rotate_degrees (Real, Offset);
68 void rotate_degrees_absolute (Real, Offset);
69 void align_to (Axis a, Real x);
70 void translate_axis (Real, Axis);
72 Interval extent (Axis) const;
73 Box extent_box () const;
74 bool is_empty () const;
75 Stencil in_color (Real r, Real g, Real b) const;
78 DECLARE_UNSMOB (Stencil, stencil);
80 void interpret_stencil_expression (SCM expr,
81 void (*func) (void *, SCM),
82 void *func_arg,
83 Offset o);
84 SCM find_expression_fonts (SCM expr);
86 void register_stencil_head (SCM symbol);
87 bool is_stencil_head (SCM symbol);
88 SCM all_stencil_heads ();
91 #endif /* STENCIL_HH */