From: Han-Wen Nienhuys Date: Mon, 5 Jan 2004 01:04:25 +0000 (+0000) Subject: * scm/font.scm (paper20-font-vector): add bold-narrow series (only X-Git-Tag: release/2.1.23~281 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=40e1749088af2d15d50901862fc500ceee57aa41;p=lilypond.git * scm/font.scm (paper20-font-vector): add bold-narrow series (only cmb10). * lily/lyric-extender.cc (brew_molecule): add little space before extender line. * lily/beam-quanting.cc (score_forbidden_quants): check if outer stafflines fall in any beam gaps. * scm/define-grobs.scm (all-grob-descriptions): use bold-narrow for lyric texts. --- diff --git a/ChangeLog b/ChangeLog index d677633909..32307b1730 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ +2004-01-05 Han-Wen Nienhuys + + * scm/font.scm (paper20-font-vector): add bold-narrow series (only + cmb10). + + * lily/lyric-extender.cc (brew_molecule): add little space before + extender line. + + * lily/beam-quanting.cc (score_forbidden_quants): check if + outer stafflines fall in any beam gaps. + + * scm/define-grobs.scm (all-grob-descriptions): use bold-narrow + for lyric texts. + 2004-01-04 Han-Wen Nienhuys + * VERSION: 2.1.6 released. + * lily/beam-quanting.cc (quanting): add inspect-quants property: this shows the demerits of a user-defined beam position pair. diff --git a/input/mutopia/F.Schubert/morgenlied.ly b/input/mutopia/F.Schubert/morgenlied.ly index 64d5b3466b..9cebde2262 100644 --- a/input/mutopia/F.Schubert/morgenlied.ly +++ b/input/mutopia/F.Schubert/morgenlied.ly @@ -92,7 +92,7 @@ pianoRH = \notes \relative c''' \repeat volta 2 { r8_\> << { s8 s8-\! } << { fis( g) } \\ { c,4 } >> >> r8 | 4. r8 \clef bass | - e,16_" "_\markup { \italic cresc } g c g e g d gis b gis d gis | + e,16_" "_\markup { \bold\italic cresc } g c g e g d gis b gis d gis | c, e a e c e a,-\f d fis d a d | b d g d b g r4\fermata \clef treble g''8 | as4.( g 4.) | fis4. r4 8 ( | @@ -148,12 +148,12 @@ pianoLH = \notes \relative c'' \repeat volta 2 { \translator { \LyricsVoiceContext minimumVerticalExtent = #'(-1.0 . 0) - LyricText \set #'font-size = #1.0 } \translator { \ScoreContext Beam \override #'thickness = #0.6 SpacingSpanner \set #'spacing-increment = #1.0 + Slur \set #'height-limit = #1.0 } \translator { \PianoStaffContext VerticalAlignment \override #'forced-distance = #10 diff --git a/lily/beam-quanting.cc b/lily/beam-quanting.cc index e9ce438404..54b308f326 100644 --- a/lily/beam-quanting.cc +++ b/lily/beam-quanting.cc @@ -31,7 +31,6 @@ const int DAMPING_DIRECTIION_PENALTY = 800; const int MUSICAL_DIRECTION_FACTOR = 400; const int IDEAL_SLOPE_FACTOR = 10; -// #define DEBUG_QUANTING 1 extern bool debug_beam_quanting_flag; static Real @@ -277,8 +276,6 @@ Beam::quanting (SCM smob) } if (mindist > 1e5) programming_error ("Could not find quant."); - else - qscores[best_idx].score_card_ += to_string ("i%d", best_idx); } #endif @@ -288,6 +285,8 @@ Beam::quanting (SCM smob) #if DEBUG_QUANTING if (debug_beam_quanting_flag) { + qscores[best_idx].score_card_ += to_string ("i%d", best_idx); + // debug quanting me->set_grob_property ("quant-score", scm_makfrom0str (qscores[best_idx].score_card_.to_str0 ())); @@ -401,17 +400,49 @@ Beam::score_forbidden_quants (Real yl, Real yr, Direction ldir, Direction rdir) { Real dy = yr - yl; - - Real extra_demerit = SECONDARY_BEAM_DEMERIT / beam_count; + Drul_array y(yl,yr); + Drul_array dirs(ldir,rdir); + Real extra_demerit = SECONDARY_BEAM_DEMERIT / beam_count; + + /* + Inside the staff, inter quants are forbidden. + */ Real dem = 0.0; - for (int i = 0; i < 2; i++) + Direction d = LEFT; + do { - Real y = i? yl : yr; - if (fabs (y) <= (radius + 0.5) && fabs ( my_modf (y) - 0.5) < 1e-3) + if (fabs (y[d]) <= (radius + 0.5) && fabs (my_modf (y[d]) - 0.5) < 1e-3) dem += INTER_QUANT_PENALTY; } + while ((flip (&d))!= LEFT); + + for (int j = 1; j <= beam_count; j++) + { + do + { + /* + see if the outer staffline falls in a beam-gap + + This test is too weak; we should really check all lines. + */ + Direction stem_dir = dirs[d]; + Real gap1 = y[d] - stem_dir * ((j-1) * beam_translation + thickness / 2 - slt/2 ); + Real gap2 = y[d] - stem_dir * (j * beam_translation - thickness / 2 + slt/2); + + Interval gap; + gap.add_point (gap1); + gap.add_point (gap2); + + if (gap.elem_b (radius)) + dem += extra_demerit; + } + while ((flip (&d))!= LEFT); + } + + + // todo: use beam_count of outer stems. if (beam_count >= 2) { @@ -420,69 +451,52 @@ Beam::score_forbidden_quants (Real yl, Real yr, Real inter = 0.5; Real hang = 1.0 - (thickness - slt) / 2; - if (fabs (yl - ldir * beam_translation) < radius - && fabs (my_modf (yl) - inter) < 1e-3) - dem += extra_demerit; - if (fabs (yr - rdir * beam_translation) < radius - && fabs (my_modf (yr) - inter) < 1e-3) - dem += extra_demerit; - 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 valid when we - have different beam-thicknesses.) - - --hwn - */ - - // hmm, without Interval/Drul_array, you get ~ 4x same code... - if (fabs (yl - ldir * beam_translation) < radius + inter) + if (fabs (y[LEFT] - dirs[LEFT] * beam_translation) < radius + inter) { - if (ldir == UP && dy <= eps - && fabs (my_modf (yl) - sit) < eps) + if (dirs[LEFT] == UP && dy <= eps + && fabs (my_modf (y[LEFT]) - sit) < eps) dem += extra_demerit; - if (ldir == DOWN && dy >= eps - && fabs (my_modf (yl) - hang) < eps) + if (dirs[LEFT] == DOWN && dy >= eps + && fabs (my_modf (y[LEFT]) - hang) < eps) dem += extra_demerit; } - if (fabs (yr - rdir * beam_translation) < radius + inter) + if (fabs (y[RIGHT] - dirs[RIGHT] * beam_translation) < radius + inter) { - if (rdir == UP && dy >= eps - && fabs (my_modf (yr) - sit) < eps) + if (dirs[RIGHT] == UP && dy >= eps + && fabs (my_modf (y[RIGHT]) - sit) < eps) dem += extra_demerit; - if (rdir == DOWN && dy <= eps - && fabs (my_modf (yr) - hang) < eps) + if (dirs[RIGHT] == DOWN && dy <= eps + && fabs (my_modf (y[RIGHT]) - hang) < eps) dem += extra_demerit; } if (beam_count >= 3) { - if (fabs (yl - 2 * ldir * beam_translation) < radius + inter) + if (fabs (y[LEFT] - 2 * dirs[LEFT] * beam_translation) < radius + inter) { - if (ldir == UP && dy <= eps - && fabs (my_modf (yl) - straddle) < eps) + if (dirs[LEFT] == UP && dy <= eps + && fabs (my_modf (y[LEFT]) - straddle) < eps) dem += extra_demerit; - if (ldir == DOWN && dy >= eps - && fabs (my_modf (yl) - straddle) < eps) + if (dirs[LEFT] == DOWN && dy >= eps + && fabs (my_modf (y[LEFT]) - straddle) < eps) dem += extra_demerit; } - if (fabs (yr - 2 * rdir * beam_translation) < radius + inter) + if (fabs (y[RIGHT] - 2 * dirs[RIGHT] * beam_translation) < radius + inter) { - if (rdir == UP && dy >= eps - && fabs (my_modf (yr) - straddle) < eps) + if (dirs[RIGHT] == UP && dy >= eps + && fabs (my_modf (y[RIGHT]) - straddle) < eps) dem += extra_demerit; - if (rdir == DOWN && dy <= eps - && fabs (my_modf (yr) - straddle) < eps) + if (dirs[RIGHT] == DOWN && dy <= eps + && fabs (my_modf (y[RIGHT]) - straddle) < eps) dem += extra_demerit; } } diff --git a/lily/beam.cc b/lily/beam.cc index 517896e80c..5361db25b5 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -44,7 +44,6 @@ Notes: #include "warn.hh" -#define DEBUG_QUANTING 1 bool debug_beam_quanting_flag; @@ -487,8 +486,11 @@ Beam::brew_molecule (SCM grob) the_beam.translate_axis (pos[LEFT], Y_AXIS); #if (DEBUG_QUANTING) - if (debug_beam_quanting_flag) + SCM quant_score = me->get_grob_property ("quant-score"); + if (debug_beam_quanting_flag + && gh_string_p (quant_score)) { + /* This code prints the demerits for each beam. Perhaps this should be switchable for those who want to twiddle with the @@ -498,7 +500,7 @@ Beam::brew_molecule (SCM grob) SCM properties = Font_interface::font_alist_chain (me); Molecule tm = *unsmob_molecule (Text_item::interpret_markup - (me->get_paper ()->self_scm (), properties, me->get_grob_property ("quant-score"))); + (me->get_paper ()->self_scm (), properties, quant_score)); the_beam.add_at_edge (Y_AXIS, UP, tm, 5.0, 0); } #endif diff --git a/lily/include/beam.hh b/lily/include/beam.hh index 72728d799f..1bfe58ae84 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -74,6 +74,7 @@ private: const int REGION_SIZE = 2; +#define DEBUG_QUANTING 1 #endif /* BEAM_HH */ diff --git a/lily/lyric-extender.cc b/lily/lyric-extender.cc index 9471946c10..adb6340357 100644 --- a/lily/lyric-extender.cc +++ b/lily/lyric-extender.cc @@ -37,10 +37,15 @@ Lyric_extender::brew_molecule (SCM smob) */ Real right_point = r->extent (common, X_AXIS) [(Note_head::has_interface (r)) ? RIGHT : LEFT]; - - Real w = right_point - left_point; Real h = sl * gh_scm2double (me->get_grob_property ("thickness")); + + right_point += h; + + Real w = right_point - left_point; + + if (w < 0) + return SCM_EOL; Molecule mol (Lookup::round_filled_box (Box (Interval (0,w), Interval (0,h)), 0.8 * h)); diff --git a/mf/GNUmakefile b/mf/GNUmakefile index 393495a7c0..19583e3c72 100644 --- a/mf/GNUmakefile +++ b/mf/GNUmakefile @@ -51,7 +51,7 @@ INSTALLATION_OUT_DIR3=$(local_lilypond_datadir)/fonts/tfm INSTALLATION_OUT_FILES3=$(TFM_FILES) -SAUTER_FONTS = cmbxti7 +SAUTER_FONTS = cmbxti8 ALL_FONTS = $(FETA_FONTS) $(SAUTER_FONTS) diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index e54b224c80..f8e846082f 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -494,6 +494,7 @@ (self-alignment-X . 0) (word-space . 0.6) (font-family . roman) + (font-series . bold-narrow) (font-shape . upright) (meta . ((interfaces . (rhythmic-grob-interface lyric-syllable-interface self-alignment-interface text-interface font-interface item-interface )))) diff --git a/scm/font.scm b/scm/font.scm index 41784a0bc2..0592c0110a 100644 --- a/scm/font.scm +++ b/scm/font.scm @@ -61,7 +61,7 @@ or (12.0 . "cmtt12") ))) (#(bold italic roman) . - (10.0 . #((8.0 . "cmbxti7") + (10.0 . #((8.0 . "cmbxti8") (10.0 . "cmbxti10") (14.0 . "cmbxti14") ))) @@ -76,6 +76,9 @@ or (10.0 . "cmbx10") (12.0 . "cmbx12") ))) + (#(bold-narrow upright roman) . + (10.0 . #((10.0 . "cmb10") + ))) (#(medium caps roman) . (10.0 . #((10.0 . "cmcsc10"))))