Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Add os.PathLike support to FT2Font constructor, and FontManager#30573
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| from io import BytesIO | ||
| import gc | ||
| import multiprocessing | ||
| import os | ||
| @@ -137,6 +137,32 @@ def test_find_noto(): | ||
| fig.savefig(BytesIO(), format=fmt) | ||
| def test_find_valid(): | ||
| class PathLikeClass: | ||
| def __init__(self, filename): | ||
| self.filename = filename | ||
| def __fspath__(self): | ||
| return self.filename | ||
| file_str = findfont('DejaVu Sans') | ||
| file_bytes = os.fsencode(file_str) | ||
| font = get_font(file_str) | ||
| assert font.fname == file_str | ||
| font = get_font(file_bytes) | ||
| assert font.fname == file_bytes | ||
| font = get_font(PathLikeClass(file_str)) | ||
| assert font.fname == file_str | ||
| font = get_font(PathLikeClass(file_bytes)) | ||
| assert font.fname == file_bytes | ||
| # Note, fallbacks are not currently accessible. | ||
| font = get_font([file_str, file_bytes, | ||
| PathLikeClass(file_str), PathLikeClass(file_bytes)]) | ||
| assert font.fname == file_str | ||
| def test_find_invalid(tmp_path): | ||
| with pytest.raises(FileNotFoundError): | ||
| @@ -148,11 +174,6 @@ def test_find_invalid(tmp_path): | ||
| with pytest.raises(FileNotFoundError): | ||
| get_font(bytes(tmp_path / 'non-existent-font-name.ttf')) | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. note to future reviewers, this was removed as redundent with other test | ||
| @pytest.mark.skipif(sys.platform != 'linux' or not has_fclist, | ||
| reason='only Linux with fontconfig installed') | ||
Uh oh!
There was an error while loading.Please reload this page.