def _get_text_positions(text):
    """
    For each character in the text object, return a list pixel values for
    the start of each character.

    Note, this returns a list that is len(text) + 1, so that the end of the
    last character can be determined.
    """
    orig = text.get_text()
    text.set_text('##')
    bb = text.get_window_extent()
    width0 = bb.width
    text.set_text('# #')
    bb = text.get_window_extent()
    width1 = bb.width
    space_width = width1 - width0
    s = str(orig)
    N = len(s)
    x_positions = [bb.x0]
    for i in range(1, N + 1):
        txt = s[0:i]
        text.set_text(txt)
        bb = text.get_window_extent()
        x = bb.x0 + bb.width
        if txt[0] == ' ':
            x += space_width
        if i > 0 and txt[-1] == ' ':
            x += space_width
        x_positions.append(x)
    text.set_text(orig)
    return x_positions
