def computeWidth( doc ):
    """
    Utility function for computing the 'actual' width of a text layout
    document, by taking the maximum line width.
    """

    lines = []
    for b in doc.blocks:
        lines.extend( b.lines )

    if len(lines) == 0:
        return 0
    else:
        return max( [ l.xMax for l in lines ] )