* scm/grob-property-description.scm (beam-space): Junk.
* lily/beam.cc (space_function): New method.
(get_interbeam): Call space-function.
* scm/grob-description.scm (Beam): Initialize space-function with
Beam::space_function.
* ly/grace-init.ly (startGraceMusic, stopGraceMusic): Set/revert
Beam.space-function. Don't quantise grace beams.
+2002-04-24 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * input/mozart-hrn3-defs.ly (startGraceContext): Customize grace init.
+
+ * scm/grob-property-description.scm (beam-space): Junk.
+
+ * lily/beam.cc (space_function): New method.
+ (get_interbeam): Call space-function.
+
+ * scm/grob-description.scm (Beam): Initialize space-function with
+ Beam::space_function.
+
+ * ly/grace-init.ly (startGraceMusic, stopGraceMusic): Set/revert
+ Beam.space-function. Don't quantise grace beams.
+
2002-04-23 Han-Wen Nienhuys <hanwen@cs.uu.nl>
* mf/feta-nummer-code.mf (code): tweaks for three, fixes for 6
\property Voice.crescendoSpanner = #'dashed-line
}
+startGraceContextOrig = \startGraceContext
+
+startGraceContext = {
+ %% Huh?
+ %% \startGraceContextOrig
+
+
+ %%URG copy from original
+ \property Voice.Stem \override #'direction = #1
+ \property Voice.Stem \override #'length = #6
+ \property Voice.Stem \override #'lengths =
+ #(map (lambda (x) (* 0.8 x)) '(3.5 3.5 3.5 4.5 5.0))
+ \property Voice.Stem \override #'beamed-lengths =
+ #(map (lambda (x) (* 0.8 x)) '(0.0 2.5 2.0 1.5))
+ \property Voice.Stem \override #'beamed-minimum-lengths =
+ #(map (lambda (x) (* 0.8 x)) '(0.0 1.5 1.25 1.0))
+ \property Voice.Stem \override #'no-stem-extend = ##t
+ \property Voice.Stem \override #'flag-style = #"grace"
+ \property Voice.Beam \override #'thickness = #0.384
+
+ %% Instead of calling Beam::space_function, we should invoke
+ %% the previously active beam function...
+ \property Voice.Beam \override #'space-function =
+ #(lambda (beam mult) (* 0.8 (Beam::space_function beam mult)))
+
+ \property Voice.Beam \override #'position-callbacks =
+ #`(,Beam::least_squares
+ ,Beam::check_concave
+ ,Beam::slope_damping)
+
+ % Can't use Staff.fontSize, since time sigs, keys sigs, etc. will
+ % be smaller as well.
+
+ \property Voice.fontSize = #-2
+ \property Staff.Accidentals \override #'font-relative-size = #-2
+ \property Voice.Slur \override #'direction = #-1
+ %% end copy
+
+
+ \property Voice.Beam \revert #'space-function
+ \property Voice.Beam \override #'space-function
+ = #(lambda (beam mult) (* 0.8 0.8))
+ \property Voice.Beam \revert #'thickness
+ \property Voice.Beam \override #'thickness = #(* 0.384 (/ 0.6 0.48))
+}
+
\paper{
\stylesheet #my-sheet
\translator {
MultiMeasureRest \override #'number-threshold = #1
Beam \override #'thickness = #0.6
- Beam \override #'beam-space = #0.8
+ Beam \override #'space-function = #(lambda (beam mult) 0.8)
Slur \override #'beautiful = #0.3
}
\translator {
add_bound_item (dynamic_cast<Spanner*> (me), dynamic_cast<Item*> (s));
}
-
-/*
- TODO: fix this for grace notes.
- */
Real
Beam::get_interbeam (Grob *me)
{
- int multiplicity = get_multiplicity (me);
- Real ss = Staff_symbol_referencer::staff_space (me);
-
- SCM s = me->get_grob_property ("beam-space");
- if (gh_number_p (s))
- return gh_scm2double (s) * ss;
- else if (s != SCM_EOL && gh_list_p (s))
- return gh_scm2double (scm_list_ref (s,
- gh_int2scm (multiplicity - 1
- <? scm_ilength (s) - 1)))
- * ss;
-
- Real slt = me->paper_l ()->get_var ("linethickness");
- Real thickness = gh_scm2double (me->get_grob_property ("thickness")) * ss;
-
- Real interbeam = multiplicity < 4
- ? (2*ss + slt - thickness) / 2.0
- : (3*ss + slt - thickness) / 3.0;
-
- return interbeam;
+ SCM func = me->get_grob_property ("space-function");
+ SCM s = gh_call2 (func, me->self_scm (), gh_int2scm (get_multiplicity (me)));
+ return gh_scm2double (s);
}
int
return m;
}
+MAKE_SCHEME_CALLBACK (Beam, space_function, 2);
+SCM
+Beam::space_function (SCM smob, SCM multiplicity)
+{
+ Grob *me = unsmob_grob (smob);
+
+ Real staff_space = Staff_symbol_referencer::staff_space (me);
+ Real line = me->paper_l ()->get_var ("linethickness");
+ Real thickness = gh_scm2double (me->get_grob_property ("thickness"))
+ * staff_space;
+
+ Real interbeam = gh_scm2int (multiplicity) < 4
+ ? (2*staff_space + line - thickness) / 2.0
+ : (3*staff_space + line - thickness) / 3.0;
+
+ return gh_double2scm (interbeam);
+}
+
+
/* After pre-processing all directions should be set.
Several post-processing routines (stem, slur, script) need stem/beam
direction.
take the best scoring combination.
",
- "position-callbacks beam-space concaveness-gap concaveness-threshold dir-function quant-score auto-knee-gap gap chord-tremolo beamed-stem-shorten shorten least-squares-dy direction damping flag-width-function neutral-direction positions thickness");
+ "position-callbacks concaveness-gap concaveness-threshold dir-function quant-score auto-knee-gap gap chord-tremolo beamed-stem-shorten shorten least-squares-dy direction damping flag-width-function neutral-direction positions space-function thickness");
static void set_stemlens (Grob*);
static int get_multiplicity (Grob*me);
static Real get_interbeam (Grob*me);
- DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
- DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
- DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (space_function, (SCM, SCM));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
+ DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
+ DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
/* position callbacks */
DECLARE_SCHEME_CALLBACK (least_squares, (SCM));
\property Voice.Stem \override #'no-stem-extend = ##t
\property Voice.Stem \override #'flag-style = #"grace"
\property Voice.Beam \override #'thickness = #0.384
+
+ %% Instead of calling Beam::space_function, we should invoke
+ %% the previously active beam function...
+ \property Voice.Beam \override #'space-function =
+ #(lambda (beam mult) (* 0.8 (Beam::space_function beam mult)))
+
+ \property Voice.Beam \override #'position-callbacks =
+ #`(,Beam::least_squares
+ ,Beam::check_concave
+ ,Beam::slope_damping)
% Can't use Staff.fontSize, since time sigs, keys sigs, etc. will
% be smaller as well.
\property Voice.Stem \revert #'lengths
\property Voice.Stem \revert #'length
\property Voice.Stem \revert #'direction
+ \property Voice.Beam \revert #'space-function
+
+ \property Voice.Beam \revert #'position-callbacks
% Can't use Staff.fontSize, since time sigs, keys sigs, etc. will
% be smaller as well.
(damping . 1)
(auto-knee-gap . 7)
(font-name . "cmr10")
+ (space-function . ,Beam::space_function)
(meta . ((interfaces . (staff-symbol-referencer-interface beam-interface))))
))
(grob-property-description 'shortest-duration-space number? "Start
with this much space for the shortest duration. This is explessed in @code{spacing-increment} as unit. See also
@ref{spacing-spanner-interface}.")
-(grob-property-description 'spacing-increment number? "Add this much space for a doubled duration. Typically, the width of a note head. See also @ref{spacing-spanner-interface}.")
-
(grob-property-description 'arpeggio ly-grob? "pointer to arpeggio object.")
(grob-property-description 'arpeggio-direction dir? "If set, put an
arrow on the arpeggio squiggly line.")
(grob-property-description 'bass list? " musical-pitch, optional.")
(grob-property-description 'beam ly-grob? "pointer to the beam, if applicable.")
(grob-property-description 'beam-thickness number? "thickness, measured in staffspace.")
-(grob-property-description 'beam-space (or number? list?) "the vertical distance between two beams, indexed by multiplicity")
(grob-property-description 'beam-width number? "width of the tremolo sign.")
(grob-property-description 'beamed-lengths list? "list of stem lengths given beam multiplicity .")
(grob-property-description 'beamed-minimum-lengths list? "list of minimum stem lengths given beam multiplicity.")
(grob-property-description 'space-alist list? "Alist of break align
spacing tuples: format = (SYMBOL . (TYPE . DISTANCE)), where TYPE can be
minimum-space or extra-space.")
+(grob-property-description 'space-function procedure? "return interbeam space given Beam grob and multiplicity.")
+(grob-property-description 'spacing-increment number? "Add this much space for a doubled duration. Typically, the width of a note head. See also @ref{spacing-spanner-interface}.")
(grob-property-description 'spacing-procedure procedure? "procedure
taking grob as argument. This is called after