Font settings - Linq Reporting Engine issue

Hello,

I am using Aspose word (version:23.8) java, trying to generate a document that has some fonts that are not supported in windows by default. So we downloaded those fonts and now need to set the fonts settings.

We have the below code but it is not working.

FontSettings fontSettings = new FontSettings();
fontSettings.setFontsFolder("C:\\MyFonts\\", true);
doc.setFontSettings(fontSettings);

MyFonts is a folder with the downloaded fonts plus other window fonts.

Thanks for your help

@abdullah240 What is the output format of the report? Usually, physically fonts are required when output format is fixed page format, like, PDF or XPS. If output format is MS Word document, i.e. DOCX, DOC etc, then fonts are not normally required, since by default fonts are not embedded into the output document is such case. However, if you need to embed fonts into output MS Word document, you can achieve this using FontInfoCollection.EmbedTrueTypeFonts property.

Please elaborate your scenario in more details and provide input and output document along with code that will allow us to reproduce the problem and the problematic fonts here for testing. We will check the issue on our side and provide you more information.

@alexey.noskov The output format is pdf.

Here is more information:

We have a spring boot application where we are using the Aspos.Words liberary. Some documents have fonts that are not supported by windows so we have to download them. We have added a folder with all the fonts in our spring boot application under the resources folder.

When we give relative or absolute path to that folder it works in our development environment. We need to use resource loader to get that folder path to deploy it.

This is the code we have but it does not work:

FontSettings fontSettings = new FontSettings();
fontSettings.setFontsSources(new FontSourceBase[] { new SystemFontSource(),
	new FolderFontSource(ResourceUtils.getFile("classpath:MyFonts").getPath(), true) });
docAsponse.setFontSettings(fontSettings);

Is there a way for us to get the fonts from under that resource folder and further more is there a better way to do this.

In some cases we just need a few fonts but setting the font folder means we have to include all the fonts from system font folder

Thanks for your help!

@abdullah240 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