Require font parameter in FreeTypeFont and truetype() by radarhere · Pull Request #8261 · python-pillow/Pillow

Currently, font is an optional parameter for FreeTypeFont and truetype().

However, if it is None, then an error is raised.

>>> from PIL import ImageFont
>>> ImageFont.FreeTypeFont()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "PIL/ImageFont.py", line 261, in __init__
    load_from_bytes(font)
  File "PIL/ImageFont.py", line 240, in load_from_bytes
    self.font_bytes = f.read()
AttributeError: 'NoneType' object has no attribute 'read'
>>> from PIL import ImageFont
>>> ImageFont.truetype()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "PIL/ImageFont.py", line 834, in truetype
    return freetype(font)
  File "PIL/ImageFont.py", line 831, in freetype
    return FreeTypeFont(font, size, index, encoding, layout_engine)
  File "PIL/ImageFont.py", line 261, in __init__
    load_from_bytes(font)
  File "PIL/ImageFont.py", line 240, in load_from_bytes
    self.font_bytes = f.read()
AttributeError: 'NoneType' object has no attribute 'read'

This PR removes the defaults to make it required instead.