public void SetTrueTypeFontsFolder()
{
// Store the font sources currently used so we can restore them later.
FontSourceBase[] fontSources = FontSettings.DefaultInstance.GetFontsSources();
//ExStart
//ExFor:FontSettings
//ExFor:FontSettings.SetFontsFolder(String, Boolean)
//ExId:SetFontsFolderCustomFolder
//ExSummary:Demonstrates how to set the folder Aspose.Words uses to look for TrueType fonts during rendering or embedding of fonts.
Document doc = new Document(MyDir + "Rendering.doc");
// Note that this setting will override any default font sources that are being searched by default. Now only these folders will be searched for
// fonts when rendering or embedding fonts. To add an extra font source while keeping system font sources then use both FontSettings.GetFontSources and
// FontSettings.SetFontSources instead.
FontSettings.DefaultInstance.SetFontsFolder(@"C:\MyFonts\", false);
doc.Save(MyDir + @"\Artifacts\Rendering.SetFontsFolder.pdf");
//ExEnd
// Restore the original sources used to search for fonts.
FontSettings.DefaultInstance.SetFontsSources(fontSources);
}