From what it printed to the console it looked like the entire application was relaunched once it was finished scanning for fonts.
The restart is something I do on purpose, as I need to install the fonts because of a
bug in mono (and also:
this).
And I forgot about this, but I need to refresh the cache for the font install to "pick up" after I restart, so it's my fault.
However it only took a split second in all of my tests, so curious why it takes a long time in your environment.
Here's the refresh call:
https://github.com/tzachshabtay/MonoAGS/blob/d09402367f384f17bfbdaf3ccc01a8e815343d9e/Source/Engine/AGS.Engine.Desktop/Drawing/DesktopFontFamilyLoader.cs#L125So I'm guessing to reproduce this all you need to do is delete the 2 fonts that come in the demo from ~/fonts and restart the game.
As for how to fix, well, this bug is bugging me for ages, and one of the reasons I wanted to switch to ImageSharp which loads fonts in managed code and doesn't suffer from this problem, but I did some tests and its performance was unacceptable (they did improve it since, but it still doesn't match System.Drawing performance from their benchmarks). There's also the possibility that it will work fine in dot net core, which is also on the horizon. Though even if we'll support dotnet core I'll still want to allow compiling for mono as well, so I still want to see if there's a way to make it work fast if we'll end up keeping System.Drawing.
I'm wondering if maybe the refresh is slow because you have a lot of fonts on your machine, or if it's a debian thing. Can you see how many fonts you have installed on your machine?
I also wonder if maybe there's a faster version of the command, for example maybe it's just the printouts that take a long time, and if we change fc-cache -f -v to fc-cache -v it will work faster.
Ah, I also see that you can specify a directory, so we can possibly skip rebuilding the system fonts and just build the user fonts, which will maybe solve it.
I.e, just change this line:
ProcessStartInfo info
= new ProcessStartInfo
("fc-cache",
"-f -v") { UseShellExecute
= false };
To:
ProcessStartInfo info
= new ProcessStartInfo
("fc-cache", $
"-f -v {LINUX_FONT_LIBRARY}") { UseShellExecute
= false };
Can you test if this works? If so, I'll push a fix. Thanks.
Does the actual engine rely on the built-in fonts?
So it's probably not related, but just for sharing, the engine will use the default system font if you didn't specify your own font, and the demo game does use the default font in some places.