\context FiguredBass {
\figures {
<_! 3+ 5- _ 7! 9 >4
- < 4 6 >
+ < [4 6] >
}
}
--- /dev/null
+
+\header {
+
+ texidoc = "Repeated music can start with grace notes. Bar checks
+ preceding the grace notes do not cause synchronization effects. "
+
+}
+
+\score{
+ \notes\relative c'''{\key a \minor \time 2/4
+ \repeat "volta" 2 {
+ \grace { [a16( c] } c,4 c4 |
+ \grace { [e'16( gis] } c,4 c4 |
+
+ }
+ }
+ \paper { linewidth = -1. }
+ }
+
+
\header{
texidoc="
+
There are several ways to calculate the direction of a beam
@table @samp
\score {
\notes \relative c'' {
- % the default
- %\property Voice.Beam \set #'dir-function = #beam-dir-majority
+ \property Voice.Beam \set #'dir-function = #beam-dir-majority
[d8 a]
\property Voice.Beam \set #'dir-function = #beam-dir-mean
[d a]
if (where->main_part_)
{
music_l ()->origin ()->warning (_f ("barcheck failed at: %s",
- where->str ()));
- }
-
- if (!to_boolean (sync))
- {
- tr = tr->where_defined (ly_symbol2scm("measurePosition"));
- Moment zero;
- tr->set_property ("measurePosition", zero.smobbed_copy ());
+ where->str ()));
+ if (!to_boolean (sync))
+ {
+ tr = tr->where_defined (ly_symbol2scm("measurePosition"));
+ Moment zero;
+ tr->set_property ("measurePosition", zero.smobbed_copy ());
+ }
}
}
-}
-
+}
w = sneaky_insert_extra_moment (w);
- //cout << "Proccing " << w << endl;
+ // cout << "Proccing " << w << endl;
if (first)
{
public:
DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
- static SCM line_atom (Grob* me, Real dx, Real dy);
- static Molecule line_molecule (Grob* me, Real dx, Real dy);
+
+ static Molecule line_molecule (Grob* me, Real thick, Real dx, Real dy);
private:
static Offset get_broken_offset (Grob *me, Direction dir);
DECLARE_SCHEME_CALLBACK (unfolded_music_length, (SCM));
DECLARE_SCHEME_CALLBACK (volta_music_length, (SCM));
DECLARE_SCHEME_CALLBACK (folded_music_length, (SCM));
+ DECLARE_SCHEME_CALLBACK (minimum_start, (SCM));
+ DECLARE_SCHEME_CALLBACK (first_start, (SCM));
/// Transpose, with the interval central C to #p#
virtual void transpose (Pitch p);
#include <math.h>
-SCM
-Line_spanner::line_atom (Grob* me, Real dx, Real dy)
+
+/*
+ slightishly clumsy interface?
+
+ Make a Scheme expression for a line going from (0,0) to (dx,dy).
+ */
+
+static SCM
+line_atom (Grob* me, Real thick, Real dx, Real dy)
{
SCM type = me->get_grob_property ("type");
Real staff_space = Staff_symbol_referencer::staff_space (me);
- Real thick = me->paper_l ()->get_var ("stafflinethickness");
-
- SCM s = me->get_grob_property ("line-thickness");
- if (gh_number_p (s))
- thick *= gh_scm2double (s);
// maybe these should be in line-thickness?
Real length = staff_space;
- s = me->get_grob_property ("dash-length");
+ SCM s = me->get_grob_property ("dash-length");
if (gh_number_p (s))
length = gh_scm2double (s) * staff_space;
}
Molecule
-Line_spanner::line_molecule (Grob* me, Real dx, Real dy)
+Line_spanner::line_molecule (Grob* me, Real thick, Real dx, Real dy)
{
Molecule mol;
SCM type = me->get_grob_property ("type");
|| type == ly_symbol2scm ("dotted-line")
|| (type == ly_symbol2scm ("trill") && dy != 0)))
{
- Box b (Interval (0, dx), Interval (0, dy));
- mol = Molecule (b, line_atom (me, dx, dy));
+ Box b (Interval (-0.5* thick + (0 <? dx) ,0.5* thick+ (0 >? dx)),
+ Interval (- 0.5* thick + (0<? dy), 0.5*thick + (0 >? dy)));
+ mol = Molecule (b, line_atom (me, thick, dx, dy));
}
else if (gh_symbol_p (type)
&& type == ly_symbol2scm ("trill"))
Y_AXIS));
}
+
+ Real thick = me->paper_l ()->get_var ("stafflinethickness");
+
+ SCM s = me->get_grob_property ("line-thickness");
+ if (gh_number_p (s))
+ thick *= gh_scm2double (s);
+
- Molecule line = line_molecule (me, dxy[X_AXIS], dxy[Y_AXIS]);
+ Molecule line = line_molecule (me, thick, dxy[X_AXIS], dxy[Y_AXIS]);
line.translate_axis (bound[LEFT]->extent (bound[LEFT],
X_AXIS).length ()/2, X_AXIS);
line.translate (ofxy - my_off + his_off);
Moment
Music::start_mom () const
{
+ SCM l = get_mus_property ("start-moment-function");
+ if (gh_procedure_p (l))
+ {
+ SCM res = gh_call1 (l, self_scm ());
+ return *unsmob_moment (res);
+ }
+
Moment m ;
return m;
}
#include "music-list.hh"
#include "pitch.hh"
#include "debug.hh"
+#include "music-sequence.hh"
Music *
Repeated_music::body ()const
{
set_mus_property ("type", ly_symbol2scm ("repeated-music"));
}
+
+
+MAKE_SCHEME_CALLBACK (Repeated_music,minimum_start, 1);
+MAKE_SCHEME_CALLBACK (Repeated_music,first_start, 1);
+
+SCM
+Repeated_music::minimum_start (SCM m)
+{
+ Music * me = unsmob_music (m);
+ Music * body = unsmob_music (me->get_mus_property ("element"));
+
+ if (body)
+ return body->start_mom ().smobbed_copy();
+ else
+ {
+ return Music_sequence::minimum_start (me->get_mus_property ("elements")).smobbed_copy();
+ }
+}
+
+SCM
+Repeated_music::first_start (SCM m)
+{
+ Music * me = unsmob_music (m);
+ Music * body = unsmob_music (me->get_mus_property ("element"));
+
+ Moment rv = (body) ? body->start_mom () :
+ Music_sequence::first_start (me->get_mus_property ("elements"));
+
+ return rv.smobbed_copy ();
+}
return d;
}
+/*
+ Generate spacing for a single measure. We used to have code that did
+ per-measure spacing. Now we have piecewise spacing. We should fix
+ this to support "spacing-regions": some regions have different notes
+ (different time sigs) than others, and should be spaced differently.
+ */
void
Spacing_spanner::do_measure (Rational shortest, Grob*me, Link_array<Grob> *cols)
{
}
}
+
+/*
+ Generate the space between two musical columns LC and RC, given spacing parameters INCR and SHRTEST.
+ */
void
Spacing_spanner::musical_column_spacing (Grob *me, Item * lc, Item *rc, Real increment, Rational shortest)
{
/*
- text-spanner.cc -- implement Text_spanner
+text-spanner.cc -- implement Text_spanner
- source file of the GNU LilyPond music typesetter
+source file of the GNU LilyPond music typesetter
- (c) 2000--2002 Jan Nieuwenhuizen <janneke@gnu.org>
+(c) 2000--2002 Jan Nieuwenhuizen <janneke@gnu.org>
*/
#include "molecule.hh"
/*
TODO:
- - vertical start / vertical end (fixme-name) |
- - contination types (vert. star, vert. end) |-> eat volta-spanner
- - more styles
- - more texts/positions
- */
+ - vertical start / vertical end (fixme-name) |
+ - contination types (vert. star, vert. end) |-> eat volta-spanner
+ - more styles
+ - more texts/positions
+*/
MAKE_SCHEME_CALLBACK (Text_spanner, brew_molecule, 1);
+/*
+ TODO: this function is too long, too hairy.
+
+ TODO: document this. What the heck is happening here?
+*/
SCM
Text_spanner::brew_molecule (SCM smob)
{
if (!e.empty_b ())
r = e[-d] + padding;
/* Text spanners such as ottava, should span from outer limits of
- noteheads, iso (de)cresc. spanners that span the inner space */
+ noteheads, iso (de)cresc. spanners that span the inner space */
if (me->get_grob_property ("outer") != SCM_EOL)
// r *= -1; // huh?
{
width += gh_scm2double (me->get_grob_property ("width-correct"));
/* /Ugh */
+ // who is ecs? --hwn
SCM properties = Font_interface::font_alist_chain (me);
}
/* ugh */
- Real thick = me->paper_l ()->get_var ("stafflinethickness");
- Molecule line = Line_spanner::line_molecule (me, width, 0);
+ Real thick = me->paper_l ()->get_var ("stafflinethickness");
+ SCM st = me->get_grob_property ("thickness");
+ if (gh_number_p (st))
+ {
+ thick *= gh_scm2double (st);
+
+ }
+ Molecule line = Line_spanner::line_molecule (me, thick, width, 0);
Drul_array<Molecule> edge_line;
s = me->get_grob_property ("edge-height");
Real dy = gh_scm2double (index_cell (s, d)) * - dir;
if (dy)
{
- SCM list = Line_spanner::line_atom (me, dx, dy);
- Box b (Interval (-thick, 0),
- dy > 0
- ? Interval (0, dy)
- : Interval (dy, 0));
- edge_line[d] = Molecule (b, list);
+ edge_line[d] = Line_spanner::line_molecule (me, thick, dx, dy);
}
}
while (flip (&d) != LEFT);
if (!edge_line[LEFT].empty_b ())
m.add_at_edge (X_AXIS, RIGHT, edge_line[LEFT], 0);
if (!line.empty_b ())
- m.add_at_edge (X_AXIS, RIGHT, line, 0);
+ m.add_at_edge (X_AXIS, RIGHT, line,
+ edge_line[LEFT].empty_b () ? 0 : - thick/2);
if (!edge_line[RIGHT].empty_b ())
- m.add_at_edge (X_AXIS, RIGHT, edge_line[RIGHT], 0);
+ m.add_at_edge (X_AXIS, RIGHT, edge_line[RIGHT], -thick/2);
if (!edge[RIGHT].empty_b ())
m.add_at_edge (X_AXIS, RIGHT, edge[RIGHT], 0);
m.translate_axis (broken_left + extra_off[LEFT] + shorten[LEFT], X_AXIS);
*/
void
-Text_spanner::setup_pedal_bracket(Spanner *s)
+Text_spanner::setup_pedal_bracket(Spanner *me)
{
- Real thick = s->paper_l ()->get_var ("stafflinethickness");
+ Real thick = me->paper_l ()->get_var ("stafflinethickness");
+ SCM st = me->get_grob_property ("thickness");
+ if (gh_number_p (st))
+ {
+ thick *= gh_scm2double (st);
+ }
Drul_array<bool> w, broken;
Drul_array<Real> height, width, shorten, r;
- SCM pa = s->get_grob_property ("if-text-padding");
- SCM ew = s->get_grob_property ("edge-width");
- SCM eh = s->get_grob_property ("edge-height");
- SCM sp = s->get_grob_property ("shorten-pair");
- SCM wl = s->get_grob_property ("left-widen");
- SCM wr = s->get_grob_property ("right-widen");
+ SCM pa = me->get_grob_property ("if-text-padding");
+ SCM ew = me->get_grob_property ("edge-width");
+ SCM eh = me->get_grob_property ("edge-height");
+ SCM sp = me->get_grob_property ("shorten-pair");
+ SCM wl = me->get_grob_property ("left-widen");
+ SCM wr = me->get_grob_property ("right-widen");
// Pedal has an angled left edge \__ or an angled right edge __/
w[LEFT] = w[RIGHT] = false;
padding = gh_scm2double (pa);
do {
- Item *b = s->get_bound (d);
+ Item *b = me->get_bound (d);
e = b->extent (b, X_AXIS);
if (!e.empty_b ())
Real extra_short = 0;
// For 'Mixed' style pedals, i.e. a bracket preceded by text: Ped._____|
// need to shorten by the extent of the text grob
- if ( to_boolean (s->get_grob_property ("text-start")) )
+ if ( to_boolean (me->get_grob_property ("text-start")) )
{
height[LEFT] = 0;
- Grob * textbit = s->get_parent(Y_AXIS);
+ Grob * textbit = me->get_parent(Y_AXIS);
extra_short = padding;
if (textbit->has_interface(ly_symbol2scm("piano-pedal-interface")))
// for pretty Ped. scripts.
{
SCM text = textbit->get_grob_property("text");
if (gh_string_p (text)) {
- SCM properties = Font_interface::font_alist_chain (s);
- Molecule mol = Text_item::text2molecule (s, text, properties);
+ SCM properties = Font_interface::font_alist_chain (me);
+ Molecule mol = Text_item::text2molecule (me, text, properties);
extra_short += mol.extent(X_AXIS).length() / 2;
}
}
shorten[LEFT] += abs(width[LEFT]) * 2 + extra_short ;
if (broken[LEFT]) {
- shorten[LEFT] -= s->get_broken_left_end_align () ;
+ shorten[LEFT] -= me->get_broken_left_end_align () ;
shorten[RIGHT] -= r[RIGHT];
}
else
// Shorten bracket on the right so it ends just before the spanned note.
shorten[RIGHT] += thick - (r[LEFT] + r[RIGHT]);
- s->set_grob_property ("edge-height", gh_cons ( gh_double2scm ( height[LEFT] ) ,
- gh_double2scm ( height[RIGHT]) ) );
- s->set_grob_property ("edge-width", gh_cons ( gh_double2scm ( width[LEFT] ),
- gh_double2scm ( width[RIGHT] ) ));
- s->set_grob_property ("shorten-pair", gh_cons ( gh_double2scm ( shorten[LEFT] ),
- gh_double2scm ( shorten[RIGHT] ) ));
+ me->set_grob_property ("edge-height", gh_cons ( gh_double2scm ( height[LEFT] ) ,
+ gh_double2scm ( height[RIGHT]) ) );
+ me->set_grob_property ("edge-width", gh_cons ( gh_double2scm ( width[LEFT] ),
+ gh_double2scm ( width[RIGHT] ) ));
+ me->set_grob_property ("shorten-pair", gh_cons ( gh_double2scm ( shorten[LEFT] ),
+ gh_double2scm ( shorten[RIGHT] ) ));
}
\property Voice.Stem \override #'no-stem-extend = ##t
\property Voice.Stem \override #'flag-style = #"grace"
- \property Voice.Beam \override #'space-function = #grace-beam-space-function
\property Voice.Beam \override #'thickness = #0.384
% Can't use Staff.fontSize, since time sigs, keys sigs, etc. will
(let*
((supported-reps
`(("volta" . ((iterator-ctor . ,Volta_repeat_iterator::constructor)
+ (start-moment-function . ,Repeated_music::first_start)
(length . ,Repeated_music::volta_music_length)))
("unfold" . ((iterator-ctor . ,Unfolded_repeat_iterator::constructor)
- (length . ,Repeated_music::unfolded_music_length)))
+ (start-moment-function . ,Repeated_music::first_start)
+ (length . ,Repeated_music::unfolded_music_length)))
("fold" . ((iterator-ctor . ,Folded_repeat_iterator::constructor)
+ (start-moment-function . ,Repeated_music::minimum_start)
(length . ,Repeated_music::folded_music_length)))
("percent" . ((iterator-ctor . ,Percent_repeat_iterator::constructor)
+ (start-moment-function . ,Repeated_music::first_start)
(length . ,Repeated_music::unfolded_music_length)))
("tremolo" . ((iterator-ctor . ,Chord_tremolo_iterator::constructor)
+ (start-moment-function . ,Repeated_music::first_start)
(length . ,Repeated_music::unfolded_music_length)))))
(handle (assoc name supported-reps)))
(define (box-grob-molecule grob)
- "Make a box of exactly the extents of the grob."
+ "Make a box of exactly the extents of the grob. The box precisely
+encloses the contents.
+"
(let* ((xext (ly-get-extent grob grob 0))
(yext (ly-get-extent grob grob 1))
(mol (ly-make-molecule '() '(10000 . -10000) '(10000 . -10000)))
(thick 0.1)
)
- (display "hoi")
- (set! mol (ly-add-molecule mol (box-molecule xext (cons (car yext) (+ (car yext) thick)))))
- (set! mol (ly-add-molecule mol (box-molecule xext (cons (- (cdr yext) thick) (cdr yext)))))
- (set! mol (ly-add-molecule mol (box-molecule (cons (car xext) (+ (car xext) thick)) yext)))
- (set! mol (ly-add-molecule mol (box-molecule (cons (- (cdr xext) thick) (cdr xext)) yext)))
+
+ (set! mol (ly-add-molecule mol (box-molecule xext (cons (- (car yext) thick) (car yext) ))))
+ (set! mol (ly-add-molecule mol (box-molecule xext (cons (cdr yext) (+ (cdr yext) thick) ))))
+ (set! mol (ly-add-molecule mol (box-molecule (cons (cdr xext) (+ (cdr xext) thick)) yext)))
+ (set! mol (ly-add-molecule mol (box-molecule (cons (- (car xext) thick) (car xext)) yext)))
mol
))
(begin
(ly-set-mus-property
music 'length Repeated_music::unfolded_music_length)
+ (ly-set-mus-property
+ music 'start-moment-function Repeated_music::first_start)
(ly-set-mus-property
music 'iterator-ctor Unfolded_repeat_iterator::constructor)))
music))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
(define (pitchify-scripts music)
"Copy the pitch fields of the Note_requests into Text_script_requests, to aid
Fingering_engraver."
(music-property-description 'type symbol? "The type of this music object. Determines iteration in some cases.")
(music-property-description 'repeat-count integer? "do a @code{\repeat} how ofen?")
(music-property-description 'span-direction dir? "Does this start or stop a spanner?")
+
+(music-property-description 'start-moment-function procedure? "Function to compute the negative length of
+starting grace notes.")
+
(music-property-description 'symbol symbol? "Grob name to perform an override/revert on.")
(music-property-description 'text markup? "markup expression to be printed")
;; markup?
def get_bbox (filename):
- f = open (filename)
+ system ('gs -sDEVICE=bbox -q -sOutputFile=- -dNOPAUSE %s -c quit > %s.bbox 2>&1 ' % (filename, filename))
+
+ box = open (filename + '.bbox').read()
+ m = re.match ('^%%BoundingBox: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)', box)
gr = []
- while 1:
- l =f.readline ()
- m = re.match ('^%%BoundingBox: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)', l)
- if m:
- gr = map (string.atoi, m.groups ())
- break
+ if m:
+ gr = map (string.atoi, m.groups ())
return gr
def make_pixmap (name):
bbox = get_bbox (name + '.eps')
- margin = 3
+ margin = 0
fo = open (name + '.trans.eps' , 'w')
fo.write ('%d %d translate\n' % (-bbox[0]+margin, -bbox[1]+margin))
fo.close ()
$(MAKE) local-dist $(distdir)
chmod -R a+r $(distdir)
chmod a+x `find $(distdir) -type d -print`
- (cd ./$(depth)/$(outdir); $(TAR) cf - $(DIST_NAME) | gzip -9 > $(DIST_NAME).tar.gz)
+ (cd ./$(depth)/$(outdir); $(TAR) -cf - --owner=0 --group=0 $(DIST_NAME) | gzip -9 > $(DIST_NAME).tar.gz)
# ugh.
# Can't compare "stage1" dist with "stage2" dist in this way?
-ln -f $(depth)/$(outdir)/$(distname).tar.gz $(release-dir)