+ return width;
+}
+
+
+/*
+ This routine computes placements of accidentals. During
+ add_accidental (), accidentals are already grouped by note, so that
+ octaves are placed above each other; they form columns. Then the
+ columns are sorted: the biggest columns go closest to the note.
+ Then the columns are spaced as closely as possible (using skyline
+ spacing).
+
+
+ TODO: more advanced placement. Typically, the accs should be placed
+ to form a C shape, like this
+
+
+ ##
+ b b
+ # #
+ b
+ b b
+
+ The naturals should be left of the C as well; they should
+ be separate accs.
+
+ Note that this placement problem looks NP hard, so we just use a
+ simple strategy, not an optimal choice.
+*/
+
+/*
+ TODO: there should be more space in the following situation
+
+
+ Natural + downstem
+
+ *
+ * |_
+ * | | X
+ * |_| |
+ * | |
+ *
+
+*/
+
+MAKE_SCHEME_CALLBACK (Accidental_placement, calc_positioning_done, 1);
+SCM
+Accidental_placement::calc_positioning_done (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ if (!me->is_live ())
+ return SCM_BOOL_T;
+
+ me->set_property ("positioning-done", SCM_BOOL_T);
+
+ SCM accs = me->get_object ("accidental-grobs");
+ if (!scm_is_pair (accs))
+ return SCM_BOOL_T;