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

Note to Windows users that FreeType will keep the font file open #6485

Merged
merged 2 commits into from Aug 7, 2022

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Aug 6, 2022

Resolves #6324

It has been requested we document that on Windows, FreeType keeps the font file open while Pillow is using it.

Testing this,

import shutil
shutil.copy("Tests/fonts/FreeMono.ttf", "out.ttf")
font = ImageFont.truetype("out.ttf")
os.remove("out.ttf")

on Windows, I see a PermissionError. On macOS and Linux, there is no problem.

The error disappears on CPython if you insert del font before os.remove.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PermissionError when attempting to use importlib.resources on Windows to load a custom font with ImageFont
2 participants