We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How does fontloader in aspose.slides for java determine system font directories?


Could you please let me know how FontsLoader.getFontFolders() in Aspose.Slides for Java (v20.5) determines the system font directories?

I’m running Aspose Slides in a linux environment, with a custom font config (set via FONTCONFIG_PATH). This makes fontconfig properly load fonts from an app-specific set of directories. GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames() sees the custom fonts, but Aspose Slides FontsLoader.getFontFolders() seems to see only the directories configured in the system /etc/fonts/fonts.conf, not the custom font config.

I know it’s possible to load external fonts using FontsLoader, but I prefer to use the fontconfig setup for consistency with other things running on the same environment.
I assume this is not a bug with Aspose, but I likely need to configure something else so Aspose slides reads the correct font configuration, but without knowing what exactly to configure it’s difficult to do so.

Thanks in advance!


Aspose.Slides use following folders to search fonts other than external fonts directories.

We use the following folders and files for searching:

I hope the shared information will be helpful.


Thanks for confirming. So the FONTCONFIG_PATH environment variable is ignored then?

Is there some other way to tell Aspose.Slides where to look for fonts.conf?


Can you please elaborate? I have shared the places where Aspose.Slides looks for fonts during execution.


Thanks for responding so quickly. My application runs in a container where the system partitions (including /etc/ and /usr and /home) are read-only and outside my control; hence I had to provide a custom fontconfig instead of changing the /etc/fonts one. None of the locations you mentioned are possible for me to modify.

I was looking for a way to tell Aspose.Slides where to find the fonts.conf file that’s not in the preconfigured places you are trying to find it.

The usual way to set up fonts in such situations on linux is to use the FONTCONFIG_PATH environment variable, which tells the fontconfig system library where to look for an alternate fonts configuration files. The Java font manager itself sees the fonts configured that way (I can see them using GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()), but Aspose.Slides does not.


The only way to tell Aspose.Slides is to use FontsLoader.LoadExternalFonts() method which will tell Aspose.Slides to look for fonts in custom directories other than preset one.