Aspose.Word Java - add custom-fonts to resource-directory of application/jar

Hello,

I have read that there is a way to specify a directory to load fonts from.

Is there also a way to load the fonts delivered by the application directly by src/main/resources/fonts - path?

I had in mind to do it via FontSettings.getDefaultInstance().setFontsSources() but I can´t find a proper solution.
I´m using Aspose.Words 22.1.

Thank you and kind regards

@Mike07428 You can use any accessible folders as fonts source. Pleas see our documentation to learn how to specify location where Aspose.Words will look for fonts:
https://docs.aspose.com/words/java/specify-truetype-fonts-location/

In your case, if I understand you correctly, you would like to load fonts from your JAR. Unfortunately, there is no way to specify font’s folder inside JAR, but in this case you can use StreamFontSource. See the following article for more information:
https://docs.aspose.com/words/java/specify-truetype-fonts-location/#loading-fonts-from-stream

StreamFontSource is working - thank you!

Topic can be closed

1 Like