Hello Aspose support,
we are converting RTF or DOC(X) documents to HTML using Aspose Words for Java.
The code looks like this:
HtmlFixedSaveOptions options = new HtmlFixedSaveOptions();
options.setExportEmbeddedImages(true);
options.setExportEmbeddedCss(true);
options.setExportEmbeddedFonts(true);
options.setExportEmbeddedSvg(true);
options.setUpdateFields(false);
Document doc = new Document(inputStream);
doc.save(outputStream, options);
Quite simple. This is the font setup we use:
private void setupFontsFolderWithoutDefaults(List<String> fontsFolderPaths, FontSettings fontSettings) {
fontSettings.setFontsFolders(fontsFolderPaths.toArray(new String[fontsFolderPaths.size()]), true);
}
where fontsFolderPaths is a list of directories and fontSettings is FontSettings.getDefaultInstance().
A conversion problem occurs when we have Windows core fonts (like Arial or Times New Roman) in those folders as well as the NotoSansCJKjp-Regular.otf. Aspose prefers those core fonts over the NotoSans UTF-8 font which would render the results correctly (if you remove all other fonts from the configured font folders). The resulting HTML contains e.g. Times New Roman as font, while the browser uses some local font to render the characters (it realizes that Times New Roman cannot display them). But this results in text overlapping, wrong line overflows etc.
Please check out the attached screenshots of the good and bad HTML result as well as the example document (using MS Mincho for the Asian characters - but we could also have the text using a standard font replaced dynamically with some text that might contain Asian characters).
good_result.png (119.1 KB)
bad_result.png (84.4 KB)
example_document.docx (22.3 KB)
Is there any possibility to influence which fonts Aspose prefers?
Kind regards,
Stefan