def _get_vertical_coordinates(
    lines,
    y1,
    y2,
    font_size,
    line_spacing,
    baseline,
):
    """Calculate vertical coordinates for all the lines at once, honoring the
    text baseline property.
    """
    line_spacing = font_size * line_spacing
    if baseline == 'top':
        first_y = y2 - line_spacing
    elif baseline == 'middle':
        midpoint = (y2 + y1) / 2.0
        # For the first line of vertically centered text, go up half the # of
        # lines, then go back down half the font size.
        first_y = midpoint - \
            (line_spacing - font_size) + \
            (((len(lines) - 1) / 2.0) * line_spacing)
    else:  # bottom
        first_y = y1 + \
            (line_spacing - font_size) + \
            (line_spacing * (len(lines) - 1))
    return [first_y - (i * line_spacing) for i in range(len(lines))]