From c9c9947823c82ab38f426f107b283a308324166d Mon Sep 17 00:00:00 2001 From: hanwen Date: Wed, 21 Jan 2004 13:27:11 +0000 Subject: [PATCH] * lily/stem.cc (thickness): new function. * lily/staff-symbol.cc (get_ledger_line_thickness): new function: compute thickness from ledger-line-thickness. * lily/note-head.cc (brew_ledger_lines): use Staff_symbol::get_ledger_line_thickness (). * lily/beam.cc (rest_collision_callback): use Staff_symbol_referencer::staff_space(). * lily/parser.yy (My_lily_lexer): change syntax: \newpartcombine Mus1 Mus2 * lily/include/translator.hh (class Translator): add accepts_list_ so \with { \denies / \accepts } also works. * scm/music-functions.scm (determine-split-list): determine split list from music events. * lily/new-part-combine-iterator.cc: more states. * lily/moment.cc (LY_DEFINE): new function ly:moment + + * lily/stem.cc (thickness): new function. + + * lily/staff-symbol.cc (get_ledger_line_thickness): new function: + compute thickness from ledger-line-thickness. + + * lily/note-head.cc (brew_ledger_lines): use + Staff_symbol::get_ledger_line_thickness (). + + * lily/beam.cc (rest_collision_callback): use + Staff_symbol_referencer::staff_space(). + + * lily/parser.yy (My_lily_lexer): change syntax: \newpartcombine + Mus1 Mus2 + + * lily/include/translator.hh (class Translator): add accepts_list_ + so \with { \denies / \accepts } also works. + + * scm/music-functions.scm (determine-split-list): determine split + list from music events. + + * lily/new-part-combine-iterator.cc: more states. + + * lily/moment.cc (LY_DEFINE): new function ly:moment * lily/system.cc (set_loose_columns): use the right prebroken cols diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 83d2c3d9f3..28c3d46a26 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -1334,6 +1334,12 @@ Internals: @internalsref{Beam}. @cindex Automatic beams +@menu +* Manual beams:: +* Setting automatic beam behavior:: +@end menu + +@node Manual beams @subsection Manual beams @cindex beams, manual @cindex @code{]} @@ -1407,28 +1413,6 @@ Automatically kneed beams cannot be used together with hidden staves. -@menu -* Setting automatic beam behavior:: -@end menu - -@ignore -@no de Beam typography -@sub section Beam typography - -One of the strong points of LilyPond is how beams are formatted. Beams -are quantized, meaning that the left and right endpoints beams start -exactly on staff lines. Without quantization, small wedges of white -space appear between the beam and staff line, and this looks untidy. - -Beams are also slope-damped: melodies that go up or down should also -have beams that go up or down, but the slope of the beams should be -less than the slope of the notes themselves. - -Some beams should be horizontal. These are so-called concave beams. - -[TODO: some pictures.] -@end ignore - @node Setting automatic beam behavior @subsection Setting automatic beam behavior @@ -2146,7 +2130,7 @@ For finger changes, use markup texts: @cindex subscript You can use the thumb-script to indicate that a note should be -played with your thumb (used in cello music): +played with the thumb. (used in cello music): @lilypond[verbatim, singleline, fragment] 8(_\thumb )_\thumb @@ -2159,7 +2143,8 @@ of the chord by adding them after the pitches: < c-1 e-2 g-3 b-5 > 4 @end lilypond -Setting @code{fingeringOrientations} will put fingerings next +@noindent +In this case, setting @code{fingeringOrientations} will put fingerings next to note heads: @lilypond[verbatim,singleline,fragment,relative=1] @@ -2173,6 +2158,7 @@ to note heads: Internals: @internalsref{FingerEvent}, and @internalsref{Fingering}. +Examples: @inputfileref{input/regression,finger-chords.ly} @node Text scripts @subsection Text scripts @@ -3450,7 +3436,7 @@ The definition of lyrics mode is too complex. @node The Lyrics context @subsection The Lyrics context -Lyrics are printed by interpreting them in @internalsref{LyricsVoice} context: +Lyrics are printed by interpreting them in a @internalsref{LyricsVoice} context: @example \context LyricsVoice \lyrics @dots{} @end example @@ -3468,10 +3454,11 @@ melody and the lyrics with the @code{\lyricsto} expression: \lyricsto @var{name} \new LyricsVoice @dots{} @end example -This aligns the lyrics to the notes of the @internalsref{Voice} -context called @var{name}, which has to exist. Therefore, normally -the @code{Voice} is specified first, and then the lyrics are specified -with @code{\lyricsto}. +This aligns the lyrics to the +@c +notes of the @internalsref{Voice} context called @var{name}, which has +to exist. Therefore, normally the @code{Voice} is specified first, and +then the lyrics are specified with @code{\lyricsto}. For different or more complex orderings, the best way is to setup the hierarchy of staves and lyrics first, e.g. @@ -3488,7 +3475,41 @@ and then combine the appropriate melodies and lyric lines: \lyricsto "soprano" \new LyricsVoice @emph{the lyrics} @end example -An example is in @inputfileref{input/template,satb.ly}. +@noindent +The final input would resemble + +@example + << \context ChoirStaff \notes << @emph{setup the music} >> + \lyricsto "soprano" @emph{etc} + \lyricsto "alto" @emph{etc} + @emph{etc} + >> +@end example + + +The @code{\lyricsto} command detects melismata: it only puts one +syllable under a tied or slurred group of notes. If you want to force +an unslurred group of notes to be a melisma, then insert +@code{\melisma} after the first note of the group, and +@code{\melismaEnd} after the last one, e.g. + +@lilypond[relative 1, singleline, fragment,verbatim] +<< \context Voice = "lala" { \time 3/4 + f4 g8 + \melisma + f e f + \melismaEnd + e2 } + \lyricsto "lala" \new LyricsVoice \lyrics { + la di __ daah + } >> +@end lilypond + +In addition, notes are considered a melisma if they are manually +beamed, and automatic beaming (See @ref{Setting automatic beam +behavior}) is switched off. The criteria for deciding melismata +can be tuned with the property @code{melismaBusyProperties}. See +@internalsref{Melisma_engraver} for more information. When multiple stanzas are put on the same melody, it can happen that two stanzas have melismata in different locations. This can be @@ -3497,16 +3518,22 @@ remedied by switching off melismata for one the @code{ignoreMelismata} property to @code{#t}. An example is shown in @inputfileref{input/regression,lyric-combine-new.ly}. - @cindex SATB @cindex choral score A complete example of a SATB score setup is in the file @inputfileref{input/template,satb.ly}. +@refcommands + +@code{\melisma}, @code{\melismaEnd} +@cindex @code{\melismaEnd} +@cindex @code{\melisma} + @seealso -Internals: @internalsref{LyricCombineMusic}, @internalsref{Lyrics} +Internals: @internalsref{LyricCombineMusic}, @internalsref{Lyrics}, +@internalsref{Melisma_engraver}. Examples: @inputfileref{input/template,satb.ly}, @inputfileref{input/regression,lyric-combine-new.ly}. diff --git a/lily/beam.cc b/lily/beam.cc index c000147a33..e92c76ed7b 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -1474,7 +1474,8 @@ Beam::rest_collision_callback (SCM element_smob, SCM axis) Grob *common_x = rest->common_refpoint (beam, Y_AXIS); Real rest_dim = rest->extent (common_x, Y_AXIS)[d] / staff_space * d; - Real minimum_distance = robust_scm2double + Real minimum_distance = + staff_space * robust_scm2double (rest->get_grob_property ("minimum-beam-collision-distance"), 1); Real distance = beam_y - rest_dim; @@ -1483,20 +1484,23 @@ Beam::rest_collision_callback (SCM element_smob, SCM axis) shift = minimum_distance - distance; else if (minimum_distance > distance) shift = minimum_distance - distance; - - int stafflines = Staff_symbol_referencer::line_count (rest); + + shift /= staff_space; + + Real rad = Staff_symbol_referencer::line_count (rest) * staff_space / 2; /* Always move discretely by half spaces */ - Real discrete_shift = ceil (shift * 2.0) / 2.0; + shift = ceil (shift * 2.0) / 2.0; /* Inside staff, move by whole spaces*/ - if ((rest->extent (common_x, Y_AXIS)[d] + discrete_shift) * d - < stafflines / 2.0 - ||(rest->extent (common_x, Y_AXIS)[-d] + discrete_shift) * -d - < stafflines / 2.0) - discrete_shift = ceil (discrete_shift); + + if ((rest->extent (common_x, Y_AXIS)[d] + staff_space * shift) * d + < rad + || (rest->extent (common_x, Y_AXIS)[-d] + staff_space * shift) * -d + < rad) + shift = ceil (shift); - return gh_double2scm (-d * discrete_shift); + return gh_double2scm (-d * staff_space * shift); } bool diff --git a/lily/breathing-sign.cc b/lily/breathing-sign.cc index 006682be8a..0935effb82 100644 --- a/lily/breathing-sign.cc +++ b/lily/breathing-sign.cc @@ -45,10 +45,9 @@ Breathing_sign::divisio_minima (SCM smob) Grob *me = unsmob_grob (smob); Real staff_space = Staff_symbol_referencer::staff_space (me); Real staff_size; - Real thickness = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); - SCM lt = me->get_grob_property ("thickness"); - if (gh_number_p (lt)) - thickness *= gh_scm2double (lt); + + Real thickness = Staff_symbol_referencer::line_thickness (me); + thickness *= robust_scm2double (me->get_grob_property ("thickness"), 1.0); if (Staff_symbol_referencer::get_staff_symbol (me)) { staff_size = (Staff_symbol_referencer::line_count (me) - 1) * staff_space; @@ -79,10 +78,9 @@ Breathing_sign::divisio_maior (SCM smob) Grob *me = unsmob_grob (smob); Real staff_space = Staff_symbol_referencer::staff_space (me); Real staff_size; - Real thickness = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); - SCM lt = me->get_grob_property ("thickness"); - if (gh_number_p (lt)) - thickness *= gh_scm2double (lt); + Real thickness = Staff_symbol_referencer::line_thickness (me); + thickness *= robust_scm2double (me->get_grob_property ("thickness"), 1.0); + if (Staff_symbol_referencer::get_staff_symbol (me)) { staff_size = (Staff_symbol_referencer::line_count (me) - 1) * staff_space; @@ -120,10 +118,9 @@ Breathing_sign::divisio_maxima (SCM smob) Grob *me = unsmob_grob (smob); Real staff_space = Staff_symbol_referencer::staff_space (me); Real staff_size; - Real thickness = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); - SCM lt = me->get_grob_property ("thickness"); - if (gh_number_p (lt)) - thickness *= gh_scm2double (lt); + Real thickness = Staff_symbol_referencer::line_thickness (me); + thickness *= robust_scm2double (me->get_grob_property ("thickness"), 1.0); + if (Staff_symbol_referencer::get_staff_symbol (me)) { staff_size = (Staff_symbol_referencer::line_count (me) - 1) * staff_space; @@ -151,10 +148,9 @@ Breathing_sign::finalis (SCM smob) Grob *me = unsmob_grob (smob); Real staff_space = Staff_symbol_referencer::staff_space (me); Real staff_size; - Real thickness = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); - SCM lt = me->get_grob_property ("thickness"); - if (gh_number_p (lt)) - thickness *= gh_scm2double (lt); + Real thickness = Staff_symbol_referencer::line_thickness (me); + thickness *= robust_scm2double (me->get_grob_property ("thickness"), 1.0); + if (Staff_symbol_referencer::get_staff_symbol (me)) { staff_size = (Staff_symbol_referencer::line_count (me) - 1) * staff_space; diff --git a/lily/engraver.cc b/lily/engraver.cc index e4a6367216..65f161a9ce 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -37,6 +37,9 @@ Engraver::announce_grob (Grob* e, SCM cause) i.grob_ = e; if (!i.origin_trans_) i.origin_trans_ = this; + + + get_daddy_grav ()->announce_grob (i); } diff --git a/lily/event-chord-iterator.cc b/lily/event-chord-iterator.cc index c417e55917..ffb423bc66 100644 --- a/lily/event-chord-iterator.cc +++ b/lily/event-chord-iterator.cc @@ -25,7 +25,7 @@ Translator_group* Event_chord_iterator::get_req_translator () { assert (report_to ()); - if (report_to ()->is_bottom_translator_b ()) + if (report_to ()->is_bottom_context ()) return report_to (); set_translator (report_to ()->get_default_interpreter ()); diff --git a/lily/font-size-engraver.cc b/lily/font-size-engraver.cc index 369f1ca5bc..39174d47d4 100644 --- a/lily/font-size-engraver.cc +++ b/lily/font-size-engraver.cc @@ -25,25 +25,27 @@ Font_size_engraver::Font_size_engraver () } -/* - TODO: use fontSize = NUMBER as a scaling constant: find the closest - integer design size, and use magnification to do the fractional bit. -*/ void Font_size_engraver::acknowledge_grob (Grob_info gi) { SCM sz = get_property ("fontSize"); - if (gh_number_p (sz) - && gh_scm2double (sz) - && !gh_number_p (gi.grob_->get_grob_property ("font-size"))) + /* + We only want to process a grob once. + */ + if (gi.origin_trans_->daddy_trans_ != daddy_trans_) + return ; + + if (gh_number_p (sz) && gh_scm2double (sz)) { - gi.grob_->set_grob_property ("font-size", sz); + Real font_size = gh_scm2double (sz); + + font_size += robust_scm2double (gi.grob_->get_grob_property ("font-size"), 0); + gi.grob_->set_grob_property ("font-size", gh_double2scm (font_size)); } } - ENTER_DESCRIPTION(Font_size_engraver, /* descr */ "Puts fontSize into font-relative-size grob property.", /* creats*/ "", diff --git a/lily/hairpin.cc b/lily/hairpin.cc index 8693650018..f773673f4c 100644 --- a/lily/hairpin.cc +++ b/lily/hairpin.cc @@ -6,6 +6,7 @@ (c) 1997--2003 Han-Wen Nienhuys */ +#include "staff-symbol-referencer.hh" #include "molecule.hh" #include "line-interface.hh" #include "hairpin.hh" @@ -100,7 +101,8 @@ Hairpin::brew_molecule (SCM smob) } bool continued = broken[Direction (-grow_dir)]; - Real height = robust_scm2double (me->get_grob_property ("height"), 0.2); + Real height = robust_scm2double (me->get_grob_property ("height"), 0.2) * + Staff_symbol_referencer::staff_space (me); Real starth, endh; if (grow_dir < 0) diff --git a/lily/horizontal-bracket.cc b/lily/horizontal-bracket.cc index a172d85358..ce9283060b 100644 --- a/lily/horizontal-bracket.cc +++ b/lily/horizontal-bracket.cc @@ -51,14 +51,11 @@ Horizontal_bracket::brew_molecule (SCM smob) ext.unite (gs[0]->extent (cx, X_AXIS)); Direction d = get_grob_direction (me); - Real lt =me->get_paper()->get_realvar (ly_symbol2scm ("linethickness")); - Real t = lt; - SCM lthick = me->get_grob_property ("thickness"); - if (gh_number_p (lthick)) - t *= gh_scm2double (lthick); + Real thickness = Staff_symbol_referencer::line_thickness (me); + thickness *= robust_scm2double (me->get_grob_property ("thickness"), 1.0); - Molecule b = Lookup::bracket (X_AXIS, ext, t, - d* 1.0, lt); + Molecule b = Lookup::bracket (X_AXIS, ext, thickness, - d* 1.0, thickness/2); b.translate_axis ( - sp->get_bound (LEFT)->relative_coordinate (cx, X_AXIS), X_AXIS); diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index 19fed5950a..353d1fe798 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -160,6 +160,7 @@ Slice int_list_to_slice (SCM l); SCM ly_interval2scm (Drul_array); Real robust_scm2double (SCM, double); +int robust_scm2int (SCM, int); Drul_array robust_scm2drul (SCM, Drul_array); Interval robust_scm2interval (SCM, Drul_array); Offset robust_scm2offset (SCM, Offset); diff --git a/lily/include/staff-symbol-referencer.hh b/lily/include/staff-symbol-referencer.hh index d945de1492..24c8e099df 100644 --- a/lily/include/staff-symbol-referencer.hh +++ b/lily/include/staff-symbol-referencer.hh @@ -32,6 +32,7 @@ public: typeface. ie. leading is vertical space. */ + static Real line_thickness (Grob*); static Real staff_space (Grob*); static Grob * get_staff_symbol (Grob*); static bool on_staffline (Grob*); diff --git a/lily/include/staff-symbol.hh b/lily/include/staff-symbol.hh index a9fa51dccf..c27f633540 100644 --- a/lily/include/staff-symbol.hh +++ b/lily/include/staff-symbol.hh @@ -20,6 +20,9 @@ class Staff_symbol { public: static Real staff_space (Grob*) ; + static Real get_line_thickness (Grob*); + static Real get_ledger_line_thickness (Grob*); + static int get_steps (Grob*) ; static int line_count (Grob*); DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM )); diff --git a/lily/include/stem.hh b/lily/include/stem.hh index d4637beb42..05d07a7a1d 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -30,7 +30,7 @@ public: static void set_stemend (Grob *,Real); static Direction get_default_dir (Grob *); static Slice Stem::beam_multiplicity (Grob *); - + static Real thickness (Grob*); static int head_count (Grob *); static bool invisible_b (Grob *) ; static Interval head_positions (Grob *); diff --git a/lily/include/translator-def.hh b/lily/include/translator-def.hh index ad47f9781c..5c39d2a4f3 100644 --- a/lily/include/translator-def.hh +++ b/lily/include/translator-def.hh @@ -37,7 +37,7 @@ public: void add_context_mod (SCM); SCM default_child_context_name (); SCM get_context_name () const; - SCM get_accepted () const; + SCM get_accepted (SCM) const; SCM get_property_ops () const { return property_ops_; } SCM get_translator_names (SCM) const; void set_acceptor (SCM accepts, bool add); diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh index 7703529da1..4867c62a2b 100644 --- a/lily/include/translator-group.hh +++ b/lily/include/translator-group.hh @@ -57,7 +57,7 @@ public: void add_used_group_translator (Translator *trans); int get_depth () const; - bool is_bottom_translator_b () const; + bool is_bottom_context () const; bool is_removable () const; void terminate_translator (Translator*r); Translator *remove_translator (Translator*trans); diff --git a/lily/include/translator.hh b/lily/include/translator.hh index de045a56b3..466405aea8 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -59,7 +59,7 @@ public: SCM definition_; SCM properties_scm_; SCM trans_group_list_; - + SCM accepts_list_; virtual SCM get_simple_trans_list (); public: DECLARE_SMOBS (Translator, dummy); diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 559aec578f..a7c8b58919 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -751,3 +751,13 @@ robust_scm2offset (SCM k, Offset o) return o; } + + +int +robust_scm2int (SCM k, int o) +{ + if (scm_integer_p (k) == SCM_BOOL_T) + o = gh_scm2int (k); + + return o; +} diff --git a/lily/line-interface.cc b/lily/line-interface.cc index 41f272c90a..3340c8190d 100644 --- a/lily/line-interface.cc +++ b/lily/line-interface.cc @@ -71,9 +71,7 @@ Line_interface::make_line (Real th, Offset from, Offset to) Molecule Line_interface::line (Grob *me, Offset from, Offset to) { - Real thick = me->get_paper()->get_realvar (ly_symbol2scm ("linethickness")); - thick *= robust_scm2double (me->get_grob_property ("thickness"), 1.0); // todo: staff sym referencer? - + Real thick = Staff_symbol_referencer::line_thickness (me); SCM type = me->get_grob_property ("style"); SCM dash_fraction = me->get_grob_property ("dash-fraction"); diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc index 3b74fb1497..3daaab5557 100644 --- a/lily/line-spanner.cc +++ b/lily/line-spanner.cc @@ -30,7 +30,7 @@ zigzag_molecule (Grob *me, Real dx = dz[X_AXIS]; Real dy = dz[Y_AXIS]; - Real thick = me->get_paper()->get_realvar (ly_symbol2scm ("linethickness")); + Real thick = Staff_symbol_referencer::thickness (me); thick *= robust_scm2double (me->get_grob_property ("thickness"), 1.0); // todo: staff sym referencer? Real staff_space = Staff_symbol_referencer::staff_space (me); diff --git a/lily/measure-grouping-spanner.cc b/lily/measure-grouping-spanner.cc index 9af72c3405..55a5417f4c 100644 --- a/lily/measure-grouping-spanner.cc +++ b/lily/measure-grouping-spanner.cc @@ -22,10 +22,9 @@ Measure_grouping::brew_molecule (SCM grob) TODO: robustify. */ SCM which = me->get_grob_property ("style"); - SCM thick = me->get_grob_property ("thickness"); SCM height = me->get_grob_property ("height"); - Real t = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")) * gh_scm2double (thick); + Real t = Staff_symbol_referencer::thickness (me) * robust_scm2double (me->get_grob_property ("thickness")); Grob *common = me->get_bound(LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS); diff --git a/lily/melisma-engraver.cc b/lily/melisma-engraver.cc index d63150f7e3..360c1f57c2 100644 --- a/lily/melisma-engraver.cc +++ b/lily/melisma-engraver.cc @@ -29,7 +29,7 @@ Melisma_engraver::try_music (Music *) /* This can only be melisma-playing-event. */ - return melisma_busy (this); + return melisma_busy (this); } Melisma_engraver::Melisma_engraver() diff --git a/lily/mensural-ligature.cc b/lily/mensural-ligature.cc index 10fa80d31c..42e2638cca 100644 --- a/lily/mensural-ligature.cc +++ b/lily/mensural-ligature.cc @@ -143,34 +143,13 @@ internal_brew_primitive (Grob *me, bool ledger_take_space) Real staff_space = Staff_symbol_referencer::staff_space (me); if (primitive & MLP_ANY) { - SCM thickness_scm = me->get_grob_property ("thickness"); - if (thickness_scm != SCM_EOL) - { - thickness = gh_scm2double (thickness_scm); - } - else - { - programming_error (_f ("Mensural_ligature:" - "thickness undefined on flexa %d; assuming 1.4", - primitive)); - thickness = 1.4 * me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); - } + thickness = robust_scm2double ( me->get_grob_property ("thickness"), .14); } if (primitive & MLP_FLEXA) { - SCM delta_pitch_scm = me->get_grob_property ("delta-pitch"); - if (delta_pitch_scm != SCM_EOL) - { - delta_pitch = gh_scm2int (delta_pitch_scm); - } - else - { - programming_error (_f ("Mensural_ligature:" - "delta-pitch undefined on flexa %d; assuming 0", - primitive)); - delta_pitch = 0; - } + delta_pitch = robust_scm2int (me->get_grob_property ("delta-pitch"), + 0); flexa_width = robust_scm2double (me->get_grob_property ("flexa-width"), 2.0 * staff_space); } diff --git a/lily/moment.cc b/lily/moment.cc index d3c6703c39..14afed0907 100644 --- a/lily/moment.cc +++ b/lily/moment.cc @@ -102,6 +102,17 @@ LY_DEFINE (div_moment,"ly:div-moment", 2,0,0, (SCM a, SCM b), return (*ma / *mb).smobbed_copy(); } +LY_DEFINE (ly_moment_less_p,"ly:momentsubstitute_outlet (one_.report_to (), shared_.report_to ()); + first_iter_->substitute_outlet (null_.report_to (), shared_.report_to ()); second_iter_->substitute_outlet (two_.report_to (), shared_.report_to ()); + second_iter_->substitute_outlet (null_.report_to (), shared_.report_to ()); +} + + +void +New_pc_iterator::solo1 () +{ + first_iter_->substitute_outlet (null_.report_to (), shared_.report_to ()); + first_iter_->substitute_outlet (one_.report_to (), shared_.report_to ()); + + second_iter_->substitute_outlet (two_.report_to (), null_.report_to ()); + second_iter_->substitute_outlet (shared_.report_to (), null_.report_to ()); } +void +New_pc_iterator::unisono () +{ + /* + like solo1, but should set a2 string. + */ + first_iter_->substitute_outlet (null_.report_to (), shared_.report_to ()); + first_iter_->substitute_outlet (one_.report_to (), shared_.report_to ()); + + second_iter_->substitute_outlet (two_.report_to (), null_.report_to ()); + second_iter_->substitute_outlet (shared_.report_to (), null_.report_to ()); +} + + +void +New_pc_iterator::solo2 () +{ + second_iter_->substitute_outlet (null_.report_to (), shared_.report_to ()); + second_iter_->substitute_outlet (two_.report_to (), shared_.report_to ()); + + first_iter_->substitute_outlet (one_.report_to (), null_.report_to ()); + first_iter_->substitute_outlet (shared_.report_to (), null_.report_to ()); +} + + void New_pc_iterator::apart () { - first_iter_->substitute_outlet (shared_.report_to (),one_.report_to ()); + first_iter_->substitute_outlet (null_.report_to (), one_.report_to ()); + first_iter_->substitute_outlet (shared_.report_to (), one_.report_to ()); + + second_iter_->substitute_outlet (null_.report_to (), two_.report_to ()); second_iter_->substitute_outlet (shared_.report_to (), two_.report_to ()); } @@ -151,10 +196,19 @@ New_pc_iterator::construct_children () split_list_ = get_music ()->get_mus_property ("split-list"); SCM lst = get_music ()->get_mus_property ("elements"); + SCM props = scm_list_n (scm_list_n (ly_symbol2scm ("denies"), ly_symbol2scm ("Thread"), SCM_UNDEFINED), + scm_list_n (ly_symbol2scm ("consists"), ly_symbol2scm ("Rest_engraver"), SCM_UNDEFINED), + scm_list_n (ly_symbol2scm ("consists"), ly_symbol2scm ("Note_heads_engraver"), SCM_UNDEFINED), + SCM_UNDEFINED); + Translator_group *tr = report_to ()->find_create_translator (ly_symbol2scm ("Voice"), - "shared", SCM_EOL); + "shared",props); + Translator_group *null + = report_to ()->find_create_translator (ly_symbol2scm ("Devnull"), + "", SCM_EOL); + null_.set_translator (null); tr->execute_pushpop_property (ly_symbol2scm ("NoteHead"), ly_symbol2scm ("font-size"), gh_int2scm (3)); @@ -163,7 +217,7 @@ New_pc_iterator::construct_children () set_translator (tr); Translator_group *one = tr->find_create_translator (ly_symbol2scm ("Voice"), - "one", SCM_EOL); + "one", props); one_.set_translator (one); one->execute_pushpop_property (ly_symbol2scm ("Stem"), @@ -174,7 +228,7 @@ New_pc_iterator::construct_children () Translator_group *two = tr->find_create_translator (ly_symbol2scm ("Voice"), - "two", SCM_EOL); + "two", props); two_.set_translator (two); two_.report_to ()->execute_pushpop_property (ly_symbol2scm ("Stem"), ly_symbol2scm ("direction"), gh_int2scm (-1)); @@ -197,12 +251,23 @@ New_pc_iterator::process (Moment m) if (*splitm > now) break ; - if (gh_cdar (split_list_) == ly_symbol2scm ("together")) - together (); - else if (gh_cdar (split_list_) == ly_symbol2scm ("apart")) + SCM tag = gh_cdar (split_list_); + + if (tag == ly_symbol2scm ("chords")) + chords_together (); + else if (tag == ly_symbol2scm ("apart")) apart (); + else if (tag == ly_symbol2scm ("unisono")) + unisono (); + else if (tag == ly_symbol2scm ("solo1")) + solo1 (); + else if (tag == ly_symbol2scm ("solo2")) + solo2 (); else - programming_error ("Unknown split directive."); + { + String s = "Unknown split directive: " + ly_symbol2string (tag); + programming_error (s); + } } if (first_iter_->ok ()) diff --git a/lily/note-head.cc b/lily/note-head.cc index 5c8688ef19..d21be5b070 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -8,6 +8,7 @@ #include #include +#include "staff-symbol.hh" #include "misc.hh" #include "dots.hh" #include "note-head.hh" @@ -69,6 +70,7 @@ Note_head::brew_ledger_lines (Grob *me, Real left_shorten, bool take_space) { + Grob *staff = Staff_symbol_referencer::get_staff_symbol (me); Real inter_f = Staff_symbol_referencer::staff_space (me)/2; int line_count = (abs (pos) < interspaces) ? 0 @@ -79,9 +81,8 @@ Note_head::brew_ledger_lines (Grob *me, if (line_count) { Real ledgerlinethickness = - (me->get_paper ()->get_realvar (ly_symbol2scm ("ledgerlinethickness"))); + Staff_symbol::get_ledger_line_thickness (staff); Real blotdiameter = ledgerlinethickness; - // (me->get_paper ()->get_realvar (ly_symbol2scm ("blotdiameter"))); Interval y_extent = Interval (-0.5*(ledgerlinethickness), +0.5*(ledgerlinethickness)); diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc index 0cf786d751..3c6fca5803 100644 --- a/lily/note-spacing.cc +++ b/lily/note-spacing.cc @@ -355,8 +355,7 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn, if (st) { - Real thick = robust_scm2double (st->get_grob_property ("thickness"), 1) - * st->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); + Real thick = Stem::thickness (st); note_head_width -= thick; } diff --git a/lily/ottava-bracket.cc b/lily/ottava-bracket.cc index 2e991f7ec0..d5b3dd56c0 100644 --- a/lily/ottava-bracket.cc +++ b/lily/ottava-bracket.cc @@ -146,7 +146,12 @@ Ottava_bracket::brew_molecule (SCM smob) | | - */ + + Just a small amount, yes. In tight situations, it is even + possible to center the `8' directly below the note, dropping the + ottava line completely... + + */ b = Molecule (Box (b.extent (X_AXIS), Interval (0.1,0.1)), diff --git a/lily/parser.yy b/lily/parser.yy index fad5e954b7..dde4cfa58c 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1125,14 +1125,17 @@ part_combined_music: $$ = p; } - | NEWPARTCOMBINE embedded_scm Music Music { - Music * p= MY_MAKE_MUSIC("NewPartCombineMusic"); - p->set_mus_property ("elements", gh_list ($3->self_scm (),$4->self_scm (), SCM_UNDEFINED)); - p->set_mus_property ("split-list", $2); - scm_gc_unprotect_object ($3->self_scm ()); - scm_gc_unprotect_object ($4->self_scm ()); + | NEWPARTCOMBINE Music Music { + static SCM proc; + if (!proc) + proc = scm_c_eval_string ("make-new-part-combine-music"); - $$ = p; + SCM res = scm_call_1 (proc, gh_list ($2->self_scm (), + $3->self_scm (), SCM_UNDEFINED)); + scm_gc_unprotect_object ($3->self_scm ()); + scm_gc_unprotect_object ($2->self_scm ()); + $$ = unsmob_music (res); + scm_gc_protect_object (res); } ; diff --git a/lily/pitch.cc b/lily/pitch.cc index 25a1d97c57..d4f9aae48f 100644 --- a/lily/pitch.cc +++ b/lily/pitch.cc @@ -408,7 +408,7 @@ LY_DEFINE(pitch_less, "ly:pitchget_grob_property ("thickness"), 1) - * stem->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); + Real stem_thickness = Stem::thickness (stem); o += Offset (0.5 * x_extent * (1 + Stem::get_direction (stem)) - ((dir + 1)/2) * stem_thickness @@ -549,9 +547,7 @@ Slur::brew_molecule (SCM smob) } Real base_thick = robust_scm2double (me->get_grob_property ("thickness"), 1); - - Real thick = base_thick * - me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); + Real thick = base_thick * Staff_symbol_referencer::line_thickness (me); Real ss = Staff_symbol_referencer::staff_space (me); Bezier one = get_curve (me); diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index c59b50ce81..604eac7b3d 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -51,6 +51,16 @@ Staff_symbol_referencer::staff_space (Grob*me) return 1.0; } +Real +Staff_symbol_referencer::line_thickness (Grob*me) +{ + Grob * st = get_staff_symbol (me); + if (st) + return Staff_symbol::get_line_thickness (st); + + return me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); +} + Real Staff_symbol_referencer::get_position (Grob*me) { diff --git a/lily/staff-symbol.cc b/lily/staff-symbol.cc index 69a332b6a1..011e330c86 100644 --- a/lily/staff-symbol.cc +++ b/lily/staff-symbol.cc @@ -100,10 +100,27 @@ Staff_symbol::line_count (Grob*me) Real Staff_symbol::staff_space (Grob*me) { - return robust_scm2double ( me->get_grob_property ("staff-space"), 1.0); + return robust_scm2double ( me->get_grob_property ("staff-space"), 1.0); } +Real +Staff_symbol::get_line_thickness (Grob* me) +{ + Real lt = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); + + return robust_scm2double (me->get_grob_property ("thickness"), 1.0) * lt; +} + +Real +Staff_symbol::get_ledger_line_thickness (Grob * me) +{ + Real lt = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); + SCM lt_pair = me->get_grob_property ("ledger-line-thickness"); + Offset z = robust_scm2offset (lt_pair, Offset (1.0, 0.1)); + + return z[X_AXIS] * get_line_thickness(me) + z[Y_AXIS]* staff_space (me); +} ADD_INTERFACE (Staff_symbol,"staff-symbol-interface", @@ -111,5 +128,4 @@ ADD_INTERFACE (Staff_symbol,"staff-symbol-interface", "or space) is position 0. The length of the symbol may be set by hand " "through the @code{width} property. ", - "width staff-space thickness line-count"); - + "ledger-line-thickness width staff-space thickness line-count"); diff --git a/lily/stem.cc b/lily/stem.cc index cda3175f75..a8d9f390e2 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -451,8 +451,7 @@ Stem::position_noteheads (Grob*me) heads.reverse (); - Real thick = robust_scm2double (me->get_grob_property ("thickness"),1) - * me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); + Real thick = thickness (me); Grob *hed = support_head (me); Real w = Note_head::head_extent (hed,X_AXIS)[dir]; @@ -683,14 +682,17 @@ Stem::dim_callback (SCM e, SCM ax) else { r = flag (me).extent (X_AXIS) - + - gh_scm2double (me->get_grob_property ("thickness")) - * me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness"))/2; + + thickness (me)/2; } return ly_interval2scm (r); } - +Real +Stem::thickness (Grob* me) +{ + return gh_scm2double (me->get_grob_property ("thickness")) + * Staff_symbol_referencer::line_thickness (me); +} MAKE_SCHEME_CALLBACK (Stem,brew_molecule,1); @@ -700,11 +702,9 @@ Stem::brew_molecule (SCM smob) Grob*me = unsmob_grob (smob); Molecule mol; Direction d = get_direction (me); - - /* - TODO: make the stem start a direction ? + TODO: make the stem start a direction ? This is required to avoid stems passing in tablature chords... */ @@ -715,9 +715,7 @@ Stem::brew_molecule (SCM smob) return SCM_EOL; if (invisible_b (me)) - { - return SCM_EOL; - } + return SCM_EOL; Real y1 = Staff_symbol_referencer::get_position (lh); Real y2 = stem_end_position (me); @@ -742,8 +740,7 @@ Stem::brew_molecule (SCM smob) // URG - Real stem_width = robust_scm2double (me->get_grob_property ("thickness"), 1) - * me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); + Real stem_width = thickness (me); Real blot = me->get_paper ()->get_realvar (ly_symbol2scm ("blotdiameter")); @@ -805,8 +802,7 @@ Stem::off_callback (SCM element_smob, SCM) if (attach) { Real rule_thick - = robust_scm2double (me->get_grob_property ("thickness"), 1) - * me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); + = thickness (me); r += - d * rule_thick * 0.5; } diff --git a/lily/swallow-engraver.cc b/lily/swallow-engraver.cc index 989e78c271..674464220a 100644 --- a/lily/swallow-engraver.cc +++ b/lily/swallow-engraver.cc @@ -9,8 +9,6 @@ #include "engraver.hh" /** - This engraver swallows everything given to it silently. The purpose of - this is to prevent spurious "event junked" warnings. */ class Swallow_engraver : public Engraver { @@ -27,3 +25,16 @@ Swallow_engraver::try_music (Music*) { return true; } + +Swallow_engraver::Swallow_engraver () +{ +} + +ENTER_DESCRIPTION(Swallow_engraver, +/* descr */ "This engraver swallows everything given to it silently. The purpose of " + "this is to prevent spurious \"event junked\" warnings.", +/* creats*/ "", +/* accepts */ "general-music", +/* acks */ "", +/* reads */ "", +/* write */ ""); diff --git a/lily/tie.cc b/lily/tie.cc index bd569c4f87..ab1c43868f 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -330,9 +330,9 @@ Tie::brew_molecule (SCM smob) me->set_grob_property ("control-points", cp); } - Real thick = - gh_scm2double (me->get_grob_property ("thickness")) - * me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); + Real thick + = Staff_symbol_referencer::thickness (me) + * robust_scm2double (me->get_grob_property ("thickness"), 1); Bezier b; int i = 0; diff --git a/lily/translator-def.cc b/lily/translator-def.cc index d83364751f..8ace8f7f54 100644 --- a/lily/translator-def.cc +++ b/lily/translator-def.cc @@ -144,11 +144,12 @@ Context_def::get_context_name () const } SCM -Context_def::get_accepted () const +Context_def::get_accepted (SCM user_mod) const { - SCM correct_order = scm_reverse (accept_mods_); + SCM mods = scm_reverse_x (scm_list_copy (accept_mods_), + user_mod); SCM acc = SCM_EOL; - for (SCM s = correct_order; gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = mods; gh_pair_p (s); s = gh_cdr (s)) { SCM tag = gh_caar (s); SCM sym = gh_cadar (s); @@ -166,7 +167,7 @@ Context_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* odef { assert (gh_symbol_p (type_sym)); - SCM accepted = get_accepted (); + SCM accepted = get_accepted (SCM_EOL); Link_array accepteds; for (SCM s = accepted; gh_pair_p (s); s = ly_cdr (s)) @@ -263,7 +264,7 @@ Context_def::instantiate (Music_output_def* md, SCM ops) SCM trans_names = get_translator_names (ops); tg->simple_trans_list_ = names_to_translators (trans_names, tg); - + tg->accepts_list_ = get_accepted (ops); return tg; } @@ -284,17 +285,6 @@ Context_def::make_scm () return t->self_scm(); } - -/* - Default child context as a SCM string, or something else if there is - none. -*/ -SCM -Context_def::default_child_context_name () -{ - SCM d = get_accepted (); - return gh_pair_p (d) ? ly_car (scm_last_pair (d)) : SCM_EOL; -} void Context_def::apply_default_property_operations (Translator_group *tg) { @@ -310,7 +300,7 @@ Context_def::to_alist () const get_translator_names (SCM_EOL)), l); l = gh_cons (gh_cons (ly_symbol2scm ("description"), description_), l); l = gh_cons (gh_cons (ly_symbol2scm ("aliases"), context_aliases_), l); - l = gh_cons (gh_cons (ly_symbol2scm ("accepts"), get_accepted ()), l); + l = gh_cons (gh_cons (ly_symbol2scm ("accepts"), get_accepted (SCM_EOL)), l); l = gh_cons (gh_cons (ly_symbol2scm ("property-ops"), property_ops_), l); l = gh_cons (gh_cons (ly_symbol2scm ("context-name"), context_name_), l); l = gh_cons (gh_cons (ly_symbol2scm ("group-type"), translator_group_type_), l); diff --git a/lily/translator-group.cc b/lily/translator-group.cc index 503f2a7b47..ce1f205b07 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -131,6 +131,10 @@ Translator_group::find_create_translator (SCM n, String id, SCM operations) if (existing) return existing; + + /* + TODO: use accepts_list_. + */ Link_array path = unsmob_context_def (definition_)->path_to_acceptable_translator (n, get_output_def ()); @@ -212,18 +216,32 @@ Translator_group::remove_translator (Translator*trans) return trans; } + +/* + Default child context as a SCM string, or something else if there is + none. +*/ +SCM +default_child_context_name (Translator_group const *tg) +{ + return gh_pair_p (tg->accepts_list_) + ? ly_car (scm_last_pair (tg->accepts_list_)) + : SCM_EOL; +} + + bool -Translator_group::is_bottom_translator_b () const +Translator_group::is_bottom_context () const { - return !gh_symbol_p (unsmob_context_def (definition_)->default_child_context_name ()); + return !gh_symbol_p (default_child_context_name (this)); } Translator_group* Translator_group::get_default_interpreter () { - if (!is_bottom_translator_b ()) + if (!is_bottom_context ()) { - SCM nm = unsmob_context_def (definition_)->default_child_context_name (); + SCM nm = default_child_context_name (this); SCM st = get_output_def ()->find_translator (nm); Context_def *t = unsmob_context_def (st); @@ -235,7 +253,7 @@ Translator_group::get_default_interpreter () Translator_group *tg = t->instantiate (output_def_, SCM_EOL); add_fresh_group_translator (tg); - if (!tg->is_bottom_translator_b ()) + if (!tg->is_bottom_context ()) return tg->get_default_interpreter (); else return tg; diff --git a/lily/translator-scheme.cc b/lily/translator-scheme.cc index b387276157..a3966378bf 100644 --- a/lily/translator-scheme.cc +++ b/lily/translator-scheme.cc @@ -203,6 +203,12 @@ Translator::print_smob (SCM s, SCM port, scm_print_state *) else scm_display (ly_translator_name (s), port); + if (Translator_group *td=dynamic_cast (sc)) + { + scm_puts ("=", port); + scm_puts (td->id_string_.to_str0 (), port); + } + scm_display (sc->simple_trans_list_, port); /* diff --git a/lily/translator.cc b/lily/translator.cc index aac514c3a1..d978032365 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -28,6 +28,7 @@ Translator::init () properties_scm_ = SCM_EOL; definition_ = SCM_EOL; daddy_trans_ =0; + accepts_list_ = SCM_EOL; } Translator::Translator () @@ -126,6 +127,7 @@ Translator::mark_smob (SCM sm) scm_gc_mark (me->trans_group_list_); scm_gc_mark (me->definition_); scm_gc_mark (me->properties_scm_); + scm_gc_mark (me->accepts_list_); return me->properties_scm_; } diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index 9501413dd2..351eed8fef 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -197,7 +197,9 @@ Tuplet_bracket::brew_molecule (SCM smob) if (bracket_visibility) { - SCM gap = me->get_grob_property ("gap"); + Real ss = Staff_symbol_referencer::staff_space (me); + Real gap = robust_scm2double (me->get_grob_property ("gap"), 1.0) + * ss; SCM fl = me->get_grob_property ("bracket-flare"); SCM eh = me->get_grob_property ("edge-height"); @@ -208,20 +210,18 @@ Tuplet_bracket::brew_molecule (SCM smob) do { flare[d] = height[d] = shorten[d] = 0.0; if (is_number_pair (fl)) - flare[d] += gh_scm2double (index_get_cell (fl, d)); + flare[d] += ss * gh_scm2double (index_get_cell (fl, d)); if (is_number_pair (eh)) - height[d] += gh_scm2double (index_get_cell (eh, d)) * - dir; + height[d] += - dir * ss *gh_scm2double (index_get_cell (eh, d)); if (is_number_pair (sp)) - shorten[d] += gh_scm2double (index_get_cell (sp, d)); + shorten[d] += ss *gh_scm2double (index_get_cell (sp, d)); } while (flip (&d) != LEFT); Molecule brack = make_bracket (me, Y_AXIS, Offset (w, ry - ly), - height, - gh_scm2double (gap), - flare, - shorten); + height, gap, + flare, shorten); mol.add_molecule (brack); } @@ -296,7 +296,6 @@ Tuplet_bracket::calc_position_and_height (Grob*me,Real *offset, Real * dy) Grob * commonx = common_refpoint_of_list (cols, me, X_AXIS); Interval staff; - if (Grob * st = Staff_symbol_referencer::get_staff_symbol (me)) staff = st->extent (commony, Y_AXIS); diff --git a/ly/declarations-init.ly b/ly/declarations-init.ly index ad5d6ab836..3007e61932 100644 --- a/ly/declarations-init.ly +++ b/ly/declarations-init.ly @@ -110,6 +110,20 @@ paperTwentysix = \paper { \paper { \paperTwenty } + +partCombineListener = \paper { + \translator { + \VoiceContext + \denies Thread + \consists Note_heads_engraver + \consists Rest_engraver + \type "Recording_group_engraver" + recordEventSequence = #notice-the-events-for-pc + } +} + +#(set-part-combine-listener partCombineListener) + \include "dynamic-scripts-init.ly" \include "spanners-init.ly" diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 2ee75e7078..3a2feff62b 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -56,6 +56,7 @@ instr = #'() \accepts "Voice" + \accepts "Devnull" } @@ -118,8 +119,8 @@ \alias "Staff" BarLine \override #'bar-size = #4 - VoltaBracket \override #'minimum-space = #15 % urg, in \pt - VoltaBracket \override #'padding = #5 % urg, in \pt + VoltaBracket \override #'minimum-space = #15 + VoltaBracket \override #'padding = #5 StaffSymbol \override #'line-count = #1 Stem \override #'neutral-direction = #1 @@ -584,6 +585,13 @@ EasyNotation = \translator { \consistsend "Hara_kiri_engraver" } +\translator { + \name "Devnull" + \type "Engraver_group_engraver" + \consists "Swallow_engraver" + \description "Silently discards all musical information given to this context. " + } + \translator { \VoiceContext \name "TabVoice" @@ -591,7 +599,8 @@ EasyNotation = \translator { \consists "Tab_note_heads_engraver" \remove "Fingering_engraver" \remove "New_fingering_engraver" - + +\description "Context for drawing notes in a Tab staff. " Slur \override #'font-family = #'roman Slur \override #'molecule-callback = #hammer-molecule-callback Slur \override #'direction = #-1 diff --git a/mf/parmesan-heads.mf b/mf/parmesan-heads.mf index 0db8f40c69..1847e66311 100644 --- a/mf/parmesan-heads.mf +++ b/mf/parmesan-heads.mf @@ -184,7 +184,13 @@ fet_beginchar("Neo-mensural open head","0neo_mensural","neomensuralsemibrevishea draw_neo_mensural_open_head (staff_space#, noteheight#); fet_endchar; -fet_beginchar("Harmonic notehead (Neo-mensural open)","0harmonic","harmonichead") +% +% WL says the thin lines should be thinner. +% + +fet_beginchar("Harmonic notehead (Neo-mensural open)", + "0harmonic","harmonichead") + draw_neo_mensural_open_head (1.3 staff_space#, 1.3 noteheight#); charwx := head_width#; charwy := 0; diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 3550de13ce..b800070749 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -297,6 +297,9 @@ space to add. For barline, space after a thick line.") (grob-property-description 'knee-spacing-correction number? "optical correction amount for knees. 0: no correction; 1: full correction.") (grob-property-description 'layer number? "The output layer [0..2]. The default is 1.") +(grob-property-description 'ledger-line-thickness number-pair? + "The thickness of ledger lines: it is the sum of 2 numbers. + The car is the factor for linethickness, and the cdr for staff space. Both contributions are added.") (grob-property-description 'left-position number? "position of left part of spanner.") (grob-property-description 'left-padding ly:dimension? "space left of accs.") diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 4c9a5ff024..2b6a3bdd28 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -374,7 +374,7 @@ (self-alignment-Y . 0) (script-priority . 100) (font-family . number) - (font-size . -4) + (font-size . -5) ; don't overlap when next to heads. (font-shape . upright) (meta . ((interfaces . (finger-interface font-interface text-script-interface text-interface side-position-interface self-alignment-interface item-interface )))) )) @@ -875,6 +875,7 @@ . ( (molecule-callback . ,Staff_symbol::brew_molecule) (line-count . 5) + (ledger-line-thickness (1.0 . 0.1)) (layer . 0) (meta . ((interfaces . (staff-symbol-interface spanner-interface)))) )) diff --git a/scm/document-translation.scm b/scm/document-translation.scm index 25b08fc25f..858c17b6f0 100644 --- a/scm/document-translation.scm +++ b/scm/document-translation.scm @@ -241,8 +241,7 @@ grobs )) -(define (symbolstring l) (symbol->string r))) + (define (all-contexts-doc) (let* ( diff --git a/scm/lily.scm b/scm/lily.scm index a1d7552b1c..ba4fcd9eb3 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -24,7 +24,7 @@ (begin (debug-enable 'debug) (debug-enable 'backtrace) - (read-enable 'positions))) + (read-enable 'positions) )) (define-public (line-column-location line col file) @@ -296,6 +296,9 @@ L1 is copied, L2 not. 0 (if (< x 0) -1 1))) +(define-public (symbolstring l) (symbol->string r))) + (define-public (!= l r) (not (= l r))) @@ -380,6 +383,7 @@ L1 is copied, L2 not. "define-grob-interfaces.scm" "paper.scm" + "bla.scm" )) diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 24986145f0..27269d495e 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -794,9 +794,149 @@ Rest can contain a list of beat groupings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; +;; part-combiner. + + + +(define noticed '()) +(define part-combine-listener '()) +(define-public (set-part-combine-listener x) + (set! part-combine-listener x)) + +(define-public (notice-the-events-for-pc context lst) + (set! noticed (cons lst noticed))) + +(define-public (make-new-part-combine-music music-list) + (let* + ((m (make-music-by-name 'NewPartCombineMusic)) + (m1 (context-spec-music (car music-list) 'Voice "one")) + (m2 (context-spec-music (cadr music-list) 'Voice "two")) + (props '((denies Thread) + (consists Rest_engraver) + (consists Note_heads_engraver) + )) + ) + + + (ly:set-mus-property! m 'elements (list m1 m2)) + (ly:set-mus-property! m1 'property-operations props) + (ly:set-mus-property! m2 'property-operations props) + (ly:run-translator m2 part-combine-listener) + (ly:run-translator m1 part-combine-listener) + (ly:set-mus-property! m 'split-list + (determine-split-list (reverse (car noticed)) (reverse (cadr noticed)))) + (set! noticed '()) + + m)) + +(define-public (determine-split-list evl1 evl2) + "EVL1 and EVL2 should be ascending" + + (define ev1 (list->vector evl1)) + (define ev2 (list->vector evl2)) + (define (when v i) + (car (vector-ref v i))) + (define (what v i) + (cdr (vector-ref v i))) + + (define chord-threshold 8) + + (define result + (list->vector + (map (lambda (x) + (cons x 'together)) + (uniq-list + (merge (map car evl1) (map car evl2) ly:moment (length notes1) 1) (put 'apart)) + ((> (length notes2) 1) (put 'apart)) + (else + (let* ((diff (ly:pitch-diff (car pitches1) (car pitches1)))) + (if (< (ly:pitch-steps diff) chord-threshold) + (put 'chords) + (put 'apart)) + )))) + ) + (analyse-events (1+ i1) (1+ i2) (1+ ri) active1 active2)) + ))))) + + + (analyse-events 0 0 0 '() '()) + (display result) + (vector->list result)) -(define-public (determine-split-list ev1 ev2 state) -#f ) +; (determine-split-list '((1 . 2) (3 . 4)) '((1 . 2) (3 . 4))) -- 2.39.5