+ Grob *me = unsmob_grob (grob);
+ Grob *stem = unsmob_grob (me->get_object ("stem"));
+ if (!stem)
+ {
+ programming_error ("no stem for stem-tremolo");
+ return SCM_EOL;
+ }
+
+ Spanner *beam = Stem::get_beam (stem);
+ Direction stemdir = get_grob_direction (stem);
+ bool whole_note = Stem::duration_log (stem) <= 0;
+ if (stemdir == 0)
+ stemdir = UP;
+
+ Real beam_translation
+ = (beam && beam->is_live ())
+ ? Beam::get_beam_translation (beam)
+ : 0.81;
+
+ /* for a whole note, we position relative to the notehead, so we want the
+ stencil aligned on the flag closest to the head */
+ Direction stencil_dir = whole_note ? -stemdir : stemdir;
+ Stencil mol = raw_stencil (me, robust_scm2double (me->get_property ("slope"),
+ 0.25), stencil_dir);
+
+ Interval mol_ext = mol.extent (Y_AXIS);
+ Real ss = Staff_symbol_referencer::staff_space (me);
+
+ // ugh, rather calc from Stem_tremolo_req
+ int beam_count = beam ? (Stem::beam_multiplicity (stem).length () + 1) : 0;
+
+ Real beamthickness = 0.0;
+ SCM sbt = (beam) ? beam->get_property ("thickness") : SCM_EOL;
+ if (scm_is_number (sbt))
+ beamthickness = scm_to_double (sbt) * ss;
+
+ Real end_y
+ = Stem::stem_end_position (stem) * ss / 2
+ - stemdir * max (beam_count, 1) * beam_translation;
+
+ if (!beam && Stem::duration_log (stem) >= 3)
+ {
+ end_y -= stemdir * (Stem::duration_log (stem) - 2) * beam_translation;
+ if (stemdir == UP)
+ end_y -= stemdir * beam_translation * 0.5;
+ }
+ if (whole_note)
+ {
+ /* we shouldn't position relative to the end of the stem since the stem
+ is invisible */
+ vector<int> nhp = Stem::note_head_positions (stem);
+ Real note_head = (stemdir == UP ? nhp.back () : nhp[0]) * ss / 2;
+ end_y = note_head + stemdir * 1.5;
+ }
+ mol.translate_axis (end_y, Y_AXIS);
+
+ return mol.smobbed_copy ();