From d4f38c4239f67dd08d616794a9cdc47a30a86b6a Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 30 May 2006 15:47:16 +0000 Subject: [PATCH] * scm/translation-functions.scm (format-bass-figure): translate digits over 10 to the left * scm/define-markup-commands.scm (translate-scaled): new markup. * mf/feta-nummer-code.mf (code): overshoot the topright tip of the 7 glyph. * ly/engraver-init.ly: add Figured_bass_engraver * lily/engraver-group.cc (acknowledge_grobs): use start/stop drul. * lily/figured-bass-engraver.cc (clear_spanners): use everywhere. * lily/score-engraver.cc (announce_grob): only note START announces. * lily/include/engraver-group.hh (Translator_group): acknowledge_hash_table_ is now drul. * lily/engraver.cc (announce_end_grob): new method. * lily/include/grob-info.hh (class Grob_info): add start_end_ member. * lily/translator-dispatch-list.cc (create): take start_end argument. * lily/include/translator.hh (TRANSLATOR_DECLARATIONS): change acknowledge_static_array_ to drul * lily/include/translator.icc (ADD_END_ACKNOWLEDGER): new macro. * scm/define-grob-interfaces.scm (bass-figure-alignment-interface): add bass-figure-alignment-interface * scm/define-grobs.scm (all-grob-descriptions): add BassFigureAlignmentPositioning * ly/Welcome-to-LilyPond-MacOS.ly: include in LilyPond, so version number stays up to date. Backportme. --- ChangeLog | 41 +++++++++++++++++++++ input/regression/figured-bass-staff.ly | 31 ++++++++++++++++ lily/engraver-group.cc | 22 +++++++---- lily/engraver.cc | 26 +++++++++++++ lily/figured-bass-engraver.cc | 47 ++++++++++++++++-------- lily/grob-info.cc | 2 + lily/include/engraver-group.hh | 3 +- lily/include/engraver.hh | 2 + lily/include/grob-info.hh | 4 +- lily/include/translator-dispatch-list.hh | 2 +- lily/include/translator.hh | 12 +++++- lily/include/translator.icc | 18 +++++++-- lily/score-engraver.cc | 9 +++-- lily/stem-engraver.cc | 9 ++++- lily/translator-dispatch-list.cc | 7 +++- ly/Welcome-to-LilyPond-MacOS.ly | 35 ++++++++++++++++++ ly/engraver-init.ly | 2 + mf/feta-nummer-code.mf | 19 +++------- scm/define-grob-interfaces.scm | 4 ++ scm/define-grobs.scm | 36 +++++++++++++----- scm/define-markup-commands.scm | 11 ++++++ scm/translation-functions.scm | 23 ++++++++---- 22 files changed, 297 insertions(+), 68 deletions(-) create mode 100644 input/regression/figured-bass-staff.ly create mode 100644 ly/Welcome-to-LilyPond-MacOS.ly diff --git a/ChangeLog b/ChangeLog index 49fb05cd08..94ea1a857b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,44 @@ +2006-05-30 Han-Wen Nienhuys + + * scm/translation-functions.scm (format-bass-figure): translate + digits over 10 to the left + + * scm/define-markup-commands.scm (translate-scaled): new markup. + + * mf/feta-nummer-code.mf (code): overshoot the topright tip of the + 7 glyph. + + * ly/engraver-init.ly: add Figured_bass_engraver + + * lily/engraver-group.cc (acknowledge_grobs): use start/stop drul. + + * lily/figured-bass-engraver.cc (clear_spanners): use everywhere. + + * lily/score-engraver.cc (announce_grob): only note START announces. + + * lily/include/engraver-group.hh (Translator_group): + acknowledge_hash_table_ is now drul. + + * lily/engraver.cc (announce_end_grob): new method. + + * lily/include/grob-info.hh (class Grob_info): add start_end_ member. + + * lily/translator-dispatch-list.cc (create): take start_end argument. + + * lily/include/translator.hh (TRANSLATOR_DECLARATIONS): change + acknowledge_static_array_ to drul + + * lily/include/translator.icc (ADD_END_ACKNOWLEDGER): new macro. + + * scm/define-grob-interfaces.scm + (bass-figure-alignment-interface): add bass-figure-alignment-interface + + * scm/define-grobs.scm (all-grob-descriptions): add + BassFigureAlignmentPositioning + + * ly/Welcome-to-LilyPond-MacOS.ly: include in LilyPond, so version number + stays up to date. Backportme. + 2006-05-30 Mats Bengtsson * Documentation/user/basic-notation.itely (Bar lines): Document diff --git a/input/regression/figured-bass-staff.ly b/input/regression/figured-bass-staff.ly new file mode 100644 index 0000000000..fc49f90780 --- /dev/null +++ b/input/regression/figured-bass-staff.ly @@ -0,0 +1,31 @@ + +\paper { + ragged-right = ##t + +} +\version "2.9.7" +\header { + + + texidoc = "Figured bass can also be added to Staff context directly. +In that case, the figures must be entered with @code{\\figuremode} and be directed +to an existing @code{Staff} context." + + } + +<< + + \new Staff = someUniqueName + \relative c'' { + c4 c'8 r8 c,4 c' + } + + %% send to existing Staff. + \context Staff = someUniqueName + \figuremode { + <4>4 <4>8 s8 + + \set Staff.useBassFigureExtenders = ##t + <4 6>4 <4 6> + } +>> diff --git a/lily/engraver-group.cc b/lily/engraver-group.cc index 5742288d69..71533cd116 100644 --- a/lily/engraver-group.cc +++ b/lily/engraver-group.cc @@ -23,6 +23,7 @@ Engraver_group::announce_grob (Grob_info info) = context_->get_parent_context () ? dynamic_cast (context_->get_parent_context ()->implementation ()) : 0; + if (dad_eng) dad_eng->announce_grob (info); } @@ -39,7 +40,7 @@ Engraver_group::acknowledge_grobs () for (vsize j = 0; j < announce_infos_.size (); j++) { Grob_info info = announce_infos_[j]; - + SCM meta = info.grob ()->internal_get_property (meta_sym); SCM nm = scm_assoc (name_sym, meta); if (scm_is_pair (nm)) @@ -47,7 +48,9 @@ Engraver_group::acknowledge_grobs () else continue; - SCM acklist = scm_hashq_ref (acknowledge_hash_table_, nm, SCM_BOOL_F); + SCM acklist = scm_hashq_ref (acknowledge_hash_table_drul_[info.start_end()], + nm, SCM_BOOL_F); + Engraver_dispatch_list *dispatch = Engraver_dispatch_list::unsmob (acklist); @@ -56,12 +59,12 @@ Engraver_group::acknowledge_grobs () SCM ifaces = scm_cdr (scm_assoc (ly_symbol2scm ("interfaces"), meta)); acklist = Engraver_dispatch_list::create (get_simple_trans_list (), - ifaces); + ifaces, info.start_end ()); dispatch = Engraver_dispatch_list::unsmob (acklist); - scm_hashq_set_x (acknowledge_hash_table_, nm, acklist); + scm_hashq_set_x (acknowledge_hash_table_drul_[info.start_end ()], nm, acklist); } if (dispatch) @@ -124,8 +127,12 @@ Engraver_group::do_announces () Engraver_group::Engraver_group () { - acknowledge_hash_table_ = SCM_EOL; - acknowledge_hash_table_ = scm_c_make_hash_table (61); + acknowledge_hash_table_drul_[LEFT] + = acknowledge_hash_table_drul_[RIGHT] + = SCM_EOL; + + acknowledge_hash_table_drul_[LEFT] = scm_c_make_hash_table (61); + acknowledge_hash_table_drul_[RIGHT] = scm_c_make_hash_table (61); } #include "translator.icc" @@ -140,5 +147,6 @@ ADD_TRANSLATOR_GROUP (Engraver_group, void Engraver_group::derived_mark () const { - scm_gc_mark (acknowledge_hash_table_); + scm_gc_mark (acknowledge_hash_table_drul_[LEFT]); + scm_gc_mark (acknowledge_hash_table_drul_[RIGHT]); } diff --git a/lily/engraver.cc b/lily/engraver.cc index f17a211afc..eebd22e4be 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -29,6 +29,12 @@ Engraver::announce_grob (Grob_info inf) get_daddy_engraver ()->announce_grob (inf); } +void +Engraver::announce_end_grob (Grob_info inf) +{ + get_daddy_engraver ()->announce_grob (inf); +} + /* CAUSE is the object (typically a Music object) that was the reason for making E. @@ -46,6 +52,26 @@ Engraver::announce_grob (Grob *e, SCM cause) g->announce_grob (i); } + +/* + CAUSE is the object (typically a Music object) that + was the reason for making E. +*/ +void +Engraver::announce_end_grob (Grob *e, SCM cause) +{ + if (unsmob_music (cause) || unsmob_grob (cause)) + e->set_property ("cause", cause); + + Grob_info i (this, e); + + i.start_end_ = STOP; + Engraver_group *g = get_daddy_engraver (); + if (g) + g->announce_grob (i); +} + + Engraver::Engraver () { } diff --git a/lily/figured-bass-engraver.cc b/lily/figured-bass-engraver.cc index 158959eda8..01b352f28d 100644 --- a/lily/figured-bass-engraver.cc +++ b/lily/figured-bass-engraver.cc @@ -209,12 +209,32 @@ Figured_bass_engraver::clear_spanners () { if (!alignment_) return; - - alignment_ = 0; + + if (alignment_) + { + announce_end_grob (alignment_, SCM_EOL); + alignment_ = 0; + } + if (to_boolean (get_property ("figuredBassCenterContinuations"))) center_repeated_continuations(); - groups_.clear (); + for (vsize i = 0; i < groups_.size (); i++) + { + if (groups_[i].group_) + { + announce_end_grob (groups_[i].group_ , SCM_EOL); + groups_[i].group_ = 0; + } + + if (groups_[i].continuation_line_) + { + announce_end_grob (groups_[i].continuation_line_ , SCM_EOL); + groups_[i].continuation_line_ = 0; + } + } + + /* Check me, groups_.clear () ? */ } void @@ -255,6 +275,7 @@ Figured_bass_engraver::process_music () if (rest_event_) { clear_spanners (); + groups_.clear (); return; } @@ -262,6 +283,7 @@ Figured_bass_engraver::process_music () && new_musics_.empty ()) { clear_spanners (); + groups_.clear (); return; } @@ -276,20 +298,15 @@ Figured_bass_engraver::process_music () bool use_extenders = to_boolean (get_property ("useBassFigureExtenders")); if (!use_extenders) { - if (to_boolean (get_property ("figuredBassCenterContinuations"))) - center_repeated_continuations (); - - alignment_ = 0; - for (vsize i = 0; i < groups_.size (); i++) - { - groups_[i].group_ = 0; - groups_[i].continuation_line_ = 0; - } + clear_spanners (); } if (!continuation_) - clear_spanners (); - + { + clear_spanners (); + groups_.clear (); + } + vsize k = 0; for (vsize i = 0; i < new_musics_.size (); i++) { @@ -438,10 +455,10 @@ Figured_bass_engraver::create_grobs () group.figure_item_->set_property ("transparent", SCM_BOOL_T); group.continuation_line_->set_bound (RIGHT, group.figure_item_); } - if (groups_[i].group_) groups_[i].group_->set_bound (RIGHT, muscol); + } } diff --git a/lily/grob-info.cc b/lily/grob-info.cc index bd8279e5f7..a8f3f4c7b1 100644 --- a/lily/grob-info.cc +++ b/lily/grob-info.cc @@ -18,11 +18,13 @@ Grob_info::Grob_info (Translator *t, Grob *g) { origin_trans_ = t; grob_ = g; + start_end_ = START; } Grob_info::Grob_info () { grob_ = 0; + start_end_ = START; origin_trans_ = 0; } diff --git a/lily/include/engraver-group.hh b/lily/include/engraver-group.hh index 0af77fca31..d1df4cffb3 100644 --- a/lily/include/engraver-group.hh +++ b/lily/include/engraver-group.hh @@ -16,7 +16,8 @@ class Engraver_group : public virtual Translator_group { protected: vector announce_infos_; - SCM acknowledge_hash_table_; + Drul_array acknowledge_hash_table_drul_; + public: VIRTUAL_COPY_CONSTRUCTOR (Translator_group, Engraver_group); Engraver_group (); diff --git a/lily/include/engraver.hh b/lily/include/engraver.hh index d4330f9354..04a7623e3f 100644 --- a/lily/include/engraver.hh +++ b/lily/include/engraver.hh @@ -30,6 +30,7 @@ protected: */ virtual void acknowledge_grob (Grob_info) {} virtual void announce_grob (Grob_info); + virtual void announce_end_grob (Grob_info); Engraver_group *get_daddy_engraver () const; public: @@ -37,6 +38,7 @@ public: Announce element. Default: pass on to daddy. Utility */ void announce_grob (Grob *, SCM cause); + void announce_end_grob (Grob *, SCM cause); /** override other ctor diff --git a/lily/include/grob-info.hh b/lily/include/grob-info.hh index 35e3eab64e..4ed3790954 100644 --- a/lily/include/grob-info.hh +++ b/lily/include/grob-info.hh @@ -20,9 +20,11 @@ class Grob_info { Translator *origin_trans_; Grob *grob_; - + Direction start_end_; + friend class Engraver; public: + Direction start_end () const { return start_end_; } Grob *grob () const { return grob_; } Translator *origin_translator () const { return origin_trans_; } diff --git a/lily/include/translator-dispatch-list.hh b/lily/include/translator-dispatch-list.hh index 060ab173af..38543eff11 100644 --- a/lily/include/translator-dispatch-list.hh +++ b/lily/include/translator-dispatch-list.hh @@ -26,7 +26,7 @@ class Engraver_dispatch_list public: void apply (Grob_info); SCM static create (SCM trans_list, - SCM iface_list); + SCM iface_list, Direction); DECLARE_SIMPLE_SMOBS (Engraver_dispatch_list,); }; diff --git a/lily/include/translator.hh b/lily/include/translator.hh index 8566f0e3a2..398a32ce06 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -28,7 +28,7 @@ struct Acknowledge_information NAME (); \ VIRTUAL_COPY_CONSTRUCTOR (Translator, NAME); \ static SCM static_description_; \ - static vector acknowledge_static_array_; \ + static Drul_array > acknowledge_static_array_drul_; \ virtual void fetch_precomputable_methods (Translator_void_method_ptr methods[]); \ virtual SCM static_translator_description () const; \ virtual SCM translator_description () const; \ @@ -36,9 +36,17 @@ struct Acknowledge_information { \ return static_get_acknowledger (sym); \ } \ - static Engraver_void_function_engraver_grob_info static_get_acknowledger (SCM sym); + virtual Engraver_void_function_engraver_grob_info get_end_acknowledger (SCM sym) \ + { \ + return static_get_end_acknowledger (sym); \ + } \ + static Engraver_void_function_engraver_grob_info static_get_acknowledger (SCM sym); \ + static Engraver_void_function_engraver_grob_info static_get_end_acknowledger(SCM); \ + /* end #define */ + #define DECLARE_ACKNOWLEDGER(x) public : void acknowledge_ ## x (Grob_info); protected: +#define DECLARE_END_ACKNOWLEDGER(x) public : void acknowledge_end_ ## x (Grob_info); protected: enum Translator_precompute_index { diff --git a/lily/include/translator.icc b/lily/include/translator.icc index 255adc3ff9..14ba2b62b6 100644 --- a/lily/include/translator.icc +++ b/lily/include/translator.icc @@ -31,13 +31,18 @@ ADD_GLOBAL_CTOR (_ ## T ## _adder); #define ADD_TRANSLATOR(classname, desc, grobs, accepted, read, write) \ - vector classname::acknowledge_static_array_; \ + Drul_array< vector > classname::acknowledge_static_array_drul_; \ IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS (classname); \ ADD_THIS_TRANSLATOR (classname); \ Engraver_void_function_engraver_grob_info \ classname::static_get_acknowledger (SCM sym) \ { \ - return generic_get_acknowledger (sym, &acknowledge_static_array_); \ + return generic_get_acknowledger (sym, &acknowledge_static_array_drul_[START]); \ + } \ + Engraver_void_function_engraver_grob_info \ + classname::static_get_end_acknowledger (SCM sym) \ + { \ + return generic_get_acknowledger (sym, &acknowledge_static_array_drul_[STOP]); \ } \ SCM \ classname::static_translator_description () const \ @@ -101,10 +106,17 @@ generic_get_acknowledger (SCM sym, #define ADD_ACKNOWLEDGER(CLASS, NAME) \ void CLASS ## NAME ## _ack_adder () \ { \ - add_acknowledger ((Engraver_void_function_engraver_grob_info) & CLASS::acknowledge_ ## NAME, #NAME, &CLASS::acknowledge_static_array_); \ + add_acknowledger ((Engraver_void_function_engraver_grob_info) & CLASS::acknowledge_ ## NAME, #NAME, &CLASS::acknowledge_static_array_drul_[START]); \ } \ ADD_SCM_INIT_FUNC (CLASS ## NAME ## _ack_adder_initclass, CLASS ## NAME ## _ack_adder); +#define ADD_END_ACKNOWLEDGER(CLASS, NAME) \ + void CLASS ## NAME ## _end_ack_adder () \ + { \ + add_acknowledger ((Engraver_void_function_engraver_grob_info) & CLASS::acknowledge_end_ ## NAME, #NAME, &CLASS::acknowledge_static_array_drul_[STOP]); \ + } \ + ADD_SCM_INIT_FUNC (CLASS ## NAME ## _end_ack_adder_initclass, CLASS ## NAME ## _end_ack_adder); + #endif /* TRANSLATOR_ICC */ diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 9566a43558..ba80e75bb6 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -111,9 +111,12 @@ Score_engraver::one_time_step () void Score_engraver::announce_grob (Grob_info info) { - announce_infos_.push_back (info); - pscore_->root_system ()->typeset_grob (info.grob ()); - elems_.push_back (info.grob ()); + Engraver_group::announce_grob (info); + if (info.start_end () == START) + { + pscore_->root_system ()->typeset_grob (info.grob ()); + elems_.push_back (info.grob ()); + } } void diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index b14bdbae64..797406b4fb 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -177,7 +177,12 @@ ADD_ACKNOWLEDGER (Stem_engraver, rhythmic_head); ADD_TRANSLATOR (Stem_engraver, /* doc */ "Create stems and single-stem tremolos. It also works together with " "the beam engraver for overriding beaming.", - /* create */ "Stem StemTremolo", + /* create */ + "Stem " + "StemTremolo ", /* accept */ "tremolo-event", - /* read */ "tremoloFlags stemLeftBeamCount stemRightBeamCount", + /* read */ + "tremoloFlags " + "stemLeftBeamCount " + "stemRightBeamCount ", /* write */ ""); diff --git a/lily/translator-dispatch-list.cc b/lily/translator-dispatch-list.cc index 9197856597..28ea71afa2 100644 --- a/lily/translator-dispatch-list.cc +++ b/lily/translator-dispatch-list.cc @@ -29,7 +29,7 @@ Engraver_dispatch_list::apply (Grob_info gi) SCM Engraver_dispatch_list::create (SCM trans_list, - SCM iface_list) + SCM iface_list, Direction start_end) { SCM retval = Engraver_dispatch_list ().smobbed_copy (); Engraver_dispatch_list *list = Engraver_dispatch_list::unsmob (retval); @@ -48,7 +48,10 @@ Engraver_dispatch_list::create (SCM trans_list, for (SCM i = iface_list; scm_is_pair (i); i = scm_cdr (i)) { Engraver_void_function_engraver_grob_info ptr - = eng->get_acknowledger (scm_car (i)); + = (start_end == START) + ? eng->get_acknowledger (scm_car (i)) + : eng->get_end_acknowledger (scm_car (i)); + if (ptr) { entry.function_ = ptr; diff --git a/ly/Welcome-to-LilyPond-MacOS.ly b/ly/Welcome-to-LilyPond-MacOS.ly new file mode 100644 index 0000000000..4f876ed048 --- /dev/null +++ b/ly/Welcome-to-LilyPond-MacOS.ly @@ -0,0 +1,35 @@ +%{ +Welcome to LilyPond +=================== + +Congratulations, LilyPond has been installed successfully. + +Now to take it for the first test run. + + 1. Save this file + + 2. Select + + Compile > Typeset file + + from the menu. + + The file is processed, and + + 3. The PDF viewer will pop up. Click one of the noteheads. + + +That's it. For more information, visit http://lilypond.org . + +%} + +\header{ + title = "A scale in LilyPond" +} + +\relative { + c d e f g a b c +} + + +\version "2.9.6" % necessary for upgrading to future LilyPond versions. diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 8ad404160a..654f5dd8df 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -38,6 +38,8 @@ \consists "Instrument_name_engraver" \consists "String_number_engraver" \consists "Axis_group_engraver" + \consists "Figured_bass_engraver" + \consists "Figured_bass_position_engraver" \override VerticalAxisGroup #'minimum-Y-extent = #'(-4 . 4) extraVerticalExtent = ##f diff --git a/mf/feta-nummer-code.mf b/mf/feta-nummer-code.mf index 1574669256..ae264fa503 100644 --- a/mf/feta-nummer-code.mf +++ b/mf/feta-nummer-code.mf @@ -242,13 +242,6 @@ dot_diam# = 7/8 flare#; define_pixels (dot_diam); -code := 31; % , 32 - -fet_beginchar ("Space", "space"); - set_char_box (0, space#, 0, height#); -fet_endchar; - - code := 42; % , 43 fet_beginchar ("Plus", "plus"); @@ -734,16 +727,18 @@ fet_beginchar ("Numeral 7", "seven"); save tolerance; save alpha, beta, gamma, delta; save bow; + save x_overshoot; + path bow; - set_char_box (0, 11/15 height# * widen, 0, height#); + set_char_box (0, 11/15 height# * widen - thin#, 0, height#); + overshoot_x = .75 thin; message "w:" & decimal w; message "h:" & decimal h; alpha = -180; -if true: penpos1 (3/2 thick, 180 + alpha); penpos2 (hair, 180 + alpha - 45); penpos3 (hair, 180 + alpha + 45); @@ -751,16 +746,12 @@ if true: z2 = z1l + (1/4 sqrt (2) * hair) * dir (alpha - 135); z3 = z1r + (1/4 sqrt (2) * hair) * dir (alpha - 45); z4 = z1 + kuulleke * dir (alpha - 90); -else: - % does not work - calc_kuulleke (3/2 thick, -alpha); -fi; z1l = (thin, 0); beta = 55; penpos5 (thin, 90 + beta); - z5 = (w, h) + (1/2 sqrt (2) * thin) * dir (-135); + z5 = (w, h) + (1/2 sqrt (2) * thin) * dir (-135) + (overshoot_x, 0); gamma = angle (length (z1r - z1), 2 kuulleke); delta = 12; diff --git a/scm/define-grob-interfaces.scm b/scm/define-grob-interfaces.scm index 1cf4793b7b..4234fd5e1e 100644 --- a/scm/define-grob-interfaces.scm +++ b/scm/define-grob-interfaces.scm @@ -20,6 +20,10 @@ "A bass figure text" '(implicit)) +(ly:add-interface + 'bass-figure-alignment-interface + "" + '()) (ly:add-interface 'dynamic-interface diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 304360f4f1..02bc9cc8ad 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -212,6 +212,32 @@ rhythmic-grob-interface bass-figure-interface font-interface)))))) + + (BassFigureAlignment + . ( + (axes . (,Y)) + (threshold . (2 . 1000)) + (positioning-done . ,ly:align-interface::calc-positioning-done) + (Y-extent . ,ly:axis-group-interface::height) + (stacking-dir . -1) + (meta . ((class . Spanner) + (interfaces . (align-interface + bass-figure-alignment-interface + axis-group-interface)))))) + + (BassFigureAlignmentPositioning + . ((Y-offset . ,ly:side-position-interface::y-aligned-side) + (side-axis . ,Y) + (direction . ,UP) + (Y-extent . ,ly:axis-group-interface::height) + (axes . (,Y)) + (staff-padding . 1.0) + (padding . 0.5) + (meta . ((class . Spanner) + (interfaces . (side-position-interface + axis-group-interface + )))))) + (BassFigureBracket . ( (stencil . ,ly:enclosing-bracket::print) @@ -235,16 +261,6 @@ (interfaces . (axis-group-interface )))))) - (BassFigureAlignment - . ( - (axes . (,Y)) - (threshold . (2 . 1000)) - (positioning-done . ,ly:align-interface::calc-positioning-done) - (Y-extent . ,ly:axis-group-interface::height) - (stacking-dir . -1) - (meta . ((class . Spanner) - (interfaces . (align-interface - axis-group-interface)))))) (Beam . ( diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 5eea907169..1a940b1383 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -1267,6 +1267,17 @@ A negative @var{amount} indicates raising, see also @code{\\raise}. (- amount) Y)) +(define-markup-command (translate-scaled layout props offset arg) (number-pair? markup?) + "Translate @var{arg} by @var{offset}, scaling the offset by the @code{font-size}." + + (let* + ((factor (magstep (chain-assoc-get 'font-size props 0))) + (scaled (cons (* factor (car offset)) + (* factor (cdr offset))))) + + (ly:stencil-translate (interpret-markup layout props arg) + scaled))) + (define-markup-command (raise layout props amount arg) (number? markup?) " Raise @var{arg}, by the distance @var{amount}. diff --git a/scm/translation-functions.scm b/scm/translation-functions.scm index 27bbd5200b..f3bd616382 100644 --- a/scm/translation-functions.scm +++ b/scm/translation-functions.scm @@ -74,19 +74,28 @@ (define-public (format-bass-figure figure event context) (let* ((fig (ly:music-property event 'figure)) (fig-markup (if (number? figure) - (if (eq? #t (ly:music-property event 'diminished)) - (markup #:slashed-digit figure) - (markup #:number (number->string figure 10))) + + ;; this is not very elegant, but center-aligning all digits + ;; is problematic with other markups, and shows problems + ;; in the (lack of) overshoot of feta alphabet glyphs. + + ((if (<= 10 figure) + (lambda (y) (make-translate-scaled-markup (cons -0.7 0) y)) + identity) + + (if (eq? #t (ly:music-property event 'diminished)) + (markup #:slashed-digit figure) + (markup #:number (number->string figure 10)))) #f )) (alt (ly:music-property event 'alteration)) (alt-markup (if (number? alt) (markup - #:general-align Y DOWN #:fontsize - (if (not (= alt DOUBLE-SHARP)) - -2 2) - (alteration->text-accidental-markup alt)) + #:general-align Y DOWN #:fontsize + (if (not (= alt DOUBLE-SHARP)) + -2 2) + (alteration->text-accidental-markup alt)) #f)) (plus-markup (if (eq? #t (ly:music-property event 'augmented)) -- 2.39.5