Clear fonts default set by Aspose

Hi support,

I’m trying to replace some font by another (Arial>Arimo, Symbol> SymbolNeu, Calibri>Carliton etc…).

I add font substitution with :

FontSettings.getDefaultInstance().addFontSubstitutes("Calibri", "Carlito");

But aspose already replace Carlibri by Liberation Sans in first position(I’ve checked with FontSettings.getDefaultInstance().getFontSubstitutes("Calibri"))

How can I define myself font substitution ?

I’ve another issue, I define as mentioned above subsitute Symbol by SymbolNeu and callback notified me “Font ‘Symbol’ has not been found. Using ‘Geneva’ font instead. Reason: default font setting.” (I define default font with FontSettings.getDefaultInstance().setDefaultFontName(“Geneva”)). SymbolNew folder was added to folder font source (without recursivity) because it was not in /usr/share/fonts.

Any ideas ?

SymbolNeu could be find here : https://github.com/powerline/fonts/

Thanks in advance,

Florian Mélot

Hi Florian,

Thanks for your inquiry. Aspose.Words tries to find a font on the file system and then find it in embedded fonts in the original document. Please refer to the following article:

Font Availability and Substitution

If you still face problem, please attach the following resources here for testing:

  • Your input Word document
  • Please create a simple Java application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.

Hi Tahir,

Thanks for your answer.

I’ve uploaded on mega a zip which contains java class and all fonts used in this case. (I haven’t attached class HandleDocumentWords, you could delete line 77).

Original file (docx) was attached to the first post.

https://mega.nz/#!kY5A3ZDI!blEOQ-Rq29ANoxJyc-TH97thP5Rqw7t6fYPss342cOY

Result of running below :

Font : Arial replaced by Garuda
Font : Arial replaced by FreeSans
Font : Arial replaced by Liberation Sans
Font : Arial replaced by DejaVu Sans
Font : Arial replaced by Arimo
Font : ArialMT replaced by Arimo
Font : Arial Unicode MS replaced by TakaoPGothic
Font : Arial Unicode MS replaced by Arimo
Font : Times New Roman replaced by FreeSerif
Font : Times New Roman replaced by Liberation Serif
Font : Times New Roman replaced by DejaVu Serif
Font : Times New Roman replaced by TinosForPowerline
Font : Courier New replaced by FreeMono
Font : Courier New replaced by Liberation Mono
Font : Courier New replaced by DejaVu Sans Mono
Font : Courier New replaced by Cousine
Font : Cambria replaced by Caladea
Font : Calibri replaced by Liberation Sans
Font : Calibri replaced by Carlito
Font : Symbol replaced by SymbolNeuForPowerline
Font : Segoe UI replaced by Selawik
Font : Tahoma replaced by Kalimati
Font : Tahoma replaced by WineTahoma
03-10-2016 14:25:41 DEBUG HandleDocumentWords:16 - Substitution de police : Font substitutes: ‘Calibri’ replaced with ‘Liberation Sans’.
03-10-2016 14:25:41 DEBUG HandleDocumentWords:16 - Substitution de police : Font substitutes: ‘Arial’ replaced with ‘Garuda’.
03-10-2016 14:25:41 DEBUG HandleDocumentWords:16 - Substitution de police : Font substitutes: ‘Times New Roman’ replaced with ‘FreeSerif’.
03-10-2016 14:25:41 DEBUG HandleDocumentWords:16 - Substitution de police : Font substitutes: ‘Courier New’ replaced with ‘FreeMono’.
03-10-2016 14:25:41 DEBUG HandleDocumentWords:16 - Substitution de police : Font ‘Arial Narrow’ has not been found. Using ‘Arimo’ font instead. Reason: default font setting.
03-10-2016 14:25:41 DEBUG HandleDocumentWords:16 - Substitution de police : Font substitutes: ‘Cambria’ replaced with ‘Caladea’.
03-10-2016 14:25:41 DEBUG HandleDocumentWords:16 - Substitution de police : Font ‘Symbol’ has not been found. Using ‘Arimo’ font instead. Reason: default font setting.
03-10-2016 14:25:42 DEBUG HandleDocumentWords:16 - Substitution de police : Font substitutes: ‘Arial Unicode MS’ replaced with ‘TakaoPGothic’.
03-10-2016 14:25:42 DEBUG HandleDocumentWords:16 - Substitution de police : Font substitutes: ‘Segoe UI’ replaced with ‘Selawik’.

Regards,

Florian Mélot

Hi Florian,

Thanks for sharing the detail. We have tested the scenario using latest version of Aspose.Words for Java 16.8.0 and have not found the shared issue. Please use Aspose.Words for Java 16.8.0.

We suggest you please read following documentation link.

How to Install True Type Fonts on Linux

To replace a font by another, it’s necessary to specify it with :

FontSettings.getDefaultInstance().setFontSubstitutes("Calibri", ["Carlito"]);

If add method is used, aspose took his own substitution.

Why font substitution defined by user has the lowest priority ?

Regards,

Florian

Hi Florian,

Thanks for your inquiry. We have not found the shared issue with addFontSubstitutes and setFontSubstitutes methods. We suggest you please use latest version of [Aspose.Words for Java 16.10.0]https://releases.aspose.com/words/java/ and read following documentation link.

Font Availability and Substitution

If you still face problem, please share complete detail of your use cases along with simplified code example to reproduce the issue at our end. We will investigate the issue on our side and provide you more information.