Too big line spacing in Chinese DOC file

Hi,
the attached DOC file is rendered on 4 pages by Aspose.Words (ver 22.8 for .NET). In MS Word it is just 2 pages. The reason is in the big line spacings added by Aspose.

342348_Chinese_LineSpacing.zip (162.2 KB)

In the zip:
342348_Chinese_LineSpacing.doc - the problematic file
output.pdf - the PDF produced by Aspose
expected.PNG - the expected look - just two pages

Best Regards,
Vassil

@DWProject I cannot reproduce the problem on my side. Here is the output document produced on my side: out.pdf (93.4 KB)
It looks like the problem on your side occurs because fonts in your document are substituted upon rendering the document. You can implement IWarningCallback to get a notification when font substitution is performed.

According to MS Word the font is “PMingLiU” and I have it installed.

In Aspose I see tha warning that you mention, but the font is different there - even with Chienese characters. What else can I try?

WarningType = FontSubstitution
Descriptions = Font '新細明體' has not been found. 
Using 'Microsoft JhengHei Light' font instead. 
Reason: font info substitution.

@DWProject Most likely, Aspose.Words cannot access the required fonts. You can put them in folder and use it as fonts source:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/

Also, you can use code like this to check what fonts are available to Aspose.Words:

FontSettings settings = new FontSettings();

// Specify additional font source if required
// .......

// Print all available fonts
foreach (FontSourceBase fs in settings.GetFontsSources())
{
    foreach (PhysicalFontInfo fi in fs.GetAvailableFonts())
        Console.WriteLine(fi.FullFontName);
}

It is very interesting.

MS Word finds two fonts: “PMingLiU” and “PMingLiU-ExtB”
image.png (10.5 KB)

In the font settings I see just one: “PMingLiU-ExtB”
image.png (4.7 KB)

And as expected Aspose finds the one that I have with “-ExtB”
image.png (8.8 KB)

So, there is some difference between MS Word and Aspose. I agree - it is a strange situation.

@DWProject Have you tried to put the required fonts into a separate folder and use this folder as a fonts source?
Also, could you please save your source document as PDF using MS Word on your side and attach it here for our reference?

Here is the PDF produced by MS Word. 342348_LineSpacing.zip (120.9 KB)

It uses “PMingLiU” font. But, as I said the only font that I have is “PMingLiU-ExtB” and it is visible to Aspose (at least it is in the list returned by GetAvailableFonts())

“Have you tried to put the required fonts into a separate folder and use this folder as a fonts source?”
No, because I don’t know which is the required font.

This is the font that I have in Windows\Fonts folder. It is TTC which means a collection. But, it seems to contain just one font face.

image.png (8.3 KB)

@DWProject You can specify an empty folder as font source and use warning callback to get notification about font substitution. Such way you will get a list of fonts requested by Aspose.Words upon rendering your document:

Document doc = new Document(@"C:\Temp\in.doc");
doc.WarningCallback = new WarningCallback();

doc.FontSettings = new FontSettings();
doc.FontSettings.SetFontsFolder(@"C:\Temp\fonts", true);

doc.Save(@"C:\Temp\out.pdf");
private class WarningCallback : IWarningCallback
{
    public void Warning(WarningInfo info)
    {
        if (info.WarningType == WarningType.FontSubstitution)
            Console.WriteLine(info.Description);
    }
}

This code on my side shows the following warnings:

Font '新細明體' has not been found. Using 'Fanwood' font instead. Reason: first available font.
Font 'Times New Roman' has not been found. Using 'Fanwood' font instead. Reason: first available font.

As you can see 新細明體 and Times New Roman are the fonts used in your document and are requested by Aspose.Words.
If put these fonts into the font folder the document is rendered properly. mingliu.7z (9.5 MB), times.7z (1.7 MB)

Then this is the main difference. I don’t have “mingliu.ttc” as it is missing on a default windows instalation. Only “mingliub.ttc” is available.

Interesting is that MS Word somehow manage to handle the file without “mingliu.ttc”. Aspose does not.

Otherwise, thanks for the font. It works with it, but the question is why MS Word does not need it?

@DWProject Most likely MS Word gets mingliu.ttc fonts as cloud font on your side. Aspose.Words does not support cloud fonts. The fonts should be physically present on the machine where conversion is performed.

1 Like