From 5249785633e818fc67096ddda5d72de525933f2f Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 18 Jan 2004 12:04:11 +0000 Subject: [PATCH] * input/regression/rehearsal-mark-number.ly: new file. * input/regression/rehearsal-mark-letter.ly: new file. * scm/translation-functions.scm (number->mark-string): new function (format-mark-letters): new function (format-mark-numbers): new function * lily/mark-engraver.cc (process_music): rehearsalMark is now integer; formatting is done through markFormatter property. * scm/define-translator-properties.scm: fold all *-done properties into positioning-done. * lily/beam.cc (position_beam): new function (brew_molecule): make sure that positions are calced before making the molecule. * ps/music-drawing-routines.ps: take blot as 4th argument. * lily/beam.cc (brew_molecule): fix beam offsets: overlap with the stem do avoid small dents. --- ChangeLog | 30 +++++++ VERSION | 2 +- input/regression/rehearsal-mark-letter.ly | 30 +++++++ input/regression/rehearsal-mark-number.ly | 33 +++++++ input/regression/rehearsal-mark.ly | 29 ------- lily/accidental-placement.cc | 6 +- lily/align-interface.cc | 10 +-- lily/beam.cc | 55 +++++++----- lily/break-align-interface.cc | 8 +- lily/dot-column.cc | 6 +- lily/include/beam.hh | 2 +- lily/include/lookup.hh | 2 +- lily/lookup.cc | 6 +- lily/mark-engraver.cc | 100 +++++++--------------- lily/note-collision.cc | 6 +- lily/rest-collision.cc | 6 +- lily/stem-tremolo.cc | 4 +- ly/engraver-init.ly | 7 +- ps/music-drawing-routines.ps | 9 +- scm/define-grob-properties.scm | 8 +- scm/define-translator-properties.scm | 7 +- scm/molecule.scm | 14 +-- scm/output-pdf.scm | 2 +- scm/output-pdftex.scm | 4 +- scm/output-ps.scm | 4 +- scm/output-sketch.scm | 2 +- scm/output-tex.scm | 4 +- scm/translation-functions.scm | 33 ++++++- 28 files changed, 246 insertions(+), 183 deletions(-) create mode 100644 input/regression/rehearsal-mark-letter.ly create mode 100644 input/regression/rehearsal-mark-number.ly delete mode 100644 input/regression/rehearsal-mark.ly diff --git a/ChangeLog b/ChangeLog index 129bdae74e..4dcc8561a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,35 @@ +2004-01-18 Han-Wen Nienhuys + + * input/regression/rehearsal-mark-number.ly: new file. + + * input/regression/rehearsal-mark-letter.ly: new file. + + * scm/translation-functions.scm (number->mark-string): new function + (format-mark-letters): new function + (format-mark-numbers): new function + + * lily/mark-engraver.cc (process_music): rehearsalMark is now + integer; formatting is done through markFormatter property. + + * scm/define-translator-properties.scm: fold all *-done properties + into positioning-done. + + * lily/beam.cc (position_beam): new function + (brew_molecule): make sure that positions are calced before making + the molecule. + + * scm/output*.scm (beam): take 4th argument for function. + + * ps/music-drawing-routines.ps: take blot as 4th argument. + + * lily/beam.cc (brew_molecule): fix beam offsets: overlap with the + stem do avoid small dents. + + 2004-01-17 Han-Wen Nienhuys + * VERSION: release 2.1.11 + * input/regression/balloon.ly: new file. * lily/balloon.cc (brew_molecule): new file: draw boxes around diff --git a/VERSION b/VERSION index bcf807ce68..9ae81bfaf8 100644 --- a/VERSION +++ b/VERSION @@ -2,5 +2,5 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=1 PATCH_LEVEL=11 -MY_PATCH_LEVEL= +MY_PATCH_LEVEL=hwn1 diff --git a/input/regression/rehearsal-mark-letter.ly b/input/regression/rehearsal-mark-letter.ly new file mode 100644 index 0000000000..3ee5d35e9e --- /dev/null +++ b/input/regression/rehearsal-mark-letter.ly @@ -0,0 +1,30 @@ + + +\header { texidoc= "Rehearsal marks in letter style: the I is skipped, +and after Z, we continue with double letters. The mark may be set +with @code{\mark NUMBER}, or with @code{Score.rehearsalMark}." + } + +\version "2.1.7" + + +global = \notes { + s1 | \mark #6 + s1 | \mark \default + s1 | \mark \default + s1 | \mark \default + \property Score.rehearsalMark = #24 + s1 | \mark \default + s1 | \mark \default + } + + +one = \notes \relative c { + c''1 c c c c c c +} + + +\score{ +\context Staff << \global \one >> +} + diff --git a/input/regression/rehearsal-mark-number.ly b/input/regression/rehearsal-mark-number.ly new file mode 100644 index 0000000000..b48fddb6e5 --- /dev/null +++ b/input/regression/rehearsal-mark-number.ly @@ -0,0 +1,33 @@ +\header { texidoc= " + +Marks can be printed as numbers. +By setting @code{markFormatter} we may choose a different style of mark printing. Also, marks can be specified manually, with a markup argument" + + } + +\version "2.1.7" + + +global = \notes { + \property Score.markFormatter = #format-mark-numbers + s1 | \mark \markup { \musicglyph #"scripts-coda" } + s1 | \mark \default + s1 | \mark \default + \property Score.markFormatter + = #(lambda (mark context) + (make-bold-markup (make-box-markup (number->string mark)))) + + s1 | \mark \default + s1 | \mark \default + } + + +one = \notes \relative c { + c''1 c c c c c c +} + + +\score{ +\context Staff << \global \one >> +} + diff --git a/input/regression/rehearsal-mark.ly b/input/regression/rehearsal-mark.ly deleted file mode 100644 index 4969852dce..0000000000 --- a/input/regression/rehearsal-mark.ly +++ /dev/null @@ -1,29 +0,0 @@ - - -\header { texidoc= " Rehearsal marks are printed over barlines. They -can be incremented automatically or manually. "} - - -\version "2.1.7" - - -global = \notes { - s1 | \mark "A" - s1 | \mark \default - s1 | \mark \default - s1 | \mark "12" - s1 | \mark \default - s1 | \mark "A2" - s1 | \mark \markup { mark \column < up \bold down > } - s1 -} - -one = \notes \relative c { - c''1 c c c c c c -} - - -\score{ -\context Staff << \global \one >> -} - diff --git a/lily/accidental-placement.cc b/lily/accidental-placement.cc index 13aef52ad4..46c765daf2 100644 --- a/lily/accidental-placement.cc +++ b/lily/accidental-placement.cc @@ -27,9 +27,9 @@ Accidental_placement::alignment_callback(SCM s, SCM ) Grob * me =unsmob_grob (s); Grob * par = me->get_parent (X_AXIS); - if (!to_boolean (par->get_grob_property ("alignment-done"))) + if (!to_boolean (par->get_grob_property ("positioning-done"))) { - par->set_grob_property ("alignment-done", SCM_BOOL_T); + par->set_grob_property ("positioning-done", SCM_BOOL_T); position_accidentals (par); } @@ -450,4 +450,4 @@ Accidental_placement::position_accidentals (Grob * me) ADD_INTERFACE(Accidental_placement, "accidental-placement-interface", "Take care of complex accidental collisions.", - "left-padding padding right-padding accidental-grobs alignment-done") + "left-padding padding right-padding accidental-grobs positioning-done") diff --git a/lily/align-interface.cc b/lily/align-interface.cc index 68ee8e506a..3b020ea677 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -21,7 +21,7 @@ Align_interface::alignment_callback (SCM element_smob, SCM axis) Grob * me = unsmob_grob (element_smob); Axis ax = (Axis)gh_scm2int (axis); Grob * par = me->get_parent (ax); - if (par && !to_boolean (par->get_grob_property ("alignment-done"))) + if (par && !to_boolean (par->get_grob_property ("positioning-done"))) { Align_interface::align_elements_to_extents (par, ax); } @@ -35,7 +35,7 @@ Align_interface::fixed_distance_alignment_callback (SCM element_smob, SCM axis) Grob * me = unsmob_grob (element_smob); Axis ax = (Axis)gh_scm2int (axis); Grob * par = me->get_parent (ax); - if (par && !to_boolean (par->get_grob_property ("alignment-done"))) + if (par && !to_boolean (par->get_grob_property ("positioning-done"))) { Align_interface::align_to_fixed_distance (par, ax); } @@ -48,7 +48,7 @@ Align_interface::fixed_distance_alignment_callback (SCM element_smob, SCM axis) void Align_interface::align_to_fixed_distance (Grob *me , Axis a) { - me->set_grob_property ("alignment-done", SCM_BOOL_T); + me->set_grob_property ("positioning-done", SCM_BOOL_T); SCM d = me->get_grob_property ("stacking-dir"); @@ -126,7 +126,7 @@ Align_interface::align_to_fixed_distance (Grob *me , Axis a) void Align_interface::align_elements_to_extents (Grob * me, Axis a) { - me->set_grob_property ("alignment-done", SCM_BOOL_T); + me->set_grob_property ("positioning-done", SCM_BOOL_T); SCM d = me->get_grob_property ("stacking-dir"); @@ -286,7 +286,7 @@ find_fixed_alignment_parent (Grob *g) ADD_INTERFACE (Align_interface, "align-interface", " Order grobs top to bottom/left to right/right to left etc.", - "forced-distance stacking-dir align-dir threshold alignment-done center-element elements axes"); + "forced-distance stacking-dir align-dir threshold positioning-done center-element elements axes"); struct Foobar diff --git a/lily/beam.cc b/lily/beam.cc index 7cb3901635..e049696eb8 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -300,6 +300,8 @@ SCM Beam::brew_molecule (SCM grob) { Grob *me = unsmob_grob (grob); + position_beam (me); + Link_array stems= Pointer_group_interface__extract_grobs (me, (Grob*)0, "stems"); Grob* xcommon = common_refpoint_of_array (stems, me, X_AXIS); @@ -335,7 +337,7 @@ Beam::brew_molecule (SCM grob) SCM last_beaming = SCM_EOL;; Real last_xposn = -1; - Real last_width = -1 ; + Real last_stem_width = -1 ; Real gap_length =0.0; SCM scm_gap = me->get_grob_property ("gap"); @@ -392,29 +394,28 @@ Beam::brew_molecule (SCM grob) how much to stick out for beams across linebreaks */ Real break_overshoot = 3.0; - Real w = (i>0 && st)? xposn - last_xposn : break_overshoot; - Real stem_offset = 0.0; - Real width_corr = 0.0; - if (i == 1) - { - stem_offset -= last_width/2; - width_corr += last_width/2; - } - - if (i == stems.size() -1) + Real w = (i > 0 && st) ? xposn - last_xposn : break_overshoot; + + Real stem_offset =0.0; + if (i > 0) { - width_corr += stem_width/2; + w += last_stem_width / 2; + stem_offset = -last_stem_width / 2; } - - Molecule whole = Lookup::beam (dydx, w + width_corr, thick); + if (st) + w += stem_width/ 2 ; + + + Real blot = me->get_paper ()->get_realvar (ly_symbol2scm ("blotdiameter")); + Molecule whole = Lookup::beam (dydx, w, thick, blot); Molecule gapped; int gap_count = 0; if (gh_number_p (me->get_grob_property ("gap-count"))) { gap_count = gh_scm2int (me->get_grob_property ("gap-count")); - gapped = Lookup::beam (dydx, w + width_corr - 2 * gap_length, thick); + gapped = Lookup::beam (dydx, w - 2 * gap_length, thick, blot); full_beams.sort (default_compare); if (stem_dir == UP) @@ -459,7 +460,7 @@ Beam::brew_molecule (SCM grob) Real w = (i>0 && st) ? (xposn - last_xposn) : break_overshoot; w = w/2 get_grob_property ("positioning-done"))) + return ; + + me->set_grob_property ("positioning-done", SCM_BOOL_T); + /* Copy to mutable list. */ SCM s = ly_deep_copy (me->get_grob_property ("positions")); me->set_grob_property ("positions", s); if (ly_car (s) == SCM_BOOL_F) { - // one wonders if such genericity is necessary --hwn. SCM callbacks = me->get_grob_property ("position-callbacks"); for (SCM i = callbacks; gh_pair_p (i); i = ly_cdr (i)) - gh_call1 (ly_car (i), smob); + gh_call1 (ly_car (i), me->self_scm ()); } set_stem_lengths (me); - return SCM_UNSPECIFIED; } @@ -1556,6 +1567,6 @@ ADD_INTERFACE (Beam, "beam-interface", "the ideal slope, how close the result is to the ideal stems, etc.). We " "take the best scoring combination. " , - "knee position-callbacks concaveness-gap concaveness-threshold dir-function quant-score auto-knee-gap gap gap-count chord-tremolo beamed-stem-shorten shorten least-squares-dy damping flag-width-function neutral-direction positions space-function thickness"); + "knee positioning-done position-callbacks concaveness-gap concaveness-threshold dir-function quant-score auto-knee-gap gap gap-count chord-tremolo beamed-stem-shorten shorten least-squares-dy damping flag-width-function neutral-direction positions space-function thickness"); diff --git a/lily/break-align-interface.cc b/lily/break-align-interface.cc index 4742c948a6..07a99d272f 100644 --- a/lily/break-align-interface.cc +++ b/lily/break-align-interface.cc @@ -32,9 +32,9 @@ Break_align_interface::alignment_callback (SCM element_smob, SCM axis) assert (a == X_AXIS); Grob *par = me->get_parent (a); - if (par && !to_boolean (par->get_grob_property ("break-alignment-done"))) + if (par && !to_boolean (par->get_grob_property ("positioning-done"))) { - par->set_grob_property ("break-alignment-done", SCM_BOOL_T); + par->set_grob_property ("positioning-done", SCM_BOOL_T); Break_align_interface::do_alignment (par); } @@ -253,11 +253,11 @@ ADD_INTERFACE (Break_aligned_interface, "break-aligned-interface", "\n" "Rules for this spacing are much more complicated than this. \n" "See [Wanske] page 126 -- 134, [Ross] pg 143 -- 147\n", - "break-align-symbol break-alignment-done space-alist"); + "break-align-symbol space-alist"); ADD_INTERFACE (Break_align_interface, "break-alignment-interface", "See @ref{break-aligned-interface}.", - "break-alignment-done"); + "positioning-done"); diff --git a/lily/dot-column.cc b/lily/dot-column.cc index f74c6451ae..bf7170e625 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -32,9 +32,9 @@ Dot_column::force_shift_callback (SCM element_smob, SCM axis) assert (a == Y_AXIS); me = me->get_parent (X_AXIS); - if (!to_boolean (me->get_grob_property ("collision-done"))) + if (!to_boolean (me->get_grob_property ("positioning-done"))) { - me->set_grob_property ("collision-done", SCM_BOOL_T); + me->set_grob_property ("positioning-done", SCM_BOOL_T); do_shifts (me); } @@ -291,5 +291,5 @@ Dot_column::add_head (Grob * me, Grob *rh) ADD_INTERFACE (Dot_column, "dot-column-interface", "Interface that groups dots so they form a column", - "collision-done direction stem"); + "positioning-done direction stem"); diff --git a/lily/include/beam.hh b/lily/include/beam.hh index e925205042..ed610a9975 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -29,7 +29,7 @@ public: static void set_beaming (Grob*,Beaming_info_list *); static void set_stemlens (Grob*); static int get_beam_count (Grob*me); - + static void position_beam (Grob* me); static Real get_beam_translation (Grob*me); static Real get_thickness (Grob*me); diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index 5c237fb162..43d5f68761 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -26,7 +26,7 @@ struct Lookup static Molecule slur (Bezier controls, Real cthick, Real thick); static Molecule bezier_sandwich (Bezier top_curve, Bezier bottom_curve); static Molecule horizontal_slope (Real width, Real slope, Real height); - static Molecule beam (Real slope, Real width, Real thick); + static Molecule beam (Real slope, Real width, Real thick, Real blot); static Molecule dashed_slur (Bezier, Real thick, Real dash); static Molecule blank (Box b); static Molecule filled_box (Box b); diff --git a/lily/lookup.cc b/lily/lookup.cc index caa1996ed4..0e8a40acb8 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -40,22 +40,20 @@ Lookup::dot (Offset p, Real radius) } Molecule -Lookup::beam (Real slope, Real width, Real thick) +Lookup::beam (Real slope, Real width, Real thick, Real blot) { Real height = slope * width; Real min_y = (0 ? height) + thick/2; - - Box b (Interval (0, width), Interval (min_y, max_y)); - SCM at = scm_list_n (ly_symbol2scm ("beam"), gh_double2scm (width), gh_double2scm (slope), gh_double2scm (thick), + gh_double2scm (blot), SCM_UNDEFINED); return Molecule (b, at); } diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index f2808db119..705d96a0e3 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -7,18 +7,13 @@ */ #include + #include "bar-line.hh" -#include "staff-symbol.hh" #include "engraver-group-engraver.hh" #include "engraver.hh" -#include "lily-guile.hh" -#include "paper-column.hh" -#include "paper-def.hh" -#include "side-position-interface.hh" -#include "staff-symbol-referencer.hh" #include "item.hh" -#include "group-interface.hh" +#include "warn.hh" #include "text-item.hh" /** @@ -36,11 +31,11 @@ protected: virtual void stop_translation_timestep (); virtual void acknowledge_grob (Grob_info); void create_items (Music*); - virtual bool try_music (Music *req); + virtual bool try_music (Music *ev); virtual void process_music (); private: - Music * mark_req_; + Music * mark_ev_; }; @@ -50,7 +45,7 @@ private: Mark_engraver::Mark_engraver () { text_ =0; - mark_req_ = 0; + mark_ev_ = 0; } void @@ -77,7 +72,7 @@ Mark_engraver::stop_translation_timestep () typeset_grob (text_); text_ =0; } - mark_req_ = 0; + mark_ev_ = 0; } @@ -95,7 +90,7 @@ Mark_engraver::create_items (Music *rq) bool Mark_engraver::try_music (Music* r) { - mark_req_ = r; + mark_ev_ = r; return true; } @@ -110,79 +105,42 @@ Mark_engraver::try_music (Music* r) void Mark_engraver::process_music () { - if (mark_req_) + if (mark_ev_) { - create_items (mark_req_); + create_items (mark_ev_); /* automatic marks. */ + - SCM m = mark_req_->get_mus_property ("label"); - if (Text_item::markup_p (m)) - { - text_->set_grob_property ("text",m); - } - else + SCM m = mark_ev_->get_mus_property ("label"); + SCM proc = get_property ("markFormatter"); + if (!Text_item::markup_p (m) && + gh_procedure_p (proc)) { - String t ; - - if (!gh_string_p (m) && !gh_number_p (m)) + if (!gh_number_p (m)) m = get_property ("rehearsalMark"); - - if (gh_number_p (m)) + + if (scm_integer_p (m) == SCM_BOOL_T + && scm_exact_p (m) == SCM_BOOL_T) { int mark_count = gh_scm2int (m); - t = to_string (mark_count); mark_count ++; - m = gh_int2scm (mark_count); - } - else if (gh_string_p (m)) - { - t = ly_scm2string (m); - String next; - if (t.length ()) - { - char c = t[0]; - c++; - t = to_string (c); - } - m = scm_makfrom0str (t.to_str0 ()); + daddy_trans_->set_property ("rehearsalMark", + gh_int2scm (mark_count)); } - else - { - m = gh_int2scm (1); - t = to_string (1); - } - - text_->set_grob_property ("text", - scm_makfrom0str (t.to_str0 ())); - SCM series = SCM_EOL; - SCM family = ly_symbol2scm ("number"); - for (int i=0; i < t.length (); i++) - { - if (!isdigit (t[i])) - { - /* - This looks strange, since \mark "A" - isn't printed in bold. - - */ - - // series = ly_symbol2scm ("bold"); - family = ly_symbol2scm ("roman"); - break; - } - } - if (gh_symbol_p (series)) - text_->set_grob_property ("font-series", series); - if (gh_symbol_p (family)) - text_->set_grob_property ("font-family", family); + if (gh_number_p (m)) + m = scm_call_2 (proc, m, daddy_trans_->self_scm ()); + else + warning ("rehearsalMark does not have integer value."); } - if (gh_number_p (m) || gh_string_p (m)) - daddy_trans_->set_property ("rehearsalMark", m); + if (Text_item::markup_p (m)) + text_->set_grob_property ("text", m); + else + warning ("Mark label should be markup object."); } } @@ -191,5 +149,5 @@ ENTER_DESCRIPTION(Mark_engraver, /* creats*/ "RehearsalMark", /* accepts */ "mark-event", /* acks */ "bar-line-interface", -/* reads */ "rehearsalMark stavesFound", +/* reads */ "rehearsalMark markFormatter stavesFound", /* write */ ""); diff --git a/lily/note-collision.cc b/lily/note-collision.cc index 5d9290904b..50958af832 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -28,9 +28,9 @@ Note_collision_interface::force_shift_callback (SCM element_smob, SCM axis) me = me->get_parent (a); - if (! to_boolean (me->get_grob_property ("collision-done"))) + if (! to_boolean (me->get_grob_property ("positioning-done"))) { - me->set_grob_property ("collision-done", SCM_BOOL_T); + me->set_grob_property ("positioning-done", SCM_BOOL_T); do_shifts (me); } @@ -444,4 +444,4 @@ ADD_INTERFACE (Note_collision_interface, "note-collision-interface", "directions and horizontal shifts. Most of the interesting properties " "are to be set in @ref{note-column-interface}: these are " "@code{force-hshift} and @code{horizontal-shift}. ", - "merge-differently-dotted merge-differently-headed collision-done"); + "merge-differently-dotted merge-differently-headed positioning-done"); diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 31a83715db..6a7eceecab 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -29,9 +29,9 @@ Rest_collision::force_shift_callback (SCM element_smob, SCM axis) Grob * rc = unsmob_grob (them->get_grob_property ("rest-collision")); - if (rc && !to_boolean (rc->get_grob_property ("rest-collision-done"))) + if (rc && !to_boolean (rc->get_grob_property ("positioning-done"))) { - rc->set_grob_property ("rest-collision-done", SCM_BOOL_T); + rc->set_grob_property ("positioning-done", SCM_BOOL_T); do_shift (rc); } @@ -243,5 +243,5 @@ Rest_collision::do_shift (Grob *me) ADD_INTERFACE (Rest_collision,"rest-collision-interface", "Move around ordinary rests (not multi-measure-rests) to avoid " "conflicts.", - "maximum-rest-count minimum-distance rest-collision-done elements"); + "maximum-rest-count minimum-distance positioning-done elements"); diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 445926bbad..6ca35377f9 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -82,10 +82,12 @@ Stem_tremolo::raw_molecule (Grob *me) Real ss = Staff_symbol_referencer::staff_space (me); Real thick = gh_scm2double (me->get_grob_property ("beam-thickness")); Real width = gh_scm2double (me->get_grob_property ("beam-width")); + Real blot = me->get_paper ()->get_realvar (ly_symbol2scm ("blotdiameter")); + width *= ss; thick *= ss; - Molecule a (Lookup::beam (dydx, width, thick)); + Molecule a (Lookup::beam (dydx, width, thick, blot)); a.translate (Offset (-width/2, width / 2 * dydx)); int tremolo_flags = 0; diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 19b561b567..6722db4821 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -475,7 +475,8 @@ AncientRemoveEmptyStaffContext = \translator { fingeringOrientations = #'(up down) tupletNumberFormatFunction = #denominator-tuplet-formatter - + markFormatter = #format-mark-letters + rehearsalMark = #1 subdivideBeams = ##f allowBeamBreak = ##f extraNatural = ##t @@ -523,9 +524,7 @@ AncientRemoveEmptyStaffContext = \translator { %% bassFigureFormatFunction = #make-bass-figure-markup - metronomeMarkFormatter = #make-metronome-markup - - + metronomeMarkFormatter = #format-metronome-markup graceSettings = #`#( (Voice Stem direction 1) diff --git a/ps/music-drawing-routines.ps b/ps/music-drawing-routines.ps index b665aff49a..f3cae4c6a0 100644 --- a/ps/music-drawing-routines.ps +++ b/ps/music-drawing-routines.ps @@ -90,14 +90,9 @@ } bind def % Nice beam with rounded corners -/draw_beam % slope width thick +/draw_beam % slope width thick blot { - currentdict /testing known { - %% real thin lines for testing - /blot 0.005 def - }{ - /blot blot-diameter def - } ifelse + /blot exch def blot setlinewidth 0 setlinecap diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index d5809adf65..5141b56c17 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -68,7 +68,6 @@ the grob to the nearest open space. (grob-property-description 'after-line-breaking-callback procedure? "Procedure taking a grob as argument. This procedure is called (using dependency resolution) after line breaking. Return value is ignored.") (grob-property-description 'align-dir ly:dir? "Which side to align? -1: left side, 0: around center of width, 1: right side.") -(grob-property-description 'alignment-done boolean? "boolean to administrate whether we've done the alignment already (to ensure that the process is done only once).") (grob-property-description 'all-elements grob-list? "list of all grobs in this line. Needed for protecting grobs from GC.") (grob-property-description 'arch-angle number? "turning angle of the hook of a system brace" ) (grob-property-description 'arch-height ly:dimension? "height of the hook of a system brace.") @@ -511,7 +510,6 @@ columns. (grob-property-description 'right-items grob-list? "") (grob-property-description 'cause scheme? "Any kind of causation objects (i.e. music, or perhaps translator) that was the cause for this grob. ") (grob-property-description 'font ly:font-metric? "Cached font metric object") -(grob-property-description 'break-alignment-done boolean? "mark flag to signal we've done alignment already.") (grob-property-description 'staff-padding ly:dimension? "Maintain this much space to the staff. It's effect is similar to @@ -520,10 +518,12 @@ staff in a row more often, when the heights of the notes vary. ") (grob-property-description 'staff-symbol ly:grob? "the staff symbol grob that we're in.") -(grob-property-description 'collision-done boolean? "") +(grob-property-description 'positioning-done boolean? + "Used to signal that a positioning element +did it's job. This ensures that a positioning is only done once.") + (grob-property-description 'rest ly:grob? "the staff symbol grob that we're in.") (grob-property-description 'rest-collision ly:grob? "rest collision that a rest is in.") -(grob-property-description 'rest-collision-done boolean? "Is this rest collision processed yet?") (grob-property-description 'script-molecule pair? "Index code for script -- internal, see script.cc.") diff --git a/scm/define-translator-properties.scm b/scm/define-translator-properties.scm index 1f46f5df73..3f11acf9d6 100644 --- a/scm/define-translator-properties.scm +++ b/scm/define-translator-properties.scm @@ -302,8 +302,13 @@ signature at this point in the measure. The format is the same as for keySignat ) (translator-property-description 'localKeySignatureChanges list? "Experimental. [DOCME]") + (translator-property-description 'majorSevenSymbol markup? "How should the major7 be formatted in a chord name?") +(translator-property-description 'markFormatter procedure? "Procedure +taking as arguments context and rehearsal mark. It should return the +formatted mark as a markup object.") + (translator-property-description 'measureLength ly:moment? "Length of one measure in the current time signature last?") (translator-property-description 'measurePosition ly:moment? "How much @@ -361,7 +366,7 @@ that indicates how to print sustain pedals: text, bracket or mixed (translator-property-description 'pedalUnaCordaStyle symbol? "see pedalSustainStyle.") (translator-property-description 'pedalSostenutoStyle symbol? "see pedalSustainStyle.") -(translator-property-description 'rehearsalMark number-or-string? "The +(translator-property-description 'rehearsalMark integer? "The last rehearsal mark printed.") (translator-property-description 'repeatCommands list? "This property is read to find any command of the form (volta . X), where X is a string or #f") (translator-property-description 'scriptDefinitions list? " diff --git a/scm/molecule.scm b/scm/molecule.scm index fb604872ed..443f6e5c83 100644 --- a/scm/molecule.scm +++ b/scm/molecule.scm @@ -72,13 +72,13 @@ encloses the contents. (let* ( (x-ext (interval-widen (ly:molecule-get-extent mol 0) padding)) (y-ext (interval-widen (ly:molecule-get-extent mol 1) padding)) + (y-rule (make-filled-box-molecule (cons 0 thick) y-ext)) (x-rule (make-filled-box-molecule (interval-widen x-ext thick) - (cons 0 thick))) - (y-rule (make-filled-box-molecule (cons 0 thick) y-ext))) - - (set! mol (ly:molecule-combine-at-edge mol 0 1 y-rule (* 0.5 padding))) - (set! mol (ly:molecule-combine-at-edge mol 0 -1 y-rule (* 0.5 padding))) - (set! mol (ly:molecule-combine-at-edge mol 1 1 x-rule 0.0)) - (set! mol (ly:molecule-combine-at-edge mol 1 -1 x-rule 0.0)) + (cons 0 thick))) + ) + (set! mol (ly:molecule-combine-at-edge mol X 1 y-rule padding)) + (set! mol (ly:molecule-combine-at-edge mol X -1 y-rule padding)) + (set! mol (ly:molecule-combine-at-edge mol Y 1 x-rule 0.0)) + (set! mol (ly:molecule-combine-at-edge mol Y -1 x-rule 0.0)) mol)) diff --git a/scm/output-pdf.scm b/scm/output-pdf.scm index 96153a63cc..4ca3f8991f 100644 --- a/scm/output-pdf.scm +++ b/scm/output-pdf.scm @@ -52,7 +52,7 @@ (define (setgray g) (string-append (ly:number->string g) "g ")) (define (setlineparams) "1 j 1 J ") -(define (beam width slope thick) +(define (beam width slope thick blot) (let ((ht (* slope width))) (string-append (moveto 0 (- (/ thick 2))) (rlineto width ht) diff --git a/scm/output-pdftex.scm b/scm/output-pdftex.scm index 3ecd63b726..cd13c67aba 100644 --- a/scm/output-pdftex.scm +++ b/scm/output-pdftex.scm @@ -48,8 +48,8 @@ )) -(define (beam width slope thick) - (embedded-pdf (list 'beam width slope thick))) +(define (beam width slope thick blot) + (embedded-pdf (list 'beam width slope thick blot))) (define (bracket arch_angle arch_width arch_height height arch_thick thick) (embedded-pdf (list 'bracket arch_angle arch_width arch_height height arch_thick thick))) diff --git a/scm/output-ps.scm b/scm/output-ps.scm index bf42f7e22c..801d31185a 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -35,9 +35,9 @@ ;; Interface functions -(define (beam width slope thick) +(define (beam width slope thick blot) (string-append - (numbers->string (list slope width thick)) " draw_beam" )) + (numbers->string (list slope width thick blot)) " draw_beam" )) ;; two beziers (define (bezier-sandwich l thick) diff --git a/scm/output-sketch.scm b/scm/output-sketch.scm index 86cf11c949..ed2bad7ed8 100644 --- a/scm/output-sketch.scm +++ b/scm/output-sketch.scm @@ -197,7 +197,7 @@ (define (font-load-command name-mag command) "") -(define (beam x y width slope thick) +(define (beam x y width slope thick blot) (apply sketch-filled-rectangle (list width (* slope width) 0 thick x y))) diff --git a/scm/output-tex.scm b/scm/output-tex.scm index 87017e644e..4e43277a6d 100644 --- a/scm/output-tex.scm +++ b/scm/output-tex.scm @@ -88,8 +88,8 @@ (define (dot x y radius) (embedded-ps (list 'dot x y radius))) -(define (beam width slope thick) - (embedded-ps (list 'beam width slope thick))) +(define (beam width slope thick blot) + (embedded-ps (list 'beam width slope thick blot))) (define (bracket arch_angle arch_width arch_height height arch_thick thick) (embedded-ps (list 'bracket arch_angle arch_width arch_height height arch_thick thick))) diff --git a/scm/translation-functions.scm b/scm/translation-functions.scm index 76b8eb6f2f..eec3029702 100644 --- a/scm/translation-functions.scm +++ b/scm/translation-functions.scm @@ -12,7 +12,7 @@ ;; metronome marks -(define-public (make-metronome-markup event context) +(define-public (format-metronome-markup event context) (let* ((dur (ly:get-mus-property event 'tempo-unit)) (count (ly:get-mus-property event 'metronome-count)) @@ -27,3 +27,34 @@ )))) + + +(define number->mark-letter-vector (make-vector 25 #\A)) + +(do ((i 0 (1+ i)) + (j 0 (1+ j)) ) + ((>= i 26)) + (if (= i (- (char->integer #\I) (char->integer #\A))) + (set! i (1+ i))) + (vector-set! number->mark-letter-vector j + (integer->char (+ i (char->integer #\A)))) ) + +(define-public (number->mark-string n) + "Double letters for big marks." + (let* + ((l (vector-length number->mark-letter-vector))) + (display n) (newline) + (display l) (newline) + + (if (>= n l) + (string-append (number->mark-string (1- (quotient n l))) + (number->mark-string (remainder n l))) + (make-string 1 (vector-ref number->mark-letter-vector n))))) + + +(define-public (format-mark-letters mark context) + (make-bold-markup (number->mark-string (1- mark)))) + +(define-public (format-mark-numbers mark context) + (make-bold-markup (number->string mark))) + -- 2.39.5