+
+ if (!tabstring_event && j < tabstring_events_.size ())
+ {
+ tabstring_event = tabstring_events_[j];
+ if (j + 1 < tabstring_events_.size ())
+ j++;
+ }
+
+ int tab_string;
+ bool string_found;
+ if (tabstring_event)
+ {
+ tab_string = scm_to_int (tabstring_event->get_property ("string-number"));
+ string_found = true;
+ }
+ else
+ {
+ tab_string = high_string_one ? 1 : number_of_strings;
+ string_found = false;
+ }
+
+ Duration dur = *unsmob_duration (event->get_property ("duration"));
+
+ SCM scm_pitch = event->get_property ("pitch");
+ SCM proc = get_property ("tablatureFormat");
+ SCM min_fret_scm = get_property ("minimumFret");
+ int min_fret = scm_is_number (min_fret_scm) ? scm_to_int (min_fret_scm) : 0;
+
+ while (!string_found)
+ {
+ int fret = unsmob_pitch (scm_pitch)->rounded_semitone_pitch ()
+ - scm_to_int (scm_list_ref (string_tunings, scm_from_int (tab_string - 1)));
+ if (fret < min_fret)
+ tab_string += high_string_one ? 1 : -1;
+ else
+ string_found = true;
+ }
+
+ SCM text = scm_call_3 (proc, scm_from_int (tab_string),
+ context ()->self_scm (),
+ event->self_scm ());
+ note->set_property ("text", text);
+
+
+ int pos = 2 * tab_string - number_of_strings - 1; // No tab-note between the string !!!
+ if (to_boolean (get_property ("stringOneTopmost")))
+ pos = -pos;
+
+ note->set_property ("staff-position", scm_from_int (pos));
+