From: Han-Wen Nienhuys Date: Sat, 23 Mar 2002 02:36:37 +0000 (+0100) Subject: release: 1.5.46 X-Git-Tag: release/1.5.46 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7cacca4ac9e71dc19ba1c1fc600d2bd4ac4b9b26;p=lilypond.git release: 1.5.46 --- diff --git a/ChangeLog b/ChangeLog index 5432c20c49..f153772d05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,75 @@ +2002-03-23 Han-Wen + + * VERSION: 1.5.46 + + * lily/beam.cc (score_slopes_dy, score_stem_lengths, + score_forbidden_quants): ): take out of SCM, pass parameters so + grob props are read only once. (wtk1-fugue2 from 31 sec to 14 + secs). + + * lily/lily-guile.cc (ly_unit): return internal unit. + + * scm/tex.scm (header-end): insert scaling factor, using ly-unit + + * lily/paper-outputter.cc (output_version): output internal unit + from Paper_outputter + + * scripts/ly2dvi.py: Read unit from paper vars (43.jcn3). + +2002-03-22 Mats Bengtsson + + * scripts/ly2dvi.py: clean up old .*pk font caching code. + + * scm/ps.scm: Use uppercase postscript font names for the standard + TeX fonts. + + * scripts/ly2dvi.py, buildscripts/lilypond-{login,profile}.sh, : + Add all available TeX Type1 fonts, including Feta, to the + Ghostscript font path. + + * Documentation/topdocs/INSTALL.texi (Top): Add required pktrace + version (affects the FontName) in lilypond.map. + + * mf/GNUmakefile, Documentation/user/appendices.itely: Rename font + documentation file to fetaNNlist.ly to avoid name collisions between + lilypond generated .tex file and font .tex macros file. + + +2002-03-22 Juergen Reuter + + * mf/feta-eindelijk.mf, mf/parmesan-rests.mf: added maxima rests; + made mensural longa and (semi-)brevis leaner + + * mf/parmesan-clefs.mf, scm/clef.scm: enhanced petrucci c clef + + * lily/{{lookup,porrectus}.cc,include/{lookup,porrectus}.hh}: code + clean-up: moved bezier shape and slope from porrectus to lookup + + * buildscripts/clean-fonts.sh: added search paths /var/cache/fonts + and /usr/share/texmf/fonts + +2002-03-22 Han-Wen + + * lily/text-spanner.cc (brew_molecule): add #'thickness + (brew_molecule): add corrections for thickness in molecule padding. + + * lily/line-spanner.cc (line_atom): make function private + + * scripts/lilypond-book.py (get_bbox): Use GS -sDEVICE=bbox to + discover bounding box. This solves the cropping problem. + + * lily/bar-check-iterator.cc (process): Only resynchronize bar + check when it fails. This fixes the combination of grace notes + and bar checks. + 2002-03-21 Han-Wen + * lily/repeated-music.cc (minimum_start): new Scheme callable function + (first_start): new Scheme callable. This will fix repeated music + starting with grace notes. + + * lily/music.cc (start_mom): check start-moment-function grob property. + * VERSION: 1.5.45 released * input/regression/system-extents.ly: new regression test. Test diff --git a/Documentation/topdocs/INSTALL.texi b/Documentation/topdocs/INSTALL.texi index 91cf161cce..67ad977ab9 100644 --- a/Documentation/topdocs/INSTALL.texi +++ b/Documentation/topdocs/INSTALL.texi @@ -172,7 +172,7 @@ configure something like: @end example -@item pktrace, [OPTIONAL], needed for generating PostScript Type1 +@item pktrace 1.0 or newer, [OPTIONAL], needed for generating PostScript Type1 fonts. Get it from @uref{http://www.cs.uu.nl/~hanwen/pktrace/}. You will need to install some additional packages to get pktrace to work. diff --git a/Documentation/user/appendices.itely b/Documentation/user/appendices.itely index dd424a003b..f09c9738e1 100644 --- a/Documentation/user/appendices.itely +++ b/Documentation/user/appendices.itely @@ -208,5 +208,5 @@ The following symbols are available in the Feta font and may be accessed directly using text markup such as @code{g^#'(music "scripts-segno")}, see @ref{Text markup}. -@lilypondfile{feta16.ly} +@lilypondfile{feta16list.ly} diff --git a/INSTALL.txt b/INSTALL.txt index d7e47a1d6e..90ed864e96 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -176,9 +176,10 @@ Compilation ./configure --without-kpathsea --enable-tfm-path=/usr/share/texmf/fonts/tfm/public/cm/:/usr/share/texmf/fonts/tfm/ams/symbols - * pktrace, [OPTIONAL], needed for generating PostScript Type1 fonts. - Get it from `http://www.cs.uu.nl/~hanwen/pktrace/'. You will - need to install some additional packages to get pktrace to work. + * pktrace 1.0 or newer, [OPTIONAL], needed for generating PostScript + Type1 fonts. Get it from `http://www.cs.uu.nl/~hanwen/pktrace/'. + You will need to install some additional packages to get pktrace + to work. Running requirements diff --git a/VERSION b/VERSION index 22c74e010d..500f43c91c 100644 --- a/VERSION +++ b/VERSION @@ -1,9 +1,10 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=5 -PATCH_LEVEL=45 +PATCH_LEVEL=46 MY_PATCH_LEVEL= + # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. # diff --git a/buildscripts/clean-fonts.sh b/buildscripts/clean-fonts.sh index 395a35cff7..0dc0ff2684 100644 --- a/buildscripts/clean-fonts.sh +++ b/buildscripts/clean-fonts.sh @@ -18,6 +18,8 @@ dirs=". /var/spool/texmf /var/tmp/texfonts /var/texfonts +/var/cache/fonts +/usr/share/texmf/fonts " for i in $dirs; do diff --git a/buildscripts/lilypond-login.sh b/buildscripts/lilypond-login.sh index 67a8f34671..9e7278f681 100755 --- a/buildscripts/lilypond-login.sh +++ b/buildscripts/lilypond-login.sh @@ -12,11 +12,6 @@ # strange shell, this C set datadir="@datadir@" -if ( $?GS_FONTPATH ) then - setenv GS_FONTPATH "$datadir/fonts/afm:$datadir/fonts/type1:$GS_FONTPATH" - else - setenv GS_FONTPATH "$datadir/fonts/afm:$datadir/fonts/type1" - endif if ( $?GS_LIB ) then setenv GS_LIB "$datadir/ps:$GS_LIB" else @@ -36,5 +31,11 @@ set noglob setenv TEXMF "{$datadir,"`kpsexpand \$TEXMF`"}" unset noglob +# Add all available TeX Type1 fonts (including Feta) to Ghostscript: +if ( $?GS_FONTPATH ) then + setenv GS_FONTPATH `kpsewhich -expand-path=\$T1FONTS`:$GS_FONTPATH" + else + setenv GS_FONTPATH `kpsewhich -expand-path=\$T1FONTS` + endif diff --git a/buildscripts/lilypond-profile.sh b/buildscripts/lilypond-profile.sh index 11464f2ba5..1e03ea439a 100755 --- a/buildscripts/lilypond-profile.sh +++ b/buildscripts/lilypond-profile.sh @@ -9,9 +9,6 @@ datadir=`echo "@datadir@" | sed 's!//!/!g'` -# For direct ps output fonts -GS_FONTPATH="$datadir/fonts/afm:$datadir/fonts/type1:"${GS_FONTPATH:=""} - # For direct ps output: ps/lilyponddefs.ps GS_LIB="$datadir/ps:"${GS_LIB:=""} @@ -28,6 +25,11 @@ TEXMF="{$datadir,"`kpsexpand \\$TEXMF`"}" # LILYPONDPREFIX="$datadir" # export LILYPONDPREFIX +# For direct ps output fonts. Add all available TeX Type1 fonts +GS_FONTPATH=`kpsewhich -expand-path=\$T1FONTS`:${GS_FONTPATH:=""} + + + export GS_LIB GS_FONTPATH TEXMF diff --git a/input/baerenreiter-sarabande.ly b/input/baerenreiter-sarabande.ly index 262ef28ca6..b7de5d717b 100644 --- a/input/baerenreiter-sarabande.ly +++ b/input/baerenreiter-sarabande.ly @@ -149,6 +149,11 @@ smallerPaper = \paper { baerPaper = \paper { indent = 7. \mm linewidth =183.5 \mm + interscoreline=4.0\mm + \translator { + \ScoreContext +% System \override #'molecule-callback = #box-grob-molecule + } } diff --git a/input/regression/figured-bass.ly b/input/regression/figured-bass.ly index 47893be4fc..8ac5ed2fbf 100644 --- a/input/regression/figured-bass.ly +++ b/input/regression/figured-bass.ly @@ -12,7 +12,7 @@ numbers, like @code{<4 6+>}. \context FiguredBass { \figures { <_! 3+ 5- _ 7! 9 >4 - < 4 6 > + < [4 6] > } } diff --git a/input/regression/grace-volta-repeat.ly b/input/regression/grace-volta-repeat.ly new file mode 100644 index 0000000000..8143a3a0ca --- /dev/null +++ b/input/regression/grace-volta-repeat.ly @@ -0,0 +1,20 @@ + +\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. } + } + + diff --git a/input/test/beam-dir-function.ly b/input/test/beam-dir-function.ly index faed716f6e..10e994647a 100644 --- a/input/test/beam-dir-function.ly +++ b/input/test/beam-dir-function.ly @@ -2,6 +2,7 @@ \header{ texidoc=" + There are several ways to calculate the direction of a beam @table @samp @@ -23,8 +24,7 @@ We should see: \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] diff --git a/lily/bar-check-iterator.cc b/lily/bar-check-iterator.cc index bc01898832..b916066f6a 100644 --- a/lily/bar-check-iterator.cc +++ b/lily/bar-check-iterator.cc @@ -56,15 +56,13 @@ Bar_check_iterator::process (Moment m) 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 ()); + } } } -} - +} diff --git a/lily/beam.cc b/lily/beam.cc index d511651d4a..23d0998d1f 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -19,7 +19,9 @@ It may only set directions for stems. * Rewrite stem_beams. - + + * Use Number_pair i.s.o Interval to represent (yl, yr). + */ @@ -43,6 +45,8 @@ #include "font-interface.hh" // debug output. +#define DEBUG_QUANTING 0 + static Real shrink_extra_weight (Real x) @@ -63,6 +67,10 @@ Beam::add_stem (Grob *me, Grob *s) add_bound_item (dynamic_cast (me), dynamic_cast (s)); } + +/* + TODO: fix this for grace notes. + */ Real Beam::get_interbeam (Grob *me) { @@ -275,7 +283,8 @@ Beam::consider_auto_knees (Grob *me) } /* Set stem's shorten property if unset. - TODO: + + TODO: take some y-position (chord/beam/nearest?) into account scmify forced-fraction */ void @@ -339,6 +348,7 @@ struct Quant_score Real demerits; }; + /* TODO: - Make all demerits customisable @@ -359,6 +369,10 @@ Beam::quanting (SCM smob) Real ss = Staff_symbol_referencer::staff_space (me); Real thickness = gh_scm2double (me->get_grob_property ("thickness")) / ss; Real slt = me->paper_l ()->get_var ("stafflinethickness") / ss; + + + SCM sdy = me->get_grob_property ("least-squares-dy"); + Real dy_mus = gh_number_p (sdy) ? gh_scm2double (sdy) : 0.0; Real straddle = 0.0; Real sit = (thickness - slt) / 2; @@ -370,8 +384,16 @@ Beam::quanting (SCM smob) Array quantsl; Array quantsr; + /* + going to REGION_SIZE == 2, yields another 0.6 second with + wtk1-fugue2. + + + (result indexes between 70 and 575) ? --hwn. + + */ + const int REGION_SIZE = 3; - // -> result indexes between 70 and 575 for (int i = -REGION_SIZE ; i < REGION_SIZE; i++) for (int j = 0; j < num_quants; j++) { @@ -393,26 +415,72 @@ Beam::quanting (SCM smob) } - SCM score_funcs = me->get_grob_property ("quant-score-functions"); - for (SCM s = score_funcs; gh_pair_p (s); s = gh_cdr (s)) + /* + This is a longish function, but we don't separate this out into + neat modular separate subfunctions, as the subfunctions would be + called for many values of YL, YR. By precomputing various + parameters outside of the loop, we can save a lot of time. + + */ + for (int i = qscores.size (); i--;) + if (qscores[i].demerits < 100) + { + qscores[i].demerits + += score_slopes_dy (me, qscores[i].yl, qscores[i].yr, + dy_mus, yr- yl); + } + + Real rad = Staff_symbol_referencer::staff_radius (me); + int multiplicity = get_multiplicity (me); + Real interbeam = multiplicity < 4 + ? (2*ss + slt - thickness) / 2.0 + : (3*ss + slt - thickness) / 3.0; + + for (int i = qscores.size (); i--;) + if (qscores[i].demerits < 100) + { + qscores[i].demerits + += score_forbidden_quants (me, qscores[i].yl, qscores[i].yr, + rad, slt, thickness, interbeam, + multiplicity); + } + + + /* + Do stem lengths. These depend on YL and YR linearly, so we can + precompute for every stem 2 factors. + */ + Link_array stems= + Pointer_group_interface__extract_grobs (me, (Grob*)0, "stems"); + Array stem_infos; + Array lbase_lengths; + Array rbase_lengths; + + Array directions; + for (int i= 0; i < stems.size(); i++) { - SCM f = gh_car (s); - for (int i = qscores.size (); i--;) - { - // best scores < 30; - // if (qscores[i].demerits < 1000) - if (qscores[i].demerits < 100) - { - SCM score = gh_call3 (f, - me->self_scm (), - gh_double2scm (qscores[i].yl), - gh_double2scm (qscores[i].yr)); - - qscores[i].demerits += gh_scm2double (score); - } - } + Grob*s = stems[i]; + stem_infos.push( Stem::calc_stem_info (s)); + + Real b = calc_stem_y (me, s, Interval (1,0)); + lbase_lengths.push (b); + + b = calc_stem_y (me, s, Interval (0,1)); + rbase_lengths.push (b); + directions.push( Directional_element_interface::get( s)); } - + + for (int i = qscores.size (); i--;) + if (qscores[i].demerits < 100) + { + qscores[i].demerits + += score_stem_lengths (stems, stem_infos, + lbase_lengths, rbase_lengths, + directions, + me, qscores[i].yl, qscores[i].yr); + } + + Real best = 1e6; int best_idx = -1; for (int i = qscores.size (); i--;) @@ -430,7 +498,7 @@ Beam::quanting (SCM smob) gh_double2scm (qscores[best_idx].yr)) ); - if (0) + if (DEBUG_QUANTING) { // debug quanting me->set_grob_property ("quant-score", @@ -441,56 +509,27 @@ Beam::quanting (SCM smob) return SCM_UNSPECIFIED; } -MAKE_SCHEME_CALLBACK (Beam, score_slopes_dy, 3); -SCM -Beam::score_slopes_dy (SCM smob, SCM syl, SCM syr) -{ - Grob*me = unsmob_grob (smob); - Real yl = gh_scm2double (syl); - Real yr = gh_scm2double (syr); - Real dy = yr - yl; - - SCM sdy = me->get_grob_property ("least-squares-dy"); - SCM posns = me->get_grob_property ("positions"); - - Real dy_mus = gh_number_p (sdy) ? gh_scm2double (sdy) : 0.0; - Real dy_damp = - gh_scm2double (gh_car (posns)) + gh_scm2double (gh_cdr (posns)); - - Real dem = 0.0; - if (sign (dy_damp) != sign (dy)) - { - dem += 800; - } - - dem += 400* (0 >? (fabs (dy) - fabs (dy_mus))); - - - dem += shrink_extra_weight (fabs (dy_damp) - fabs (dy))* 10; - return gh_double2scm (dem); -} - -MAKE_SCHEME_CALLBACK (Beam, score_stem_lengths, 3); -SCM -Beam::score_stem_lengths (SCM smob, SCM syl, SCM syr) +Real +Beam::score_stem_lengths (Link_arraystems, + Array stem_infos, + Array left_factor, + Array right_factor, + Array directions, + Grob*me, Real yl, Real yr) { - Grob*me = unsmob_grob (smob); - Real yl = gh_scm2double (syl); - Real yr = gh_scm2double (syr); - - Link_array stems= - Pointer_group_interface__extract_grobs (me, (Item*)0, "stems"); - Real demerit_score = 0.0 ; for (int i=0; i < stems.size (); i++) { - Item* s = stems[i]; + Grob* s = stems[i]; if (Stem::invisible_b (s)) continue; - Real current_y = calc_stem_y (me, s, Interval (yl, yr)); - Stem_info info = Stem::calc_stem_info (s); - Direction d = Directional_element_interface::get (s); + Real current_y = + yl * left_factor[i] + right_factor[i]* yr; + + Stem_info info = stem_infos[i]; + Direction d = Direction (directions[i]); demerit_score += 500 * ( 0 >? (info.min_y - d * current_y)); demerit_score += 500 * ( 0 >? (d * current_y - info.max_y)); @@ -500,7 +539,26 @@ Beam::score_stem_lengths (SCM smob, SCM syl, SCM syr) demerit_score *= 2.0 /stems.size (); - return gh_double2scm (demerit_score); + return demerit_score; +} + +Real +Beam::score_slopes_dy (Grob *me, Real yl, Real yr, + Real dy_mus, Real dy_damp) +{ + Real dy = yr - yl; + + Real dem = 0.0; + if (sign (dy_damp) != sign (dy)) + { + dem += 800; + } + + dem += 400* (0 >? (fabs (dy) - fabs (dy_mus))); + + + dem += shrink_extra_weight (fabs (dy_damp) - fabs (dy))* 10; + return dem; } static Real @@ -509,37 +567,26 @@ my_modf (Real x) return x - floor (x); } - - -MAKE_SCHEME_CALLBACK (Beam, score_forbidden_quants, 3); -SCM -Beam::score_forbidden_quants (SCM smob, SCM syl, SCM syr) +Real +Beam::score_forbidden_quants (Grob*me, + Real yl, Real yr, + Real rad, + Real slt, + Real thickness, Real interbeam, + int multiplicity) { - Grob*me = unsmob_grob (smob); - Real yl = gh_scm2double (syl); - Real yr = gh_scm2double (syr); Real dy = yr - yl; - Real rad = Staff_symbol_referencer::staff_radius (me); + Real dem = 0.0; if (fabs (yl) < rad && fabs ( my_modf (yl) - 0.5) < 1e-3) dem += 1000; if (fabs (yr) < rad && fabs ( my_modf (yr) - 0.5) < 1e-3) dem += 1000; - - int multiplicity = get_multiplicity (me); // todo: use multiplicity of outer stems. if (multiplicity >= 2) { - Real slt = me->paper_l ()->get_var ("stafflinethickness"); - Real ss = Staff_symbol_referencer::staff_space (me); - 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; - + Real straddle = 0.0; Real sit = (thickness - slt) / 2; Real inter = 0.5; @@ -553,26 +600,37 @@ Beam::score_forbidden_quants (SCM smob, SCM syl, SCM syr) && fabs (my_modf (yr) - inter) < 1e-3) dem += 15; + Real eps = 1e-3; + + /* + Can't we simply compute the distance between the nearest + staffline and the secondary beam? That would get rid of the + silly case analysis here (which is probably not when we have + different beam-thicknesses.) + + --hwn + */ + // hmm, without Interval/Drul_array, you get ~ 4x same code... if (fabs (yl - dir * interbeam) < rad + inter) { - if (dir == UP && dy <= 1e-3 - && fabs (my_modf (yl) - sit) < 1e-3) + if (dir == UP && dy <= eps + && fabs (my_modf (yl) - sit) < eps) dem += 15; - if (dir == DOWN && dy >= 1e-3 - && fabs (my_modf (yl) - hang) < 1e-3) + if (dir == DOWN && dy >= eps + && fabs (my_modf (yl) - hang) < eps) dem += 15; } if (fabs (yr - dir * interbeam) < rad + inter) { - if (dir == UP && dy >= 1e-3 - && fabs (my_modf (yr) - sit) < 1e-3) + if (dir == UP && dy >= eps + && fabs (my_modf (yr) - sit) < eps) dem += 15; - if (dir == DOWN && dy <= 1e-3 - && fabs (my_modf (yr) - hang) < 1e-3) + if (dir == DOWN && dy <= eps + && fabs (my_modf (yr) - hang) < eps) dem += 15; } @@ -580,29 +638,29 @@ Beam::score_forbidden_quants (SCM smob, SCM syl, SCM syr) { if (fabs (yl - 2 * dir * interbeam) < rad + inter) { - if (dir == UP && dy <= 1e-3 - && fabs (my_modf (yl) - straddle) < 1e-3) + if (dir == UP && dy <= eps + && fabs (my_modf (yl) - straddle) < eps) dem += 15; - if (dir == DOWN && dy >= 1e-3 - && fabs (my_modf (yl) - straddle) < 1e-3) + if (dir == DOWN && dy >= eps + && fabs (my_modf (yl) - straddle) < eps) dem += 15; } if (fabs (yr - 2 * dir * interbeam) < rad + inter) { - if (dir == UP && dy >= 1e-3 - && fabs (my_modf (yr) - straddle) < 1e-3) + if (dir == UP && dy >= eps + && fabs (my_modf (yr) - straddle) < eps) dem += 15; - if (dir == DOWN && dy <= 1e-3 - && fabs (my_modf (yr) - straddle) < 1e-3) + if (dir == DOWN && dy <= eps + && fabs (my_modf (yr) - straddle) < eps) dem += 15; } } } - return gh_double2scm ( dem); + return dem; } @@ -798,7 +856,7 @@ Beam::end_after_line_breaking (SCM smob) in POS, and for stem S. */ Real -Beam::calc_stem_y (Grob *me, Item* s, Interval pos) +Beam::calc_stem_y (Grob *me, Grob* s, Interval pos) { int beam_multiplicity = get_multiplicity (me); int stem_multiplicity = (Stem::flag_i (s) - 2) >? 0; @@ -823,12 +881,19 @@ Beam::calc_stem_y (Grob *me, Item* s, Interval pos) if (dir!= sdir) { stem_y -= dir * (thick / 2 + (beam_multiplicity - 1) * interbeam); - + // huh, why not for first visible? - if (Staff_symbol_referencer::staff_symbol_l (s) - != Staff_symbol_referencer::staff_symbol_l (last_visible_stem (me))) - stem_y += Directional_element_interface::get (me) - * (beam_multiplicity - stem_multiplicity) * interbeam; + + Grob *last_visible = last_visible_stem (me); + if (last_visible) + { + if ( Staff_symbol_referencer::staff_symbol_l (s) + != Staff_symbol_referencer::staff_symbol_l (last_visible)) + stem_y += Directional_element_interface::get (me) + * (beam_multiplicity - stem_multiplicity) * interbeam; + } + else + programming_error ("No last visible stem"); } return stem_y; @@ -1095,7 +1160,7 @@ Beam::brew_molecule (SCM smob) ->get_bound (LEFT)->relative_coordinate (0, X_AXIS), X_AXIS); - if (0) + if (DEBUG_QUANTING) { /* This code prints the demerits for each beam. Perhaps this @@ -1143,9 +1208,12 @@ Beam::forced_stem_count (Grob *me) -/* TODO: - use filter and standard list functions. - */ +/* + +TODO: +use filter and standard list functions. + +*/ int Beam::visible_stem_count (Grob *me) { @@ -1190,6 +1258,7 @@ Beam::last_visible_stem (Grob *me) /* [TODO] + handle rest under beam (do_post: beams are calculated now) what about combination of collisions and rest under beam. diff --git a/lily/global-translator.cc b/lily/global-translator.cc index 45a8f1050c..a7fb3e0c3c 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/grob.cc b/lily/grob.cc index 94758b7990..9484c6951a 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -919,6 +919,8 @@ init_functions () (Scheme_function_unknown)ly_set_grob_property); scm_c_define_gsubr ("ly-get-spanner-bound", 2 , 0, 0, (Scheme_function_unknown) spanner_get_bound); + scm_c_define_gsubr ("ly-get-paper-variable", 2, 0, 0, + (Scheme_function_unknown) ly_get_paper_var); scm_c_define_gsubr ("ly-get-extent", 3, 0, 0, (Scheme_function_unknown) ly_get_extent); scm_c_define_gsubr ("ly-get-parent", 2, 0, 0, diff --git a/lily/include/beam.hh b/lily/include/beam.hh index 7e217ce035..4f32cfe0e8 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -9,7 +9,7 @@ #include "lily-proto.hh" #include "lily-guile.hh" - +#include "stem-info.hh" class Beam @@ -36,9 +36,14 @@ public: DECLARE_SCHEME_CALLBACK (check_concave, (SCM)); DECLARE_SCHEME_CALLBACK (slope_damping, (SCM)); DECLARE_SCHEME_CALLBACK (quanting, (SCM)); - DECLARE_SCHEME_CALLBACK (score_slopes_dy, (SCM, SCM,SCM)); - DECLARE_SCHEME_CALLBACK (score_stem_lengths, (SCM, SCM,SCM)); - DECLARE_SCHEME_CALLBACK (score_forbidden_quants, (SCM, SCM,SCM)); + static Real score_slopes_dy (Grob*, Real,Real,Real,Real); + static Real score_stem_lengths (Link_array, + Array, + Array, Array, Array, + Grob*,Real , Real); + static Real score_forbidden_quants (Grob*, Real, Real, + Real, Real, Real, Real, + int); static Molecule stem_beams (Grob*,Item *here, Item *next, Item *prev, @@ -49,7 +54,7 @@ private: static void set_stem_directions (Grob*); static void consider_auto_knees (Grob*); static void set_stem_shorten (Grob*); - static Real calc_stem_y (Grob*, Item* s, Interval pos); + static Real calc_stem_y (Grob*, Grob* s, Interval pos); static void set_stem_lengths (Grob*); static int forced_stem_count (Grob*); }; diff --git a/lily/include/dimensions.hh b/lily/include/dimensions.hh index 66a9d0868d..c5f54a17e7 100644 --- a/lily/include/dimensions.hh +++ b/lily/include/dimensions.hh @@ -23,6 +23,9 @@ const Real PT_TO_MM = (1.0/MM_TO_PT); #define BIGPOINT *BIGPOINT_TO_POINT #define CHAR *CHAR_TO_PT + +#define INTERNAL_UNIT "pt" + #else // mm #define PT *PT_TO_PT *PT_TO_MM @@ -31,6 +34,7 @@ const Real PT_TO_MM = (1.0/MM_TO_PT); #define INCH *INCH_TO_PT *PT_TO_MM #define BIGPOINT *BIGPOINT_TO_POINT *PT_TO_MM #define CHAR *CHAR_TO_PT *PT_TO_MM +#define INTERNAL_UNIT "mm" #endif diff --git a/lily/include/line-spanner.hh b/lily/include/line-spanner.hh index 997a75dab6..42523311e1 100644 --- a/lily/include/line-spanner.hh +++ b/lily/include/line-spanner.hh @@ -16,8 +16,8 @@ class Line_spanner { 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); diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index 17b8a5e654..447d0e4eca 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -22,6 +22,8 @@ struct Lookup static Molecule accordion (SCM arg, Real interline_f, Font_metric*fm); static Molecule frame (Box b, Real thick); static Molecule slur (Bezier controls, Real cthick, Real thick) ; + static Molecule bezier_sandwich (Bezier, Bezier); + static Molecule horizontal_slope (Real, Real, Real); static Molecule beam (Real, Real, Real) ; static Molecule dashed_slur (Bezier, Real thick, Real dash) ; static Molecule blank (Box b) ; diff --git a/lily/include/music-output-def.hh b/lily/include/music-output-def.hh index e585202a6e..8015d60790 100644 --- a/lily/include/music-output-def.hh +++ b/lily/include/music-output-def.hh @@ -20,12 +20,15 @@ Definition of how to output lilypond. TODO: smobify, remove Music_output_def_identifier. + + TODO: remove Scope structure. Scheme_hash_table has all the info. */ class Music_output_def { public: Scheme_hash_table * translator_tab_; Scheme_hash_table * variable_tab_; + Scope *translator_p_dict_p_; Scope *scope_p_; diff --git a/lily/include/porrectus.hh b/lily/include/porrectus.hh index 9fa037ab9c..c2abfbfaaf 100644 --- a/lily/include/porrectus.hh +++ b/lily/include/porrectus.hh @@ -30,8 +30,6 @@ private: static Molecule brew_mensural_molecule (Item *, Real, bool, Real, Real, bool, Direction); - static Molecule brew_bezier_sandwich (Bezier, Bezier); - static Molecule brew_horizontal_slope (Real, Real, Real); static Molecule create_ledger_line (Interval, Grob *); static Molecule create_streepjes (Grob *, int, int, Interval); }; diff --git a/lily/include/repeated-music.hh b/lily/include/repeated-music.hh index 7c1df168ef..833609261c 100644 --- a/lily/include/repeated-music.hh +++ b/lily/include/repeated-music.hh @@ -63,6 +63,8 @@ public: 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); diff --git a/lily/include/scm-hash.hh b/lily/include/scm-hash.hh index 54423b6302..626ae3d7ae 100644 --- a/lily/include/scm-hash.hh +++ b/lily/include/scm-hash.hh @@ -35,16 +35,6 @@ scm_gc_unprotect_object (tab->self_scm_); - - - - TODO: - - - This should come from GUILE. We're typically doing double work, - because KEY already is a symbol, and is looked up in a symbol - hashtable. - - - use GUILE hashtables iso STL. */ class Scheme_hash_table diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 794062bfdd..975b9e5229 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -23,6 +23,7 @@ #include "offset.hh" #include "interval.hh" #include "pitch.hh" +#include "dimensions.hh" SCM ly_last (SCM list) @@ -463,6 +464,12 @@ ly_version () return gh_eval_str ((char*)vs); } +SCM +ly_unit () +{ + return gh_str02scm (INTERNAL_UNIT); +} + static void init_functions () { @@ -470,6 +477,8 @@ init_functions () (Scheme_function_unknown)ly_warning); scm_c_define_gsubr ("ly-version", 0, 0, 0, (Scheme_function_unknown)ly_version); + scm_c_define_gsubr ("ly-unit", 0, 0, 0, + (Scheme_function_unknown)ly_unit); scm_c_define_gsubr ("ly-gulp-file", 1,0, 0, (Scheme_function_unknown)ly_gulp_file); scm_c_define_gsubr ("dir?", 1,0, 0, (Scheme_function_unknown)ly_isdir_p); diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc index ba22052d96..9f8a47b830 100644 --- a/lily/line-spanner.cc +++ b/lily/line-spanner.cc @@ -17,20 +17,22 @@ #include -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; @@ -60,7 +62,7 @@ Line_spanner::line_atom (Grob* me, Real dx, Real dy) } 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"); @@ -70,8 +72,9 @@ Line_spanner::line_molecule (Grob* me, Real dx, Real dy) || 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)), + Interval (- 0.5* thick + (0? dy))); + mol = Molecule (b, line_atom (me, thick, dx, dy)); } else if (gh_symbol_p (type) && type == ly_symbol2scm ("trill")) @@ -240,8 +243,15 @@ Line_spanner::brew_molecule (SCM smob) 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); diff --git a/lily/lookup.cc b/lily/lookup.cc index 2d832c965b..8e5c17eb89 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -160,6 +160,90 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick) return Molecule (b, at); } +/* + * Bezier Sandwich: + * + * .| + * . | + * top . | + * . curve | + * . | + * . | + * . | + * | | + * | .| + * | . + * | bottom . + * | . curve + * | . + * | . + * | . + * | . + * |. + * | + * + */ +Molecule +Lookup::bezier_sandwich (Bezier top_curve, Bezier bottom_curve) +{ + /* + Need the weird order b.o. the way PS want its arguments + */ + SCM list = SCM_EOL; + list = gh_cons (ly_offset2scm (bottom_curve.control_[3]), list); + list = gh_cons (ly_offset2scm (bottom_curve.control_[0]), list); + list = gh_cons (ly_offset2scm (bottom_curve.control_[1]), list); + list = gh_cons (ly_offset2scm (bottom_curve.control_[2]), list); + list = gh_cons (ly_offset2scm (top_curve.control_[0]), list); + list = gh_cons (ly_offset2scm (top_curve.control_[3]), list); + list = gh_cons (ly_offset2scm (top_curve.control_[2]), list); + list = gh_cons (ly_offset2scm (top_curve.control_[1]), list); + + SCM horizontal_bend = scm_list_n (ly_symbol2scm ("bezier-sandwich"), + ly_quote_scm (list), + gh_double2scm (0.0), + SCM_UNDEFINED); + + Interval x_extent = top_curve.extent (X_AXIS); + x_extent.unite (bottom_curve.extent (X_AXIS)); + Interval y_extent = top_curve.extent (Y_AXIS); + y_extent.unite (bottom_curve.extent (Y_AXIS)); + Box b (x_extent, y_extent); + + return Molecule (b, horizontal_bend); +} + +/* + * Horizontal Slope: + * + * /| ^ + * / | | + * / | | height + * / | | + * / | v + * | / + * | / + * (0,0) x /slope=dy/dx + * | / + * |/ + * + * <-----> + * width + */ +Molecule +Lookup::horizontal_slope (Real width, Real slope, Real height) +{ + SCM width_scm = gh_double2scm (width); + SCM slope_scm = gh_double2scm (slope); + SCM height_scm = gh_double2scm (height); + SCM horizontal_slope = scm_list_n (ly_symbol2scm ("beam"), + width_scm, slope_scm, + height_scm, SCM_UNDEFINED); + Box b (Interval (0, width), + Interval (-height/2, height/2 + width*slope)); + return Molecule (b, horizontal_slope); +} + /* TODO: junk me. */ diff --git a/lily/music.cc b/lily/music.cc index d812fca1d5..5d7e57754b 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -93,6 +93,13 @@ Music::length_mom () const 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; } diff --git a/lily/paper-def.cc b/lily/paper-def.cc index d28375ba91..03766359ef 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -165,8 +165,6 @@ Paper_def::find_font (SCM fn, Real m) SCM Paper_def::font_descriptions ()const { - - SCM l = SCM_EOL; for (SCM s = scaled_fonts_; gh_pair_p (s); s = ly_cdr (s)) { diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index c14eb72224..1c0681010a 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -127,11 +127,10 @@ Paper_outputter::output_version () output_String_def ("lilypondtagline", id_str); output_String_def ("LilyPondVersion", version_str ()); + output_String_def ("lilypondpaperunit", String (INTERNAL_UNIT)); } - - void Paper_outputter::output_Real_def (String k, Real v) { diff --git a/lily/porrectus.cc b/lily/porrectus.cc index 2bdbcd53d4..d52d871d68 100644 --- a/lily/porrectus.cc +++ b/lily/porrectus.cc @@ -362,7 +362,7 @@ Porrectus::brew_vaticana_molecule (Item *me, if (solid) { Molecule solid_head = - brew_bezier_sandwich (top_curve, bottom_curve); + Lookup::bezier_sandwich (top_curve, bottom_curve); molecule.add_molecule (solid_head); } else // outline @@ -370,13 +370,13 @@ Porrectus::brew_vaticana_molecule (Item *me, Bezier inner_top_curve = top_curve; inner_top_curve.translate (Offset (0.0, -thickness)); Molecule top_edge = - brew_bezier_sandwich (top_curve, inner_top_curve); + Lookup::bezier_sandwich (top_curve, inner_top_curve); molecule.add_molecule(top_edge); Bezier inner_bottom_curve = bottom_curve; inner_bottom_curve.translate (Offset (0.0, +thickness)); Molecule bottom_edge = - brew_bezier_sandwich (bottom_curve, inner_bottom_curve); + Lookup::bezier_sandwich (bottom_curve, inner_bottom_curve); molecule.add_molecule(bottom_edge); // TODO: Use horizontal slope with proper slope value rather @@ -452,117 +452,31 @@ Porrectus::brew_mensural_molecule (Item *me, if (solid) { Molecule solid_head = - brew_horizontal_slope (width, corrected_slope, height); + Lookup::horizontal_slope (width, corrected_slope, height); molecule.add_molecule (solid_head); } else // outline { Molecule left_edge = - brew_horizontal_slope (thickness, corrected_slope, height); + Lookup::horizontal_slope (thickness, corrected_slope, height); molecule.add_molecule(left_edge); Molecule right_edge = - brew_horizontal_slope (thickness, corrected_slope, height); + Lookup::horizontal_slope (thickness, corrected_slope, height); right_edge.translate_axis (width-thickness, X_AXIS); right_edge.translate_axis (corrected_slope * (width-thickness), Y_AXIS); molecule.add_molecule(right_edge); Molecule bottom_edge = - brew_horizontal_slope (width, corrected_slope, thickness); + Lookup::horizontal_slope (width, corrected_slope, thickness); bottom_edge.translate_axis (-0.5*height, Y_AXIS); molecule.add_molecule (bottom_edge); Molecule top_edge = - brew_horizontal_slope (width, corrected_slope, thickness); + Lookup::horizontal_slope (width, corrected_slope, thickness); top_edge.translate_axis (+0.5*height, Y_AXIS); molecule.add_molecule (top_edge); } molecule.translate_axis (ypos_correction, Y_AXIS); return molecule; } - -/* - * Bezier Sandwich: - * - * .| - * . | - * top . | - * . curve | - * . | - * . | - * . | - * | | - * | .| - * | . - * | bottom . - * | . curve - * | . - * | . - * | . - * | . - * |. - * | - * - */ -// TODO: Move this to class Lookup? -Molecule -Porrectus::brew_bezier_sandwich (Bezier top_curve, Bezier bottom_curve) -{ - /* - Need the weird order b.o. the way PS want its arguments - */ - SCM list = SCM_EOL; - list = gh_cons (ly_offset2scm (bottom_curve.control_[3]), list); - list = gh_cons (ly_offset2scm (bottom_curve.control_[0]), list); - list = gh_cons (ly_offset2scm (bottom_curve.control_[1]), list); - list = gh_cons (ly_offset2scm (bottom_curve.control_[2]), list); - list = gh_cons (ly_offset2scm (top_curve.control_[0]), list); - list = gh_cons (ly_offset2scm (top_curve.control_[3]), list); - list = gh_cons (ly_offset2scm (top_curve.control_[2]), list); - list = gh_cons (ly_offset2scm (top_curve.control_[1]), list); - - SCM horizontal_bend = scm_list_n (ly_symbol2scm ("bezier-sandwich"), - ly_quote_scm (list), - gh_double2scm (0.0), - SCM_UNDEFINED); - - Interval x_extent = top_curve.extent (X_AXIS); - x_extent.unite (bottom_curve.extent (X_AXIS)); - Interval y_extent = top_curve.extent (Y_AXIS); - y_extent.unite (bottom_curve.extent (Y_AXIS)); - Box b (x_extent, y_extent); - - return Molecule (b, horizontal_bend); -} - -/* - * Horizontal Slope: - * - * /| ^ - * / | | - * / | | height - * / | | - * / | v - * | / - * | / - * (0,0) x /slope=dy/dx - * | / - * |/ - * - * <-----> - * width - */ -// TODO: Move this to class Lookup? -Molecule -Porrectus::brew_horizontal_slope (Real width, Real slope, Real height) -{ - SCM width_scm = gh_double2scm (width); - SCM slope_scm = gh_double2scm (slope); - SCM height_scm = gh_double2scm (height); - SCM horizontal_slope = scm_list_n (ly_symbol2scm ("beam"), - width_scm, slope_scm, - height_scm, SCM_UNDEFINED); - Box b (Interval (0, width), - Interval (-height/2, height/2 + width*slope)); - return Molecule (b, horizontal_slope); -} diff --git a/lily/repeated-music.cc b/lily/repeated-music.cc index 8488259923..3ae277f8f5 100644 --- a/lily/repeated-music.cc +++ b/lily/repeated-music.cc @@ -11,6 +11,7 @@ #include "music-list.hh" #include "pitch.hh" #include "debug.hh" +#include "music-sequence.hh" Music * Repeated_music::body ()const @@ -167,3 +168,33 @@ Repeated_music::Repeated_music () { 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 (); +} diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index fa75e433a7..3590d12f40 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -319,7 +319,13 @@ Simple_spacer::solve (Column_x_positions *positions) const positions->force_f_ = force_f_; if ((force_f_ < 0)) { - positions->force_f_ *= 1.3; + + /* + We used to have a penalty for compression, no matter what, but that + fucked up wtk1-fugue2 (taking 3 full pages.) + + maybe this should be tunable? + */ if (compression_penalty_b_) positions->force_f_ *= 2; // hmm. } diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index de49d2c35b..f3c69d9976 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -430,6 +430,12 @@ Spacing_spanner::find_shortest (Link_array const &cols) 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 *cols) { @@ -475,6 +481,10 @@ Spacing_spanner::do_measure (Rational shortest, Grob*me, Link_array *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) { diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index 554bc1d1f4..6457d433c3 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -1,10 +1,10 @@ /* - 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 +(c) 2000--2002 Jan Nieuwenhuizen */ #include "molecule.hh" @@ -21,14 +21,19 @@ /* 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) { @@ -64,7 +69,7 @@ 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? { @@ -83,6 +88,7 @@ Text_spanner::brew_molecule (SCM smob) width += gh_scm2double (me->get_grob_property ("width-correct")); /* /Ugh */ + // who is ecs? --hwn SCM properties = Font_interface::font_alist_chain (me); @@ -127,9 +133,15 @@ Text_spanner::brew_molecule (SCM smob) } /* 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 edge_line; s = me->get_grob_property ("edge-height"); @@ -146,12 +158,7 @@ Text_spanner::brew_molecule (SCM smob) 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); @@ -164,9 +171,10 @@ Text_spanner::brew_molecule (SCM smob) 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); @@ -184,20 +192,25 @@ Text_spanner::brew_molecule (SCM smob) */ 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 w, broken; Drul_array 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; @@ -214,7 +227,7 @@ Text_spanner::setup_pedal_bracket(Spanner *s) 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 ()) @@ -236,10 +249,10 @@ Text_spanner::setup_pedal_bracket(Spanner *s) 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. @@ -252,8 +265,8 @@ Text_spanner::setup_pedal_bracket(Spanner *s) { 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; } } @@ -264,17 +277,17 @@ Text_spanner::setup_pedal_bracket(Spanner *s) 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] ) )); } diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index ece2525443..d6a478164c 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -34,8 +34,9 @@ StaffContext=\translator { \consists "Grob_pq_engraver" \consistsend "Axis_group_engraver" - - MinimumVerticalExtent = #'(-4 . 4) + + + MinimumVerticalExtent = #'(-6 . 6) ExtraVerticalExtent = ##f VerticalExtent = ##f localKeySignature = #'() diff --git a/ly/grace-init.ly b/ly/grace-init.ly index b33942fde1..b139a85bff 100644 --- a/ly/grace-init.ly +++ b/ly/grace-init.ly @@ -15,7 +15,6 @@ startGraceMusic = { \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 diff --git a/ly/params-init.ly b/ly/params-init.ly index e4c851f7eb..29dd3cd10d 100644 --- a/ly/params-init.ly +++ b/ly/params-init.ly @@ -18,12 +18,14 @@ paperfile = \papersize + "-init.ly" \include \paperfile \include "paper-init.ly" +unit = "mm" staffspace = \staffheight / 4.0 stafflinethickness = \staffspace / 10.0 outputscale = \staffheight / 4.0 % blotdiameter = 0.4 \pt blotdiameter = 0.04 \pt +interscoreline = 4. \mm \translator { \NoteNamesContext } diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index ca4e0756a6..3297d0b433 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,15 +1,15 @@ Begin3 Title: LilyPond -Version: 1.5.45 -Entered-date: 21MRT02 +Version: 1.5.46 +Entered-date: 23MRT02 Description: @BLURB@ Keywords: music notation typesetting midi fonts engraving Author: hanwen@cs.uu.nl (Han-Wen Nienhuys) janneke@gnu.org (Jan Nieuwenhuizen) Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert - 1000k lilypond-1.5.45.tar.gz + 1000k lilypond-1.5.46.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 1000k lilypond-1.5.45.tar.gz + 1000k lilypond-1.5.46.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.mandrake.spec b/make/out/lilypond.mandrake.spec index 4d319008eb..10895b152a 100644 --- a/make/out/lilypond.mandrake.spec +++ b/make/out/lilypond.mandrake.spec @@ -1,5 +1,5 @@ %define name lilypond -%define version 1.5.45 +%define version 1.5.46 %define release 1mdk Name: %{name} diff --git a/make/out/lilypond.redhat.spec b/make/out/lilypond.redhat.spec index 4bdc2c5213..acfd4ceb79 100644 --- a/make/out/lilypond.redhat.spec +++ b/make/out/lilypond.redhat.spec @@ -3,11 +3,11 @@ %define info yes Name: lilypond -Version: 1.5.45 +Version: 1.5.46 Release: 1 License: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.5.45.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.5.46.tar.gz Summary: Create and print music notation URL: http://www.lilypond.org/ BuildRoot: /tmp/lilypond-install diff --git a/make/out/lilypond.suse.spec b/make/out/lilypond.suse.spec index 7617b7d05c..9764eec9e6 100644 --- a/make/out/lilypond.suse.spec +++ b/make/out/lilypond.suse.spec @@ -14,11 +14,11 @@ Distribution: SuSE Linux 7.0 (i386) Name: lilypond -Version: 1.5.45 +Version: 1.5.46 Release: 2 Copyright: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.5.45.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.5.46.tar.gz # music notation software for.. ? Summary: A program for printing sheet music. URL: http://www.lilypond.org/ diff --git a/mf/GNUmakefile b/mf/GNUmakefile index ab77ff12b9..5a667fe1f8 100644 --- a/mf/GNUmakefile +++ b/mf/GNUmakefile @@ -75,7 +75,7 @@ $(outdir)/lilypond.map: ## ## todo: this also depends on .tfm, FIXME. $(outdir)/%.afm $(outdir)/%.tex $(outdir)/%.dep: $(outdir)/%.log - $(PYTHON) $(buildscript-dir)/mf-to-table.py --package=$(topdir) --outdir=$(outdir) --dep $(outdir)/$(string (cdr name-mag)) " mul " "output-scale div scalefont setfont } bind def " "\n")) +;; Ugh, the Bluesky type1 fonts for computer modern use capitalized +;; postscript font names. +(define (capitalize-font-name name) + (if (equal? (substring name 0 2) "cm") + (string-upcase name) + name)) + (define (beam width slope thick) (string-append (numbers->string (list slope width thick)) " draw_beam" )) diff --git a/scm/tex.scm b/scm/tex.scm index 79f6886422..2769db1cd2 100644 --- a/scm/tex.scm +++ b/scm/tex.scm @@ -165,6 +165,13 @@ (define (header-end) (string-append + "\\def\\scaletounit{ " + (number->string (cond + ((equal? (ly-unit) "mm") (/ 72.0 25.4)) + ((equal? (ly-unit) "pt") (/ 72.0 72.27)) + (else (error "unknown unit" (ly-unit))) + )) + " mul }" "\\special{\\string! " ;; URG: ly-gulp-file: now we can't use scm output without Lily @@ -175,10 +182,7 @@ (ly-gulp-file "music-drawing-routines.ps")) (if (defined? 'ps-testing) "/testing true def%\n" "") "}" - "\\input lilyponddefs \\outputscale=\\lilypondpaperoutputscale " - ;; "pt" - "mm" - + "\\input lilyponddefs \\outputscale=\\lilypondpaperoutputscale \\lilypondpaperunit" "\\turnOnPostScript")) ;; Note: this string must match the string in ly2dvi.py!!! @@ -226,7 +230,8 @@ (embedded-ps (list 'bezier-sandwich `(quote ,l) thick))) (define (start-line ht) - (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n")) + (string-append "\\vbox to " (number->dim ht) "{\\hbox{" + "%\n")) (define (stop-line) "}\\vss}\\interscoreline\n") diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 44745f99bb..cf10c42f20 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -986,20 +986,19 @@ def system (cmd): 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 () diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index f1c795ba08..da78c42198 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -9,12 +9,6 @@ # Jan Arne Fagertun (Bourne shell script) # - -# -# TODO: should allow to set a central pk cache directory from the command line. -# TODO: should allow to switch off pk cache. -# - # # Note: gettext work best if we use ' for docstrings and " # for gettextable strings. @@ -334,7 +328,8 @@ extra_init = { 'pagenumber' : [1], 'textheight' : [], 'linewidth' : [], - 'orientation' : [] + 'orientation' : [], + 'unit' : ['pt'], } extra_fields = extra_init.keys () @@ -343,9 +338,6 @@ fields = layout_fields + extra_fields include_path = ['.'] lily_p = 1 paper_p = 1 -cache_pks_p = 1 - -PK_PATTERN='feta.*\.[0-9]+pk' output_name = '' targets = { @@ -362,11 +354,12 @@ dependency_files = [] kpse = os.popen ('kpsexpand \$TEXMF').read() kpse = re.sub('[ \t\n]+$','', kpse) +type1_paths = os.popen ('kpsewhich -expand-path=\$T1FONTS').read () environment = { ## todo: prevent multiple addition. 'TEXMF' : "{%s,%s}" % (datadir, kpse) , - 'GS_FONTPATH' : datadir + '/afm:' + datadir + '/pfa', + 'GS_FONTPATH' : type1_paths, 'GS_LIB' : datadir + '/ps', } @@ -567,14 +560,15 @@ lily output file in TFILES after that, and return the Latex file constructed. ' if extra['orientation']: orientation = extra['orientation'][0] - # set sane geometry width (a4-width) for linewidth = -1. + unit = extra['unit'][-1] + # set sane geometry width (a4-width) for linewidth = -1. maxlw = max (extra['linewidth'] + [-1]) if maxlw < 0: # who the hell is 597 ? linewidth = '597pt' else: - linewidth = maxlw - s = s + '\geometry{width=%smm%s,headheight=2mm,footskip=2mm,%s}\n' % (linewidth, textheight, orientation) + linewidth = '%d%s' % (maxlw, unit) + s = s + '\geometry{width=%s%s,headheight=2mm,footskip=2mm,%s}\n' % (linewidth, textheight, orientation) if extra['latexoptions']: s = s + '\geometry{twosideshift=4mm}\n' @@ -826,9 +820,6 @@ if files and files[0] != '-': setup_environment () tmpdir = setup_temp () - if cache_pks_p : - os.chdir (outdir) - cp_to_dir (PK_PATTERN, tmpdir) # to be sure, add tmpdir *in front* of inclusion path. #os.environ['TEXINPUTS'] = tmpdir + ':' + os.environ['TEXINPUTS'] @@ -893,9 +884,6 @@ if files and files[0] != '-': elif verbose_p: warning (_ ("can't find file: `%s'") % outname) - if cache_pks_p: - cp_to_dir (PK_PATTERN, outdir) - os.chdir (original_dir) cleanup_temp () diff --git a/stepmake/stepmake/toplevel-targets.make b/stepmake/stepmake/toplevel-targets.make index 4db0600eba..a8db4c3287 100644 --- a/stepmake/stepmake/toplevel-targets.make +++ b/stepmake/stepmake/toplevel-targets.make @@ -39,7 +39,7 @@ dist: $(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) diff --git a/tex/lily-ps-defs.tex b/tex/lily-ps-defs.tex index ed2eeb4af8..80bf79c97d 100644 --- a/tex/lily-ps-defs.tex +++ b/tex/lily-ps-defs.tex @@ -11,12 +11,6 @@ % \def\PSsetTeXdimen#1{\expandafter\special{! /#1 (\csname #1\endcsname) set_tex_dimen}} \def\lilySpace{ } - -% PostScript PT/IN: 72/25.4 -\def\scaletounit{ 2.834645 mul } - -% for true printers points to postscript points: -%\def\scaletounit{1.00375} \def\turnOnPostScript{% % This sets CTM so that you get to the currentpoint % by executing a 0 0 moveto diff --git a/tex/lilyponddefs.tex b/tex/lilyponddefs.tex index c948be1bd6..3ad96eaec7 100644 --- a/tex/lilyponddefs.tex +++ b/tex/lilyponddefs.tex @@ -40,18 +40,14 @@ % Attempt to keep lilypiecetitle together with the piece: \def\myfilbreak{\par\vfil\penalty200\vfilneg} -% stacked horizontal lines -\ifundefined{lilypondpaperinterscoreline} - \def\lilypondpaperinterscoreline{16} -\fi + \ifundefined{lilypondpaperinterscorelinefill} \def\lilypondpaperinterscorelinefill{0} \else \def\lilypondpaperinterscorelinefill{1} \fi -\def\interscoreline{\vskip\lilypondpaperinterscoreline pt plus % - \lilypondpaperinterscorelinefill fill} +\def\interscoreline{\vskip \lilypondpaperinterscoreline \lilypondpaperunit plus \lilypondpaperinterscorelinefill fill} \def\placebox#1#2#3{% \botalign{\hbox{\raise #1\leftalign{\kern #2{}#3}}}}%