How can i convert to SVG while exporting the original font or setting a default font if the font isnt supported?


I’ve run into an issue where old .doc files are rendering in COMIC SANS instead of the original font. is it possible to set another fallback font IF the original font was unsupported? if this is possible could you leave a code example?

Attached is a file that exhibits this behaviour: (8.6 KB)

we have other .doc files that exhibit the same issues.


Thanks for your inquiry. We have tested the scenario with your shared document using Aspose.Words for .NET 17.7 and unable to notice issue. The SVG is being rendered in same font, Garamond is in your shared document case. Please download and try latest version of Aspose.Words for .NET, it will resolve the issue. (5.7 KB)

However if the issue persist then please share some more details. We will look into it and will guide you accordingly.


have you tested this code in an azure function?
the system font folder is located in D/Windows/Fonts.

the system fonts should be picked up by Aspose by default however they are not all being picked up. Some of them are. Times new roman for example is being missed and it is defaulting to Comic Sans. If we move the font folder out the conversion is fine. Is there some hard coding going on in the code for system folder paths that might cause your code to miss the font file?


Thanks for your feedback. I have tested the scenario on Windows 7. However it is font availability issue on system. Please note we have improved the font substitution mechanism in Aspose.Words for .NET 17.3. Now Aspose.Words use Font info from document to substitute the missing fonts. Please check Public API and Backward Incompatible changes section in Release notes of Aspose.Words for .NET 17.3.0 and following documentation link for more details of Font substitution details. Please also check how to specify font folder location. Hopefully it will help you to resolve the issue.

Furthermore, you may implement IWarningCallback to get notification of missing fonts and install these fonts accordingly.

Font Availability and Substitution
To specify True Type Fonts location

Document docWord = new Document("Input.docx");
docWord.WarningCallback = new HandleDocumentWarnings();
public class HandleDocumentWarnings : IWarningCallback
    /// <summary>
    /// Our callback only needs to implement the "Warning" method. This method is called whenever there is a
    /// Potential issue during document processing. The callback can be set to listen for warnings generated during document
    /// Load and/or document save.
    /// </summary>
    public void Warning(WarningInfo info)
        // We are only interested in fonts being substituted.
        if (info.WarningType == WarningType.FontSubstitution)
            Console.WriteLine("Font substitution: " + info.Description);

the strange thing about this problem is that it doesnt appear on Windows, 7, 8,10 or windows server 2016. it appears only in an Azure function. The application has access to the system folder that contains all installed fonts but doesn’t display all of them such as Times new roman. could you please test this in an azure function?

Also would it be possible to use the warningcallback to substitute fonts dynamically?


Thanks for your inquiry. I have tested the scenario on Windows and unfortunately currently I do not have Windows Azure. However our number of customers are using Aspose.Words on Windows Azure successfully. Please check following documentation link for the requirements to use Aspose.Words in Azure application. Hopefully setting Full Trust level will resolve the Fonts reading issue. Furthermore please check how to specify True Type Font location, it will provide you more control on Font usage.

About Aspose.Words and Windows Azure
How to specify True Type Fonts location

Can you please share some more details about the requirement? It will help us to understand and respond your query exactly.

Azure function is different from an Azure application. i have already read this documentation. you should test this application on Azure Functions.
For the dynamic font question i am asking if it is possible to swap a font if there is a warning thrown for a missing font. The defaultfontname property doesn’t work in the system folder path.
This situation is very urgent because of this strange behaviour: We have verified that the system path to the fonts is correct and Aspose is pointing to that font. In our case that path is : D:/Windows/Fonts. Now if aspose encounters a font not present on the system it will try and default to Times New Roman, however, what we are seeing is that it defaults to Comic Sans.
Is there any behaviour in Aspose that it would get fonts from elsewhere if not previously defined to do so? Also why does it pick Comic Sans if Times new Roman is not found? I am going to engage the Microsoft Azure Function team and your team to figure out where the failure is occurring.
We have also noticed that when we copy all the system fonts to a folder in our function and we tell Aspose to target that folder that everything works fine. Could you please check your default system folder font logic for us and let us know if there is behaviour we have not accounted for?
Could you please clarify this comment:
it saysDefaultFontName
// If the default font defined here cannot be found during rendering then the closest font on the machine is used instead.
where is it looking for the default font before it looks for the font in the machine?

WORDSNET-4316: Font Substitution Mechanism Improved
Previously Aspose.Words performed font substitution only in cases when FontInfo in the document for the missing font doesn’t contains the PANOSE. Now Aspose.Words evaluates all related fields in FontInfo (Panose, Sig etc) and finds the closest match among the available font sources. In case of font substitution the warning is issued with text:
“Font ‘<font_name>’ has not been found. Using ‘<substitution_name>’ font instead. Reason: closest match according to font info from the document.”
Please note that now font substitution mechanism will override the FontSettings.DefaultFontName in cases when FontInfo for the missing font is available in the document. FontSettings.DefaultFontName will be used only in cases when there are no FontInfo for the missing font.
Also please note that font substitution algorithm in MS Word is not documented. And the result of Aspose.Words font substitution may not match MS Word choice.

This sounds like buggy feature, in our case it is relating Garamond to Comic Sans. is there a way this can be improved to include a font within the font family ? it doesn’t make sense for the algorithm to not consider the specified DefaultFontName. having Comic Sans in place of Garamond is a HUGE difference for a resume displayed to a recruiter as this font is considered a faux pas!
Whats weird is how this behaviour does not occur if the fonts are in a different folder. this is quite strange.


Thanks for your feedback. In reference to new font substitution mechanism, it overrides DefaultfontName. Please check following notes in Font availability and substitution documentation section.

"Note that now font substitution mechanism will override the FontSettings.DefaultFontName in cases when FontInfo for the missing font is available in the document. FontSettings.DefaultFontName will be used only in cases when there are no FontInfo for the missing font.

Note that the fonts which are set by SetFontSubstutites/AddFontSubstitutes methods are checked after the step #2. So if font is not present in the system but the substitute is found, the font is still considered as properly resolved. In this case, steps #3 to #5 are not performed."_

However for further investigation of the issue please confirm you mean you are copying fonts from same system(D:/Windows/Fonts) to new font folder or from some other system? and when you use that font folder then API uses which font for SVG rendering? Please also share both SVG output documents, generated using system default font folder and custom font folder. It will help us to investigate the issue.

Currently you can define font substitution manually using SetFontSubstitutes method and AddFontSubstitutes method. However, we have logged an enhancement request WORDSNET-15725 for your requirement to add font substitution dynamically on basis of IWarningCallback. We will keep you updated about the issue resolution progress within this forum thread.

Would it be possible to toggle the registry access logic such that our app can run in Azure Function without full trust access? We only need access to the system folder for fonts so I think that would be sufficient without registry access.

The system folder is accessible without full trust access in Azure Functions.


Thanks for your inquiry. I doubt in the subjected scenario it would not be possible to run Aspose.Words without Full trust level access. However, we have logged a ticket WORDSNET-15731 in our issue tracking system for further investigation and will guide you accordingly.


Thanks for your patience. Please note our product team has investigated the scenario and confirmed that you need to run your application under Windows Azure with Full Trust. Because not only Aspose.Words needs to enumerate and read TrueType fonts installed on the computer to convert documents to PDF, XPS or render images of pages but for .NET reflection as well. As a bottom line result, almost all moderately sized apps need full trust because nearly all widespread libraries need it too.

Azure Functions do not have a setting for full trust permission


Thanks for your feedback. We have shared your concern with the team and we will notify you as soon as we get some update.


Thanks for your patience. Please note you need to change Windows Azure for Full Trust. According to the article running an application under Full Trust in Windows Azure is easy – you just need to change one setting in the service configuration file. You may also try to find in Google which setting you need to change.