Extra fonts problem

Hello,


i have to generate a document in which together with the standardfonts a special font was needed (barcode).

i read the manual, api and examples an all works fine in my windows test-environment. But in production environment on linux (without X, only a batch system), same code generates unreadable rubbish. Only the special font was ok. Did i miss something special for the linux environment?

Thanks a lot!

Klaus

This is my code - copied from the examples, fine on windows:

String fontDir = templateDir + System.getProperty(“file.separator”) + “fonts”;
if(isDebug) System.out.println("generateDoc: fontDirectory: "+fontDir);
ArrayList fontSources = new ArrayList(Arrays.asList(FontSettings.getFontsSources()));
FolderFontSource folderFontSource = new FolderFontSource(fontDir, true);
fontSources.add(folderFontSource);
FontSourceBase[] updatedFontSources = (FontSourceBase[])fontSources.toArray(new FontSourceBase[fontSources.size()]);
FontSettings.setFontsSources(updatedFontSources);

A loop over updatedFontSources shows:

generateDoc: updatedFontSources[0] com.aspose.words.SystemFontSource@11eea7f0
generateDoc: updatedFontSources[1] com.aspose.words.FolderFontSource@58b45130



Hi Klaus,

Thanks for your inquiry. Please upgrade to the latest version of Aspose.Words i.e. 13.8.0 and let us know how does it go on your side? You can download it from the following link:

Download Aspose.Words for Java

In case the problem still remains, could you please attach your input/output Word/Pdf documents and your font file(s) here for testing? I will investigate the issue on my side and provide you more information.

Best regards,

awais.hafeez:
In case the problem still remains, could you please attach your input/output Word/Pdf documents and your font file(s) here for testing? I will investigate the issue on my side and provide you more information.

Sorry, but same problem with the actual version.
A Zip-File with the document, fonts and a code-snipplet was attached.

Thanks
Klaus

Hi Klaus,


Thanks for the additional information. I installed your fonts on my ubuntu machine and was unable to reproduce this issue on my side. Does the problem still remains if you omit the call to “initFonts” function from the main functions’s body? Could you please also perform mail merge operation on your “Scanauftrag.doc” and send the .doc document showing the merge fields filled with data?

Best regards,
awais.hafeez:
I installed your fonts on my ubuntu machine and was unable to reproduce this issue on my side.

Sorry, the fonts are not the problem.
Do you test on your Unbuntu without intalled X-Windows environment (no /usr/X11R6/lib/X11/fonts)?
Thats my environment ... a pure batch-server without any GUI (located in the datacentre).

Generating docs works fine in this environmant (no font-problems) until i add the code in "iniFonts" to add the additional fonts!
My guess is, that aspose dont use its internal(?) fonts, when i add additional fonts!

regards
klaus

Hi Klaus,

Thanks for the additional information.

By default, Aspose.Words looks for fonts installed to the standard system locations on a particular OS and you can retrieve an array of these environment-dependent font sources ( system folders that are searched by default ) by using FontSettings.GetFontsSources method. However, specifying a custom font folder by using FontSettings.SetFontsFolder method will override these default font sources and in this case only custom font folders are searched for fonts. I think, in your case, you need to specify fonts to be read from both the default system folders and from a folder filled with your own fonts. Please read the “Specifying Fonts to be Read from both the Windows Fonts Folder and a Custom Folder” section in the following link:

I hope, this helps.

PS: It could be that I was unable to reproduce your issue on my side because I did test your scenario on a Ubuntu machine which has it’s own GUI.

Best regards,