From 09485b4edea2021626b3a6db6817a475d7e9d5ff Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 27 Mar 2002 01:21:03 +0000 Subject: [PATCH] lilypond-1.5.8 --- buildscripts/lys-to-tely.py | 8 +++- lily/all-font-metrics.cc | 4 +- lily/global-translator.cc | 2 +- lily/include/kpath.hh | 2 +- lily/kpath.cc | 29 +++++++++++--- lily/new-spacing-spanner.cc | 77 ++++++++++++++++++++++++------------ ps/music-drawing-routines.ps | 5 +++ scm/grob-description.scm | 2 +- tex/lily-ps-defs.tex | 5 ++- 9 files changed, 95 insertions(+), 39 deletions(-) diff --git a/buildscripts/lys-to-tely.py b/buildscripts/lys-to-tely.py index eac92934e8..22343a77a7 100644 --- a/buildscripts/lys-to-tely.py +++ b/buildscripts/lys-to-tely.py @@ -65,7 +65,7 @@ if files: if string.find (n, '+') >= 0: s = "@lilypondfile{%s}" % n else: - s = "@lilypondfile[printfilename]{%s}" % n + s = "@lilypondfile[printfilename,verbatim]{%s}" % n return s s = s + string.join (map (lambda x: name2line (x), files), "\n") @@ -76,4 +76,8 @@ if files: h.write (s) h.close () sys.stderr.write ('\n') - +else: + # not Unix philosophy, but hey, at least we notice when + # we don't distribute any .ly files. + sys.stderr.write ("No files specified. Doing nothing") + diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index 61a66c33bc..b198384426 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -52,8 +52,8 @@ All_font_metrics::find_afm (String name) if (path.empty_b ()) { - char * p = ly_find_afm (name.ch_C ()); - if (p) + String p = ly_find_afm (name.ch_C ()); + if (p.length_i ()) path = p; } diff --git a/lily/global-translator.cc b/lily/global-translator.cc index 4e4208bd82..d66b6f05e9 100644 --- a/lily/global-translator.cc +++ b/lily/global-translator.cc @@ -98,7 +98,7 @@ Global_translator::run_iterator_on_me (Music_iterator * iter) w = sneaky_insert_extra_moment (w); - // cout << "Proccing " << w << endl; + cout << "Proccing " << w << endl; if (first) diff --git a/lily/include/kpath.hh b/lily/include/kpath.hh index accc1f610a..02528c3e25 100644 --- a/lily/include/kpath.hh +++ b/lily/include/kpath.hh @@ -12,7 +12,7 @@ source file of the GNU LilyPond music typesetter -char * ly_find_afm (char const * name); +String ly_find_afm (char const * name); String ly_find_tfm (char const * name); void ly_init_kpath (char *av0); diff --git a/lily/kpath.cc b/lily/kpath.cc index 0e39e0c1ff..62e0186c05 100644 --- a/lily/kpath.cc +++ b/lily/kpath.cc @@ -26,15 +26,27 @@ extern "C" { #include "main.hh" #include "kpath.hh" #include "lily-version.hh" +#include "warn.hh" - -char * +String ly_find_afm (char const * name) { #if (KPATHSEA && HAVE_KPSE_FIND_FILE) - return kpse_find_file (name, kpse_afm_format, true); + char * name_ptr = kpse_find_file (name, kpse_afm_format, true); + + if(!name_ptr) + { + /* + don't mutter about afms, since we try to find them first, and lots of + TFMs don't have AFMs. + */ + // warning (_f("kpathsea couldn't find AFM file `%s'", name)); + } + else + return name_ptr; + #endif - return 0; + return ""; } String @@ -46,7 +58,14 @@ ly_find_tfm (char const * name) return p; #if (KPATHSEA && HAVE_KPSE_FIND_FILE) - return kpse_find_file (name, kpse_tfm_format, true); + char * name_ptr = kpse_find_file (name, kpse_tfm_format, true); + if(!name_ptr) + { + warning (_f("Kpathsea couldn't find TFM file `%s'", name)); + } + else + return name_ptr; + #endif return ""; } diff --git a/lily/new-spacing-spanner.cc b/lily/new-spacing-spanner.cc index 4ed9c7afde..760651efee 100644 --- a/lily/new-spacing-spanner.cc +++ b/lily/new-spacing-spanner.cc @@ -41,14 +41,13 @@ New_spacing_spanner::set_interface (Grob*me) void New_spacing_spanner::do_measure (Grob*me, Link_array *cols) { - Moment shortest; - Moment mean_shortest; + Moment shortest_in_measure; /* space as if this duration is present. */ Moment base_shortest_duration = *unsmob_moment (me->get_grob_property ("maximum-duration-for-spacing")); - shortest.set_infinite (1); + shortest_in_measure.set_infinite (1); for (int i = cols->size(); i--;) { @@ -71,12 +70,7 @@ New_spacing_spanner::do_measure (Grob*me, Link_array *cols) SCM st = cols->elem (i)->get_grob_property ("shortest-starter-duration"); Moment this_shortest = *unsmob_moment (st); - shortest = shortest get_grob_property ("arithmetic-multiplier")); + + SCM seq = lc->get_grob_property ("spacing-sequence"); + + Moment dt = Paper_column::when_mom (r) - Paper_column::when_mom (l); - for (SCM s = lc->get_grob_property ("spacing-sequence"); gh_pair_p (s); s = gh_cdr (s)) + /* + hinterfleisch = hind-meat = amount of space following a note. + + + We adjust the space following a note only if the next note + happens after the current note (this is set in the grob + property SPACING-SEQUENCE. */ + + Real stretch_distance = note_space; + if (shortest_in_measure <= dt) { - Grob *lm = unsmob_grob (gh_caar (s)); - Grob *rm = unsmob_grob (gh_cdar (s)); + /* + currently SPACING-SEQUENCE is set in + Separating_group_spanner::find_musical_sequences (), which + works neatly for one-voice-per staff, however, - // TODO; configgable. - hinterfleisch += -headwid + Separation_item::my_width (lm)[RIGHT] - - 0.5 * Separation_item::my_width (rm)[LEFT]; + it can't find out the actual duration of the notes on a + staff, so when putting tuplets and normal patterns it gets + confused, (ie. believes that < { c8 c8 } { d8 d8 d8 }*2/3 + > contains 1/12 notes. ). + here we kludge, by checking if the distance we're spacing + for is less than the shortest note. + + TODO: + + Move SPACING-SEQUENCE detection into a voice + level-engraver --or-- make sure that every column has + access to the note head. - /* - UGH: KLUDGE! */ - - // if (delta_t > Moment (Rational (1,32))) - hinterfleisch += stem_dir_correction (me, l, r); - } + for (SCM s = seq; gh_pair_p (s); s = gh_cdr (s)) + { + Grob *lm = unsmob_grob (gh_caar (s)); + Grob *rm = unsmob_grob (gh_cdar (s)); + + // TODO; configgable. + hinterfleisch += -headwid + Separation_item::my_width (lm)[RIGHT] - + 0.5 * Separation_item::my_width (rm)[LEFT]; - Real stretch_distance = note_space - headwid; + + hinterfleisch += stem_dir_correction (me, l, r); + } + + // ? why. + if (gh_pair_p (seq)) + stretch_distance -= headwid; + } Spring s; s.distance_f_ = hinterfleisch; s.strength_f_ = 1 / stretch_distance; @@ -311,7 +338,7 @@ New_spacing_spanner::stretch_to_regularity (Grob *me, */ Real New_spacing_spanner::default_bar_spacing (Grob*me, Grob *lc, Grob *rc, - Moment shortest) + Moment shortest) { Real symbol_distance = lc->extent (lc,X_AXIS)[RIGHT] ; Real durational_distance = 0; @@ -358,7 +385,7 @@ New_spacing_spanner::note_spacing (Grob*me, Grob *lc, Grob *rc, Moment shortest_playing_len = 0; SCM s = lc->get_grob_property ("shortest-playing-duration"); - // SCM s = lc->get_grob_property ("mean-playing-duration"); + if (unsmob_moment (s)) shortest_playing_len = *unsmob_moment (s); diff --git a/ps/music-drawing-routines.ps b/ps/music-drawing-routines.ps index d2f3bac4c6..a4c8311465 100644 --- a/ps/music-drawing-routines.ps +++ b/ps/music-drawing-routines.ps @@ -4,6 +4,10 @@ /blot-diameter { lilypondpaperblotdiameter } bind def +% fucking redhat xdvi patch. +/skeel { scale } bind def + + /set_tex_dimen { cvr def } bind def @@ -13,6 +17,7 @@ 1 copy mul exch 1 copy mul add sqrt } bind def +/skeel { scale } bind def % FIXME. translate to middle of box. % Nice rectangle with rounded corners /draw_box % breapth width depth height diff --git a/scm/grob-description.scm b/scm/grob-description.scm index c24f369723..dc0fbd7a07 100644 --- a/scm/grob-description.scm +++ b/scm/grob-description.scm @@ -500,7 +500,7 @@ )) (SpacingSpanner . ( - (spacing-procedure . ,Spacing_spanner::set_springs) + (spacing-procedure . ,New_spacing_spanner::set_springs) (stem-spacing-correction . 0.5) (grace-space-factor . 0.8) diff --git a/tex/lily-ps-defs.tex b/tex/lily-ps-defs.tex index ab5ad6b434..79cb916235 100644 --- a/tex/lily-ps-defs.tex +++ b/tex/lily-ps-defs.tex @@ -16,8 +16,9 @@ \def\embeddedps##1{% \special{ps\string: @beginspecial @setspecial \lilypondpaperoutputscale\lilySpace - \lilypondpaperoutputscale\lilySpace scale - ##1 @endspecial}% + \lilypondpaperoutputscale\lilySpace + % FUCKING REDHAT XDVI -- ARG! + skeel ##1 @endspecial}% } } \def\PSsetTeXdimen#1{\expandafter\special{! /#1 (\csname #1\endcsname) set_tex_dimen}} -- 2.39.5