When converting pptx files to pdf files, we’ve noticed that the Aspose library seems to make a copy of the fonts we’ve requested it to use and copies them into /tmp.
For example: /tmp/+~JF8771052995427002374.tmp
As we have a large number of fonts (936) using 418MB in total, for each invocation 418MB of font data is copied each time. This contributes to a slower throughput.
Is there anything that can be done to avoid this?
It looks like there are some low level java calls which are making this copy, looking at the stacktrace this is called from:
com.aspose.slides.FontLoader.do()
Which ultimately ends up calling into the following java classes which copy the fonts:
I have observed the requirements shared by you and like to share that we are investigating the issue on our end and will share the feedback with you as soon as it will be shared by our development team.
Our development team has investigated the issue and I like to add here that Aspose.Slides calls the Font.createFont(…) method only from FontsLoader.loadExternalFonts(String[]). The FontsLoader.loadExternalFonts(String[]) should be called only once after Aspose.Slides library loading. If only system installed fonts are used then the FontsLoader.loadExternalFonts(String[]) method calling is not needed.
If you intend to load external fonts other than installed system fonts then you will have to use FontsLoader.loadExternalFonts(String[]) method and it will be used for entire program as long as it will be running so you need to load only once for application. In order to avoid the large number of fonts being copied using loadExternalFonts method, I suggest you to please copy only required fonts in a predefined directory and then load fonts externally from that directory only. It will help in resolving issue of loading unnecessary fonts during rendering and thus improving the rendering performance.
That’s correct we are setting external fonts. From your explanation it would appear that if the fonts were copied into the system location this would not occur, is that correct?
Could you confirm the system location or directory where the Aspose library will look for the fonts?
Aspose.Slides doesn’t looks for fonts at all. JRE should be properly configured. And it should know about all fonts installed in a system (Windows or Linux). JRE has its own font configurations and Aspose.Slides uses JRE fonts functionality.
Also as shared earlier, Aspose.Slides has additional functionality FontsLoader.loadExternalFonts(String[] paths) which allows to use fonts which are not installed in system folders (which are not accessible through JRE functionality).
You may need to visit JRE configuration in this regard. You can Google over the internet further for JRE fonts configuration. Some of the links that can be helpful are as under: