Skip to content

Commit 26b7930

Browse files
authored
Merge pull request #6485 from radarhere/font
Note to Windows users that FreeType will keep the font file open
2 parents ae14255 + c24b6ef commit 26b7930

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/PIL/ImageFont.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,10 +906,12 @@ def truetype(font=None, size=10, index=0, encoding="", layout_engine=None):
906906
This function loads a font object from the given file or file-like
907907
object, and creates a font object for a font of the given size.
908908
909-
Pillow uses FreeType to open font files. If you are opening many fonts
910-
simultaneously on Windows, be aware that Windows limits the number of files
911-
that can be open in C at once to 512. If you approach that limit, an
909+
Pillow uses FreeType to open font files. On Windows, be aware that FreeType
910+
will keep the file open as long as the FreeTypeFont object exists. Windows
911+
limits the number of files that can be open in C at once to 512, so if many
912+
fonts are opened simultaneously and that limit is approached, an
912913
``OSError`` may be thrown, reporting that FreeType "cannot open resource".
914+
A workaround would be to copy the file(s) into memory, and open that instead.
913915
914916
This function requires the _imagingft service.
915917

0 commit comments

Comments
 (0)