How to stop loading system font?

Oct 13, 2014 at 12:57 AM
Hi,
For memory performance, you might need not to load all the system fonts, or you might need only your custom font to be loaded.

Do HTML Renderer allow users to disable loading system fonts? It would be better if it has this option.
However, How can I avoid loading the system fonts please?

Thanks,
Developer
Oct 13, 2014 at 2:19 PM
There is currently no option the prevent system fonts loading.

I need to understand what is the expensive part?

Let me explain what is currently happening:
All installed font families are iterated once and cached to know if a specific font is available.
foreach (var family in FontFamily.Families)
Then each used actual font instance (family/size/style) is created only once and cached.

From my benchmarks it didn't come up as expensive.
Do you believe it't not good enough?
Marked as answer by alharbin on 10/14/2014 at 4:50 AM
Oct 13, 2014 at 3:05 PM
Thank you for your quick response.

I believe what you have done is really outstanding work.
However, if the HTML Renderer is utilised to generate images at server (using ASP.NET), it will be loaded as many as live session as. As a result, the system fonts will be loaded many times whether user needs them or not. So, it might be better HTML Renderer allows user to prevent system fonts loading.
Developer
Oct 13, 2014 at 5:15 PM
On ASP.NET it will be loaded once per app domain, and event then it is possible that the unmanaged resources are shared, though I just guessing here.
Still not convinced it is expensive.
Did you benchmark or have other data to support you concern?
Oct 13, 2014 at 5:56 PM
Unfortunately, I didn't save any of the memory and the performance profile because there was no issue.
I trust the current quality of the HTML Rendered and it worth to be used but I am concerned about the future when a huge number of users access the service.
I will be happy to provide you with a new profile if it is worth to be studied.
Developer
Oct 14, 2014 at 8:07 AM
if you have concerns you should do stress testing on your system.
Oct 14, 2014 at 12:24 PM
I have run a memory profiler under this condition: 10,000 user generate a simple HTML file -> jpg. The generation process were done locally during a period of 10 minutes and users randomly access the service during the period.

Based on the test result, loading system fonts does NOT affect the memory. However, the result brings the CssBox to attention.

Please find the attached result.

https://www.dropbox.com/s/opoqbod8tbd8x9n/Summary.pdf?dl=0
https://www.dropbox.com/s/q8c08pweudwsg7p/HTML%20Renderer.pdf?dl=0
https://www.dropbox.com/s/xckjmzgert79m4h/CssBox.pdf?dl=0
Developer
Oct 14, 2014 at 12:34 PM
nice,
I'm aware that CssBox is expensive and was originally planning to handle it for v1.5 but it requires major infrastructure change.
If I'm reading the results correctly although its the heavies object there is no memory issues.
Oct 14, 2014 at 12:54 PM
Yes, there is no memory issues. I am pleased for that.

All the best.