X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fnote-column.cc;h=7f9bac8eca3bb4305b68278b8eaa07cb9a2f3e96;hb=22066a4f0781980adfa73eef3d7ef3564f69bcb1;hp=da52093797fb1f3b98c91f42c07ad0835f70a441;hpb=d1268d3c8de1cbfee0c878265450f9a4b3492805;p=lilypond.git diff --git a/lily/note-column.cc b/lily/note-column.cc index da52093797..7f9bac8eca 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -40,6 +40,31 @@ using namespace std; annoying layer between (rest)collision & (note-head + stem) */ +Interval +Note_column::accidental_width (Grob *me) +{ + extract_grob_set (me, "note-heads", nhs); + vector accs; + for (vsize i = 0; i < nhs.size (); i++) + if (Grob *acc = unsmob_grob (nhs[i]->get_object ("accidental-grob"))) + accs.push_back (acc); + + Grob *common = common_refpoint_of_array (accs, me, X_AXIS); + common = common_refpoint_of_array (nhs, common, X_AXIS); + + Interval nhs_ex = Axis_group_interface::relative_group_extent (nhs, common, X_AXIS); + Interval accs_ex = Axis_group_interface::relative_group_extent (accs, common, X_AXIS); + + if (nhs_ex.is_empty ()) + return accs_ex; + + // want an empty interval here + if (accs_ex.is_empty ()) + return Interval (); + + return Interval (accs_ex[LEFT], nhs_ex[LEFT]); +} + bool Note_column::has_rests (Grob *me) {