Henderson Sans Basic Light font rendering in Microsoft Word but not in Aspose.Word

The font Henderson Sans Basic Light is not rendering when using Aspose.Word. The font is installed on the machine but the font is not displayed. Is this font not supported by Aspose ? Is there a complete list of fonts that Aspose.Word does support ?

@CeciliaV Could you please attach the problematic document, font and output documents produced by Aspose.Words and MS Word on your side? We will check the issue and provide you more information.

Please see our documentation to learn what font types are supported by Aspose.Words:
https://docs.aspose.com/words/net/manipulating-and-substitution-truetype-fonts/#differences-in-processing-of-font-formats-in-asposewords-and-microsoft-word

Henderson Sans Basic.zip (90.9 KB)

Attached the font. I am using Aspose.Words 19.4.
Here is the view in Aspose vs in Word:

@CeciliaV Thank you for additional information. Could you please also attach your input and output documents here for our reference? We will check the issue and provide you more information.

Oficio.docx (506.6 KB)

This is the file.

@CeciliaV Thank you for additional information. Font name specified in your document differs from the font name in the provided fonts. In the document font name is Henderson Sans Basic Light but the actual font name in TTF is Henderson Sans W00 Basic Light. You can configure substitution rule to use this font. For example see the following code:

Document doc = new Document(@"C:\Temp\in.docx");
doc.WarningCallback = new WarningCallback();
doc.FontSettings = new FontSettings();
doc.FontSettings.SetFontsSources(new FontSourceBase[] { new SystemFontSource(),  new FolderFontSource(@"C:\Temp\fonts", true) });

doc.FontSettings.SubstitutionSettings.TableSubstitution.AddSubstitutes("Henderson Sans Basic Light", "Henderson Sans W00 Basic Light");
doc.FontSettings.SubstitutionSettings.TableSubstitution.AddSubstitutes("Henderson Sans Basic", "Henderson Sans W00 Basic SemiBd");

doc.Save(@"C:\Temp\out.pdf");

You can use the following code to get fonts available in the specified font sources:

FontSourceBase[] sources = doc.FontSettings.GetFontsSources();
foreach (FontSourceBase fs in sources)
{
    foreach (PhysicalFontInfo info in fs.GetAvailableFonts())
    {
        Console.WriteLine("{0} - {1}", info.FullFontName, info.FilePath);
    }
}

Thanks Alexey,
Thanks for the suggestion, but I haven’t been able to get the substitution to work. I tried the code to get the available fonts through GetAvailableFonts(). I see that Henderson Sans W00 Basic Light is loaded:

I tried it out with a word doc with less text, this time saving it with Henderson Sans W00 Basic Light as the font name, but the font still does not load in Aspose. The font name now matches ‘FullFontName’ property so I would expect this to load. I attached this document
HENDERSON SANS BASIC LIGHT - spaces.docx (11.8 KB)

Aspose view:

@CeciliaV Thank you for additional information. Unfortunately, I cannot reproduce the problem on my side. I have used the following simple code:

Document doc = new Document(@"C:\Temp\in.docx");
doc.WarningCallback = new WarningCallback();
doc.FontSettings = new FontSettings();
doc.FontSettings.SetFontsSources(new FontSourceBase[] { new SystemFontSource(), new FolderFontSource(@"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);
    }
}

C:\Temp\fonts folder contains the fonts you have attached earlier.
Aspose.Words does not show any warnings about font substitution and the document is rendered properly. Please see the output produced on my side:
out.pdf (6.7 KB)

As you can see Henderson Sans W00 Basic Light is the only font embedded into the output PDF:

1 Like

@alexey.noskov Thanks I was able to find the problem. Aspose was correctly finding the font, but the browser was unable to find the font-family HenderSansW00-BasicLight. I am outputting an svg from the word doc. As a workaround, I added some CSS to define the font-face so that the browser is able to find the font-family. Thanks for your help !

@CeciliaV It is perfect that you managed to resolve the problem. Please feel free to ask in case of any other issues. We are always glad to help you.