def _draw_text(self, coords, text, foreground, font):
        """Draw the text and shorten it if required"""
        if text is None:
            return None
        x1_r, _, x2_r, _ = coords
        while True:
            text_id = self._timeline.create_text(
                (0, 0), text=text,
                fill=foreground if foreground != "default" else self._marker_foreground,
                font=font if font != "default" else self._marker_font,
                tags=("marker",)
            )
            x1_t, _, x2_t, _ = self._timeline.bbox(text_id)
            if (x2_t - x1_t) < (x2_r - x1_r):
                break
            self._timeline.delete(text_id)
            text = text[:-4] + "..."
        x, y = TimeLine.calculate_text_coords(coords)
        self._timeline.coords(text_id, (x, y))
        return text_id
Draw the text and shorten it if required