Use os.fspath instead of isinstance and str

This commit is contained in:
Hugo van Kemenade 2024-01-26 20:46:58 +02:00
parent 16d4068b42
commit d631afc266

View File

@ -230,8 +230,7 @@ class FreeTypeFont:
)
if is_path(font):
if isinstance(font, os.PathLike):
font = str(font)
font = os.fspath(font)
if sys.platform == "win32":
font_bytes_path = font if isinstance(font, bytes) else font.encode()
try: