From d0d4227515c91a779520881a8adf164835691859 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Thu, 25 Jul 2024 18:45:38 +1000 Subject: [PATCH 1/2] Require font parameter in FreeTypeFont --- src/PIL/ImageFont.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PIL/ImageFont.py b/src/PIL/ImageFont.py index d260eef6946..2f41c29cd93 100644 --- a/src/PIL/ImageFont.py +++ b/src/PIL/ImageFont.py @@ -203,7 +203,7 @@ class FreeTypeFont: def __init__( self, - font: StrOrBytesPath | BinaryIO | None = None, + font: StrOrBytesPath | BinaryIO, size: float = 10, index: int = 0, encoding: str = "", From 68328ccc6adadab538c559acfd6506b5c6998cd4 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Thu, 25 Jul 2024 18:52:04 +1000 Subject: [PATCH 2/2] Require font parameter for truetype() --- src/PIL/ImageFont.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PIL/ImageFont.py b/src/PIL/ImageFont.py index 2f41c29cd93..b2d79c25fe6 100644 --- a/src/PIL/ImageFont.py +++ b/src/PIL/ImageFont.py @@ -756,7 +756,7 @@ def load(filename: str) -> ImageFont: def truetype( - font: StrOrBytesPath | BinaryIO | None = None, + font: StrOrBytesPath | BinaryIO, size: float = 10, index: int = 0, encoding: str = "", @@ -827,7 +827,7 @@ def truetype( :exception ValueError: If the font size is not greater than zero. """ - def freetype(font: StrOrBytesPath | BinaryIO | None) -> FreeTypeFont: + def freetype(font: StrOrBytesPath | BinaryIO) -> FreeTypeFont: return FreeTypeFont(font, size, index, encoding, layout_engine) try: