You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If ShapeString is called repeatedly on Windows, temporary font file copies may accumulate in a temporary folder.
The FreeType function FT_New_Face uses fopen internally to read font files. fopen expects ascii c-strings as file names. On Windows, file names are UTF-16. This is currently handled by copying the font file to a temporary file with an ascii file name and passing this file name to FreeType. There is code to delete the temporary files, but the files accumulate in at least some cases.
FreeType's recommendation for dealing with Windows file names is to load the font file into memory and use FT_New_Memory_Face or to write a custom I/O routine and use FT_Open_Face.
From: https://freetype.org/freetype2/docs/reference/ft2-base_interface.html#ft_new_face
"The pathname string should be recognizable as such by a standard fopen call on your system; in particular, this means that pathname must not contain null bytes. If that is not sufficient to address all file name possibilities (for example, to handle wide character file names on Windows in UTF-16 encoding) you might use FT_Open_Face to pass a memory array or a stream object instead."
Anything else?
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Forums discussion
https://www.forum.freecadweb.org/viewtopic.php?f=10&t=75453
Version
0.20 (Release)
Full version info
Subproject(s) affected?
Part
Issue description
If ShapeString is called repeatedly on Windows, temporary font file copies may accumulate in a temporary folder.
The FreeType function FT_New_Face uses fopen internally to read font files. fopen expects ascii c-strings as file names. On Windows, file names are UTF-16. This is currently handled by copying the font file to a temporary file with an ascii file name and passing this file name to FreeType. There is code to delete the temporary files, but the files accumulate in at least some cases.
FreeType's recommendation for dealing with Windows file names is to load the font file into memory and use FT_New_Memory_Face or to write a custom I/O routine and use FT_Open_Face.
From: https://freetype.org/freetype2/docs/reference/ft2-base_interface.html#ft_new_face
"The pathname string should be recognizable as such by a standard fopen call on your system; in particular, this means that pathname must not contain null bytes. If that is not sufficient to address all file name possibilities (for example, to handle wide character file names on Windows in UTF-16 encoding) you might use FT_Open_Face to pass a memory array or a stream object instead."
Anything else?
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: