def _render(width, height, text):
    # text must already be i18n-ed to Unicode.
    data = []

    lines = tuple(from_unicode(l) for l in text.split('\n'))

    for line in lines:
        data.append(line)

    # pad page with empty rows
    while len(data) % height:
        data.append(tuple())

    return tuple(data)