Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle pathlib.Path in FreeTypeFont #7578

Merged
merged 8 commits into from Dec 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/PIL/ImageFont.py
Expand Up @@ -25,6 +25,8 @@
# See the README file for information on usage and redistribution.
#

from __future__ import annotations

import base64
import os
import sys
Expand Down Expand Up @@ -186,7 +188,14 @@ def getlength(self, text, *args, **kwargs):
class FreeTypeFont:
"""FreeType font wrapper (requires _imagingft service)"""

def __init__(self, font=None, size=10, index=0, encoding="", layout_engine=None):
def __init__(
self,
font: bytes | str | Path | None = None,
size: float = 10,
index: int = 0,
encoding: str = "",
layout_engine: int = None,
radarhere marked this conversation as resolved.
Show resolved Hide resolved
) -> None:
# FIXME: use service provider instead

self.path = font
Expand Down