def fit_text(c, text, x, y, max_w, max_h, font_name='Helvetica',
             padding_w=4.5, padding_h=4.5, font_decrement=0.0625):
    """Draw text, reducing font size until it fits with a given max width and
    height."""

    max_w -= (padding_w * 2.0)
    max_h -= (padding_h * 2.0)

    x += padding_w
    y += padding_h

    font_size = max_h

    while font_size > 1.0:
        ps = ParagraphStyle(name='text', alignment=TA_CENTER,
                            fontName=font_name, fontSize=font_size,
                            leading=font_size)
        p = Paragraph(text, ps)
        actual_w, actual_h = p.wrapOn(c, max_w, max_h)
        if max_h > actual_h or actual_w > max_w:
            font_size -= font_decrement
        else:
            y_pad = (max_h - actual_h) / 2
            p.drawOn(c, x, y + y_pad)
            return
dataset/ETHPy150Open mozilla/django-badger/badger/printing.py/fit_text/swapped operands of `>`