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
Trying to use a C# application that calls System.PrivateFontCollection.AddMemoryFont on Linux leaves a bunch of unused font files in the tmp folder, even after calling Dispose.
Most functions in Mono's PrivateFontCollection are simply wrappers to libgdiplus calls, so I guess the bug originates from here.
Digging through the source code, it seems that this piece of code here is responsible:
#ifdef WIN32
f = CreateTempFile (fontfile);
if (!f)
return FileNotFound;
if (fwrite(memory, sizeof(BYTE), length, f) != length) {
fclose (f);
return FileNotFound;
}
fclose (f);
#else
strcpy ((char *) fontfile, "/tmp/ffXXXXXX");
f = mkstemp ((char *) fontfile);
if (f == -1)
return FileNotFound;
if (write (f, memory, length) != length) {
close (f);
return FileNotFound;
}
close (f);
#endif
FcConfigAppFontAddFile (fontCollection->config, fontfile);
/* FIXME - May we delete our temporary font file or does
FcConfigAppFontAddFile just reference our file? */
/* unlink(fontfile); */
return Ok;
After research, at least on my Ubuntu 20.04 machine, FcConfigAppFontAddFile simply references that file, deleting the font makes the app crash when a new Form or Control is drawn. However, the function does not seem to save the temp files anywhere.
The text was updated successfully, but these errors were encountered:
Trying to use a C# application that calls
System.PrivateFontCollection.AddMemoryFont
on Linux leaves a bunch of unused font files in thetmp
folder, even after callingDispose
.Most functions in Mono's PrivateFontCollection are simply wrappers to
libgdiplus
calls, so I guess the bug originates from here.Digging through the source code, it seems that this piece of code here is responsible:
After research, at least on my Ubuntu 20.04 machine,
FcConfigAppFontAddFile
simply references that file, deleting the font makes the app crash when a new Form or Control is drawn. However, the function does not seem to save the temp files anywhere.The text was updated successfully, but these errors were encountered: