Our product is using Aspose.Words for Java 19.4 and convert word docx/doc/xml(word2003) to PDF.
The current default Linux font table substitution rule provided by Aspose from common Windows system font is as follows in the order specified:
<Item OriginalFont=“Arial” SubstituteFonts=“Garuda, FreeSans, Liberation Sans, DejaVu Sans” />
<Item OriginalFont=“Courier New” SubstituteFonts=“FreeMono, Liberation Mono, DejaVu Sans Mono” />
<Item OriginalFont=“Times New Roman” SubstituteFonts=“FreeSerif, Liberation Serif, DejaVu Serif” />
e.g. if Arial is not available, Aspose uses Garuda. If Garuda is not found, it looks for FreeSans, Liberation Sans, and DejaVu Sans in this order.
When Arial is substituted to Garuda, you see huge line spacing. (see arial_Garuda.docx.out.pdf)
This would be from the font metrics(ascender/descender) difference as Garuda supports Thai which requires tall font metrics. Also as glyph width is different, word wrap positions are different. In addition, Garuda doesn’t have many language coverage which would result in appearing more glyphs appearing with fallback-font or square boxes. Also, when FreeSans is substituted, it shows same huge line spacing and different word wrap position. Note that FreeSans has many language coverage unlike Garuda. (arial_FreeSans.docx.out.pdf) Whereas Liberation Sans has same font metrics as Arial which gives same word-wrap position and line spacing. (arial_LiberationSans.docx.out.pdf)
Garuda and FreeSans looks more like Arial per the appearance, but Liberation would be better to be first due to the line spacing and word wrapping position problem.
Or is it a bug in aspose as FreeMono or FreeSerif doesn’t have the line spacing problem(* see below)?
Courier New mapping order, “FreeMono->Liberation Mono->DejaVu Sans Mono” is reasonable as FreeMono gives same word-wrapping position and line spacing. Note that ascender/descender are different from Courier New but FreeMono does NOT have the huge line spacing problem unlike Arial to FreeSans mapping. Also Liberation Mono is not Sans Serif but FreeMono is. So FreeMono has priority is good.
Yet for Times New Roman mapping to FreeSerif->Liberation Serif->DejaVu Serif order, the word-wrapping position is slightly different. It could be Liberation Serif could come first before FreeSans. But FreeSerif has more language coverage, this would be reasonable it comes first.
Hereby questions are:
- Would you please share the background of the order of those substituted fonts?
- Why Arial to Garuda/FreeSans has huge line spacing? e.g. how Aspose calculate the line spacing?