Hi Team
We upgraded our servers and on the new server with the latest code, we see certain fonts mismatch. By adding the log statement on HandleDocumentSubstitutionWarnings, identified below mismatch. Can we know where do we download the fonts to resolve below issue.
We are using RedHat linux server 7.x
Description:Font 'CIDFont+F2' has not been found. Using 'DejaVu Sans' font instead. Reason: font info substitution.
Description:Font 'ArialMT' has not been found. Using 'DejaVu Sans' font instead. Reason: table substitution.
Description:Font 'Toyota Type Book' has not been found. Using 'DejaVu Sans' font instead. Reason: font info substitution
Description:Font 'Arial,Bold' has not been found. Using 'DejaVu Sans' font instead. Reason: table substitution.
@ashwath Aspose.Words does not provide fonts. Some of MS fonts are available in mscorefonts package. The easies way to get all MS fonts is to copy them from MS Windows machine. Please see our documentation to learn how to install fonts on linux: https://docs.aspose.com/words/java/install-truetype-fonts-on-linux/
Hi @alexey.noskov
We installed Windows font from our machine onto server and we see now rendering is better, but the result is still not exact match.
Can you help us with below 2 questions
I believe Aspose.Words-22.6-jdk16 is not able to read embed fonts, can we verify this? The template word documents are saved using Embed fonts option in the word document.
Is there a way we can have code to make ‘Arial’ as default instead of system font ‘DejaVu Sans’?
I tried below approach but its not working.
FontSettings fontSettings = FontSettings.getDefaultInstance();
TableSubstitutionRule substitutionRule = fontSettings.getSubstitutionSettings().getTableSubstitution();
// If "UnknownFont1" font family is not available then substitute it by "Arial".
substitutionRule.addSubstitutes("UnknownFont1", new String[] { "Arial" });
substitutionRule.addSubstitutes("DejaVu Sans", new String[] { "Arial" });
// Get inputFile to Document format
InputStream isDocFile = new ByteArrayInputStream(inParamFile);
Document doc = new Document(isDocFile);
Could you please attach your input document with embedded fonts here for testing, We will check the issue and provide you more information.
As I can see from the warnings provided in your initial post DejaVu Sans is used as font info substitution and as table substitution. In the first case the alternative font is specified in the document’s font info. You can try disabling particular font substitution rules using using FontSubstitutionRule.Enabled property.
location of missing font.zip (4.9 MB)
Hi @alexey.noskov
PFA the template file, I have also highlighted the text on which the font not rendering in another document for your reference.
@ashwath The mentioned font are not embedded into the template document. You can check this by unzipping the template document and inspecting fontTable.xml:
Hi @alexey.noskov
When we using the old server, and new Aspose.Words-22.6-jre16.jar file, we still seeing mismatch in the document rendering on the same font. When reverting to Aspose.Words-15.3-jre16.jar and its behaving correctly.
On the same server, why we observing difference in rendering of word due to difference of Aspose.Words version ?
Substitution message with 22.6 version
In DocToPdf(), Font ‘CIDFont+F2’ has not been found. Using ‘Fanwood’ font instead. Reason: first available font.
@ashwath It looks like there are no available font in the environment where the document is converted, since the last resort font Fanwood is used for rendering the document. This font is embedded into Aspose.Words dll and is used if no other fonts are available.
Yes, @alexey.noskov . From our analysis, the default font in the Aspose.Words itself has gotten changed, which is causing us the observed difference.
In aspose-words-22.6-jdk16.jar , under Resource folder we seeing Fanwood.ttf file.
In aspose-words-15.3.0-jdk16, under Resource folder we seeing GenBasR.ttf file.
Please confirm if no font files are found in system, respective (as above) fonts are getting used.
Any reason for change ?
While using 22.6 version, how can we have the same default font as was in 15.3 version ?
@ashwath15.3.0 is very old version of Aspose.Words, it was released more than 8 years ago. The last resort font has been changed due to licensing issues. If you need to use GenBasR.ttf you can install this font in your environment.