We are finding that font selection is not consistent when using Aspose Slides. A font in a converted presentation will be set as Arial, which doesn’t match the source. This seems to be dependent on the number of fonts in the source directory we point Aspose to, with the issue more likely to appear as this directory grows.
It doesn’t look like the issue is related to any specific font: we have been able to replicate with Cambria, Segoe UI and Source Sans Pro. Even though we have included these in the fonts directory we are pointing Aspose Slides to, they occasionally get converted to Arial.
This is the specific line of code we’re using to set the font sources:
It seems you are experiencing inconsistent font selection when using Aspose.Slides, particularly with certain fonts being replaced by Arial during conversion. This issue appears to be influenced by the number of fonts in the directory you are using.
Here are some steps and considerations that may help you address this problem:
Font Availability: Ensure that the fonts you are trying to use (like Cambria, Segoe UI, and Source Sans Pro) are indeed available in the operating system where Aspose.Slides is running. If the specified font is not found, Aspose.Slides will substitute it with a default font, which in your case seems to be Arial.
Font Loading: You are currently using the following line of code to load external fonts:
Make sure that the fileConverterConfig.getFontsDirectory() is correctly pointing to the directory containing the required fonts. If the directory contains too many fonts, it might lead to conflicts or issues in font selection.
Font Substitution Rules: Check if there are any font substitution rules defined in your application. If specific rules are set, they may override the default behavior and lead to unexpected font replacements.
Testing with Fewer Fonts: Since you mentioned that the issue seems to worsen as the number of fonts increases, try testing with a smaller set of fonts in the directory. This can help identify if a specific font or a combination of fonts is causing the issue.
Aspose.Slides Documentation: For more detailed information on how Aspose.Slides handles font selection and substitution, you can refer to the official documentation on font selection sequences. This documentation outlines how Aspose.Slides searches for and applies fonts during presentation loading and conversion.
If the problem persists after trying these suggestions, consider reaching out to the Aspose support community for further assistance, as they may have additional insights or solutions based on similar experiences.
@zbowyer20bi,
Please ensure that the fonts you are trying to use are indeed available for your application on the operating system where the code is executed (try to load a font file in memory). If the fonts are available and the issue persists, please share the following additional files and information:
sample presentation file
code example to reproduce the problem
output file
OS version on which the code was executed
number of fonts in the folder from which the fonts are loaded
There are a few questions included around how the font cache works which might help to solve part of the problem, but there are a few more intermittent issues which I can’t reliably reproduce without knowing how the caching mechanism internals work. It seems like there might be some limits to the cache size affecting us.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): SLIDESJAVA-39646
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Yes, we use only FontsLoader.clearCache(). But it is worth clarifying right away that this works for adding fonts. If you remove fonts during work and then add them again, this can lead to unexpected results, since fonts are cached by the JDK itself.
Could you please describe this scenario in more detail? Do you load fonts all at once or one by one? Do you clear the cache before adding new fonts?
The message about replacing a font with itself is usually due to the fact that the font was not found among the fonts installed in the operating system. However, during the replacement, it was found in the shared fonts folder.
Could you please share the stack trace of the error? We will also need a set of fonts, the code that you use, and a presentation file that reproduces this problem (even if the frequency of reproduction is low).
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.